/* ═══════════════════════════════════════════════════════════════
   style.css — La Ferme · ESITC Paris
   Design system : Apple-inspired, mobile-first, vert forêt
   ═══════════════════════════════════════════════════════════════ */

/* ── TOKENS ── */
:root {
  --bg:          #f5f5f7;
  --surface:     #ffffff;
  --surface2:    #f5f5f7;
  --border:      rgba(0,0,0,0.08);
  --text:        #1d1d1f;
  --text2:       #6e6e73;
  --text3:       #86868b;
  --accent:      #2d6a4f;
  --accent2:     #52b788;
  --accent-light:#d8f3dc;
  --red:         #ff3b30;
  --orange:      #ff9500;
  --blue:        #007aff;
  --radius:      18px;
  --radius-sm:   12px;
  --shadow:      0 2px 20px rgba(0,0,0,0.08);
  --shadow-lg:   0 8px 40px rgba(0,0,0,0.12);
}

/* ── RESET ── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html { font-size: 16px; }
body {
  font-family: -apple-system, 'SF Pro Display', 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ═══════════════════════════════════════
   SCREENS
═══════════════════════════════════════ */
.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; flex-direction: column; }

/* ═══════════════════════════════════════
   NAV
═══════════════════════════════════════ */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(245,245,247,0.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  height: 52px;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-logo {
  font-family: 'Fraunces', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
}
.nav-sub { font-size: 0.72rem; color: var(--text3); font-weight: 500; }

/* ═══════════════════════════════════════
   BUTTONS
═══════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 24px;
  border-radius: 14px;
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34,1.56,0.64,1);
  font-family: inherit;
  text-align: center;
}
.btn:active        { transform: scale(0.97); }
.btn-primary       { background: var(--accent); color: white; }
.btn-primary:hover { background: #1b4332; }
.btn-secondary     { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface2); }
.btn-ghost         { background: transparent; color: var(--accent); padding: 8px 12px; }
.btn-danger        { background: var(--red); color: white; }
.btn-full          { width: 100%; }
.btn-sm            { padding: 8px 16px; font-size: 0.85rem; border-radius: 10px; }
.btn:disabled      { opacity: 0.4; cursor: not-allowed; transform: none; }

/* ═══════════════════════════════════════
   CARDS
═══════════════════════════════════════ */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}
.card-body   { padding: 20px; }
.card-toolbar {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ═══════════════════════════════════════
   FORM ELEMENTS
═══════════════════════════════════════ */
.form-group   { margin-bottom: 16px; }
.form-label   {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.form-input, .form-select {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface2);
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.form-input:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(45,106,79,0.12);
  background: white;
}
.form-input.error { border-color: var(--red); }

/* Message d'erreur champ */
.field-error {
  color: var(--red);
  font-size: 0.82rem;
  margin-top: 4px;
}

/* ═══════════════════════════════════════
   CHIPS
═══════════════════════════════════════ */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 10px 18px;
  border-radius: 50px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.chip:hover              { border-color: var(--accent2); }
.chip.selected           { background: var(--accent); color: white; border-color: var(--accent); }
.chip.disabled           { opacity: 0.35; cursor: not-allowed; }

/* ═══════════════════════════════════════
   SECTION HEADERS
═══════════════════════════════════════ */
.section-title {
  font-family: 'Fraunces', serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.section-sub   { font-size: 0.9rem; color: var(--text2); margin-bottom: 16px; }
.subsection-label {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text2);
  margin-bottom: 10px;
  margin-top: 4px;
}

/* ═══════════════════════════════════════
   BADGES
═══════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center;
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-green  { background: #d8f3dc; color: #1b4332; }
.badge-orange { background: #fff3cd; color: #856404; }
.badge-red    { background: #fce8e6; color: #c0392b; }
.badge-blue   { background: #e3f0ff; color: #0055cc; }
.badge-gray   { background: #f0f0f0; color: #555;    }

/* ═══════════════════════════════════════
   ALERTS
═══════════════════════════════════════ */
.alert {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  display: flex; align-items: flex-start; gap: 10px;
}
.alert-warning { background: #fff8e7; color: #7d5a00; border: 1px solid #ffe08a; }
.alert-error   { background: #fce8e6; color: #c0392b; border: 1px solid #f5c6c1; }
.alert-success { background: #d8f3dc; color: #1b4332; border: 1px solid #b7e4c7; }
.alert-info    { background: #e3f0ff; color: #0055cc; border: 1px solid #b6d4fe; }

/* ═══════════════════════════════════════
   LAYOUT HELPERS
═══════════════════════════════════════ */
.divider    { height: 1px; background: var(--border); margin: 20px 0; }
.scroll-body { flex: 1; overflow-y: auto; padding: 20px; padding-bottom: 100px; }

/* ═══════════════════════════════════════
   STICKY BOTTOM (client)
═══════════════════════════════════════ */
.sticky-bottom {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(245,245,247,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  padding: 16px 20px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}

/* ═══════════════════════════════════════
   SCREEN: LANDING
═══════════════════════════════════════ */
#screen-landing {
  background: linear-gradient(160deg, #f5f5f7 0%, #e8f5e9 100%);
  align-items: center;
  justify-content: center;
}
.landing-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
  width: 100%;
}
.landing-logo {
  width: 80px; height: 80px;
  background: var(--accent);
  border-radius: 22px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 24px;
  box-shadow: 0 8px 32px rgba(45,106,79,0.3);
}
.landing-logo svg { width: 44px; fill: none; stroke: white; stroke-width: 1.8; }
.landing-title {
  font-family: 'Fraunces', serif;
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 8px;
  color: var(--text);
  letter-spacing: -0.03em;
}
.landing-sub    { font-size: 1.05rem; color: var(--text2); margin-bottom: 40px; line-height: 1.5; }
.landing-btns   { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 320px; margin: 0 auto; }
.landing-footer { margin-top: 32px; font-size: 0.78rem; color: var(--text3); }

/* ═══════════════════════════════════════
   SCREEN: CLIENT — steps
═══════════════════════════════════════ */
.order-step               { display: none; }
.order-step.active        { display: block; }

/* Progress dots */
.step-indicator {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 0;
}
.step-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--border);
  transition: all 0.3s ease;
}
.step-dot.active { width: 20px; border-radius: 3px; background: var(--accent); }
.step-dot.done   { background: var(--accent2); }

/* Formula cards */
.formula-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 10px;
}
.formula-card:hover               { border-color: var(--accent2); }
.formula-card.selected            { border-color: var(--accent); background: var(--accent-light); }
.formula-card-header              { display: flex; justify-content: space-between; align-items: center; }
.formula-name                     { font-weight: 700; font-size: 1rem; }
.formula-price                    { font-family: 'Fraunces', serif; font-size: 1.3rem; font-weight: 700; color: var(--accent); }
.formula-desc                     { font-size: 0.85rem; color: var(--text2); margin-top: 4px; }

/* Order summary recap */
.order-summary {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 18px;
}
.summary-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; font-size: 0.95rem; }
.summary-row.total { font-weight: 700; font-size: 1.1rem; border-top: 1px solid var(--border); margin-top: 8px; padding-top: 12px; }

/* Upload zone */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.upload-zone:hover    { border-color: var(--accent); background: var(--accent-light); }
.upload-zone.has-file { border-color: var(--accent); background: var(--accent-light); }

/* Ticket */
#ticket-display {
  background: white;
  border-radius: var(--radius);
  border: 2px dashed var(--accent2);
  padding: 24px;
  text-align: center;
}
.ticket-header { margin-bottom: 16px; }
.ticket-name   { font-family: 'Fraunces', serif; font-size: 1.6rem; font-weight: 700; }
.ticket-detail { font-size: 0.9rem; color: var(--text2); margin: 4px 0; }
#ticket-qr     { display: flex; justify-content: center; margin: 20px 0; }

/* ═══════════════════════════════════════
   SCREEN: ADMIN
═══════════════════════════════════════ */
#screen-admin {
  flex-direction: row;
  min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  position: sticky;
  top: 0; height: 100vh;
}
.sidebar-logo { padding: 0 20px 24px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.sidebar-logo .logo-text { font-family: 'Fraunces', serif; font-size: 1.3rem; font-weight: 700; color: var(--accent); }
.sidebar-logo .logo-sub  { font-size: 0.72rem; color: var(--text3); }
.sidebar-footer { margin-top: auto; padding: 20px; border-top: 1px solid var(--border); }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px;
  font-size: 0.9rem; font-weight: 500;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}
.nav-item:hover  { background: var(--bg); color: var(--text); }
.nav-item.active { color: var(--accent); background: var(--accent-light); border-left-color: var(--accent); font-weight: 600; }
.nav-item svg    { width: 18px; flex-shrink: 0; }

/* Admin content */
.admin-content { flex: 1; overflow-y: auto; padding: 32px; background: var(--bg); }
.admin-panel        { display: none; }
.admin-panel.active { display: block; }
.admin-page-title {
  font-family: 'Fraunces', serif;
  font-size: 2rem; font-weight: 700;
  margin-bottom: 6px;
}
.admin-page-sub { color: var(--text2); margin-bottom: 28px; font-size: 0.95rem; }

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px; margin-bottom: 28px;
}
.stat-card  { background: white; border-radius: var(--radius); padding: 20px; border: 1px solid var(--border); }
.stat-value { font-family: 'Fraunces', serif; font-size: 2rem; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 0.82rem; color: var(--text3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; margin-top: 2px; }

/* Data table */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.data-table th {
  text-align: left; padding: 10px 14px;
  font-size: 0.75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text3);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.data-table td                   { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td     { border-bottom: none; }
.data-table tr:hover td          { background: var(--bg); }

/* Tabs */
.tabs {
  display: flex; gap: 4px;
  background: var(--bg); padding: 4px; border-radius: 12px;
  width: fit-content; margin-bottom: 0;
}
.tab {
  padding: 8px 18px; border-radius: 9px;
  font-size: 0.88rem; font-weight: 600;
  cursor: pointer; color: var(--text2);
  transition: all 0.2s;
  border: none; background: transparent; font-family: inherit;
}
.tab.active { background: white; color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,0.1); }

/* Menu builder */
.menu-category   { background: white; border-radius: var(--radius); border: 1px solid var(--border); margin-bottom: 16px; overflow: hidden; }
.menu-cat-header {
  padding: 14px 18px;
  background: var(--bg); border-bottom: 1px solid var(--border);
  font-weight: 700; font-size: 0.9rem;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text2);
  display: flex; justify-content: space-between; align-items: center;
}
.menu-items-list { padding: 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.menu-item-tag {
  display: flex; align-items: center; gap: 6px;
  background: var(--accent-light); color: var(--accent);
  padding: 6px 12px; border-radius: 50px;
  font-size: 0.85rem; font-weight: 600;
}
.menu-item-tag button { background: none; border: none; cursor: pointer; color: inherit; font-size: 1rem; line-height: 1; padding: 0; }
.add-item-row         { padding: 10px 12px; display: flex; gap: 8px; }
.add-item-input {
  flex: 1; padding: 8px 12px;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 0.88rem; font-family: inherit; outline: none;
  transition: border-color 0.2s;
}
.add-item-input:focus { border-color: var(--accent); }

/* Proof thumbnail */
.proof-thumb {
  width: 60px; height: 60px;
  object-fit: cover; border-radius: 8px;
  cursor: pointer; border: 1px solid var(--border);
}

/* ═══════════════════════════════════════
   MODAL
═══════════════════════════════════════ */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: white; border-radius: 20px; padding: 28px;
  width: 100%; max-width: 480px;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.9) translateY(20px); } }
.modal h3 { font-family: 'Fraunces', serif; font-size: 1.4rem; font-weight: 700; margin-bottom: 8px; }
.modal p  { color: var(--text2); font-size: 0.92rem; margin-bottom: 20px; }

/* ═══════════════════════════════════════
   CLOSED BANNER
═══════════════════════════════════════ */
.closed-banner {
  background: linear-gradient(135deg, #1b4332, #2d6a4f);
  color: white; padding: 32px 24px; text-align: center;
  border-radius: var(--radius); margin: 16px;
}
.closed-banner h2 { font-family: 'Fraunces', serif; font-size: 1.5rem; margin-bottom: 8px; }
.closed-banner p  { opacity: 0.8; font-size: 0.9rem; }

/* ═══════════════════════════════════════
   TOAST
═══════════════════════════════════════ */
#toast {
  position: fixed; bottom: 100px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1d1d1f; color: white;
  padding: 12px 20px; border-radius: 50px;
  font-size: 0.88rem; font-weight: 600;
  z-index: 9999; opacity: 0;
  transition: all 0.3s ease; white-space: nowrap;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ═══════════════════════════════════════
   FIREBASE LOADER SPINNER
═══════════════════════════════════════ */
@keyframes spin { to { transform: rotate(360deg); } }
#firebase-loader { display: none; }
#firebase-loader.visible { display: flex; }

/* ═══════════════════════════════════════
   ANIMATIONS
═══════════════════════════════════════ */
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.fade-up   { animation: fadeUp 0.4s ease forwards; }
.fade-up-1 { animation-delay: 0.05s; opacity: 0; }
.fade-up-2 { animation-delay: 0.1s;  opacity: 0; }
.fade-up-3 { animation-delay: 0.15s; opacity: 0; }
.fade-up-4 { animation-delay: 0.2s;  opacity: 0; }

/* ═══════════════════════════════════════
   RESPONSIVE ADMIN
═══════════════════════════════════════ */
@media (max-width: 768px) {
  #screen-admin      { flex-direction: column; }
  .admin-sidebar     { width: 100%; height: auto; position: relative; flex-direction: row; padding: 8px; overflow-x: auto; }
  .sidebar-logo      { display: none; }
  .sidebar-footer    { display: none; }
  .nav-item          { padding: 8px 12px; font-size: 0.8rem; border-left: none; border-bottom: 3px solid transparent; flex-direction: column; gap: 2px; }
  .nav-item.active   { border-bottom-color: var(--accent); border-left-color: transparent; }
  .admin-content     { padding: 16px; }
}

/* ═══════════════════════════════════════
   PRINT
═══════════════════════════════════════ */
@media print { .no-print { display: none !important; } }
