/* ============================================================
   Portal — Restaurant subscriber dashboard (Mise Reserve)
   Dark/gold luxury aesthetic, mobile-responsive
   ============================================================ */

/* ---- Google Fonts (same as landing) ---- */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&family=DM+Sans:ital,wght@0,300;0,400;0,500;1,300&display=swap');

/* ---- Variables ---- */
:root {
  --gold:       #c8933f;
  --gold-light: #e8b96a;
  --gold-dim:   #9a6e2e;
  --dark:       #0e1a0f;
  --dark-2:     #162016;
  --dark-3:     #1e2e1c;
  --green:      #2d5743;
  --green-lt:   #3a7058;
  --cream:      #f5f0e8;
  --muted:      #8a9e89;
  --border:     rgba(200,147,63,0.18);
  --card-bg:    #121c12;
  --card-border: rgba(200,147,63,0.12);
  --shadow:     0 4px 24px rgba(0,0,0,0.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--dark);
  color: var(--cream);
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---- Typography ---- */
h1, h2, h3, h4 {
  font-family: 'Playfair Display', serif;
  font-weight: 600;
  color: var(--cream);
}
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }

.gold { color: var(--gold); }
.muted { color: var(--muted); font-size: 0.85rem; }

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-light); }

/* ---- Layout ---- */
.portal-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.portal-sidebar {
  width: 240px;
  background: var(--dark-2);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 28px 24px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo .brand {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.03em;
}
.sidebar-logo .sub {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
}

.sidebar-tier {
  padding: 12px 24px;
  background: linear-gradient(135deg, rgba(200,147,63,0.08), rgba(200,147,63,0.03));
  border-bottom: 1px solid var(--border);
}
.tier-badge {
  display: inline-block;
  padding: 3px 10px;
  border: 1px solid var(--gold);
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--gold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  color: var(--muted);
  font-size: 0.88rem;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}
.nav-item:hover, .nav-item.active {
  color: var(--gold);
  background: rgba(200,147,63,0.05);
  border-left-color: var(--gold);
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border);
}
.sidebar-footer .restaurant-name {
  font-size: 0.8rem;
  color: var(--cream);
  font-weight: 500;
}
.sidebar-footer .logout-btn {
  display: block;
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--muted);
  cursor: pointer;
}
.sidebar-footer .logout-btn:hover { color: var(--gold); }

/* Main content */
.portal-main {
  flex: 1;
  overflow-x: hidden;
}

/* ---- Portal Header ---- */
.portal-header {
  padding: 24px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--dark-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.portal-header h1 { font-size: 1.4rem; }
.portal-header .header-meta { color: var(--muted); font-size: 0.85rem; }

/* ---- Cards ---- */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.card-title {
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  color: var(--gold);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title svg { width: 18px; height: 18px; }

/* ---- Stat blocks ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-block {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
}
.stat-value {
  font-family: 'Playfair Display', serif;
  font-size: 2.4rem;
  font-weight: 600;
  color: var(--gold);
  line-height: 1;
}
.stat-label {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ---- Growth stages ---- */
.stages-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.stage-step {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: var(--dark-3);
  overflow: hidden;
}
.stage-step.filled { background: var(--gold); }
.stage-label { font-size: 0.75rem; color: var(--muted); text-align: center; }

.stage-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.stage-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--dark-3);
  border-radius: 8px;
  border: 1px solid var(--card-border);
}
.stage-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.stage-icon.planted     { background: rgba(45,87,67,0.4); color: #6bc98a; }
.stage-icon.germinating { background: rgba(107,156,105,0.4); color: #9ed4a8; }
.stage-icon.growing     { background: rgba(200,147,63,0.3); color: var(--gold-light); }
.stage-icon.ready       { background: rgba(200,147,63,0.5); color: var(--gold); }
.stage-info { flex: 1; }
.stage-name { font-weight: 500; font-size: 0.92rem; }
.stage-count { font-size: 0.78rem; color: var(--muted); }
.stage-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--gold);
  color: var(--dark);
  font-weight: 600;
}

/* ---- Tray grid ---- */
.tray-zone-section { margin-bottom: 32px; }
.zone-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  color: var(--gold);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.tray-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
}
.tray-cell {
  aspect-ratio: 1;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  cursor: pointer;
  transition: transform 0.15s;
  border: 1px solid var(--card-border);
  text-align: center;
  padding: 4px;
}
.tray-cell:hover { transform: scale(1.05); }
.tray-cell.idle    { background: var(--dark-3); color: var(--muted); }
.tray-cell.planted  { background: rgba(45,87,67,0.25); color: #6bc98a; border-color: rgba(45,87,67,0.4); }
.tray-cell.germinating { background: rgba(107,156,105,0.25); color: #9ed4a8; border-color: rgba(107,156,105,0.4); }
.tray-cell.growing  { background: rgba(200,147,63,0.2); color: var(--gold-light); border-color: rgba(200,147,63,0.4); }
.tray-cell.ready    { background: rgba(200,147,63,0.35); color: var(--gold); border-color: var(--gold); box-shadow: 0 0 12px rgba(200,147,63,0.2); }
.tray-cell .tray-num { font-weight: 600; }
.tray-cell .tray-status { font-size: 0.6rem; margin-top: 2px; opacity: 0.8; }

/* ---- Delivery timeline ---- */
.delivery-list { display: flex; flex-direction: column; gap: 12px; }
.delivery-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--dark-3);
  border-radius: 10px;
  border: 1px solid var(--card-border);
}
.delivery-date {
  text-align: center;
  min-width: 56px;
}
.delivery-date .d-day {
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem;
  color: var(--gold);
  line-height: 1;
}
.delivery-date .d-month {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.delivery-info { flex: 1; }
.delivery-product { font-weight: 500; }
.delivery-meta { font-size: 0.78rem; color: var(--muted); }
.delivery-status {
  font-size: 0.72rem;
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.status-scheduled { background: rgba(45,87,67,0.3); color: #6bc98a; }
.status-growing    { background: rgba(200,147,63,0.3); color: var(--gold-light); }
.status-ready      { background: rgba(200,147,63,0.5); color: var(--gold); }
.status-delivered  { background: rgba(138,158,137,0.2); color: var(--muted); }

/* ---- Emergency button ---- */
.emergency-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: linear-gradient(135deg, #8b2020, #a03030);
  color: var(--cream);
  border: none;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.emergency-btn:hover {
  background: linear-gradient(135deg, #a03030, #b03a3a);
  transform: translateY(-1px);
}

/* ---- Exclusive varieties ---- */
.varieties-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.variety-card {
  background: var(--dark-3);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 16px;
}
.variety-card.all-variants {
  border-color: rgba(200,147,63,0.3);
  background: linear-gradient(135deg, var(--dark-3), rgba(200,147,63,0.05));
}
.variety-name { font-weight: 500; margin-bottom: 4px; }
.variety-cat { font-size: 0.78rem; color: var(--muted); text-transform: capitalize; }
.variety-days { font-size: 0.75rem; color: var(--gold-dim); margin-top: 4px; }

/* ---- Page padding ---- */
.page { padding: 28px 32px; }
.section + .section { margin-top: 28px; }
.section-header {
  margin-bottom: 20px;
}
.section-header h2 {
  font-size: 1.3rem;
  margin-bottom: 4px;
}
.section-header p { color: var(--muted); font-size: 0.85rem; }

/* ---- Forms (login, emergency) ---- */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--dark);
  background-image: radial-gradient(ellipse at 30% 40%, rgba(200,147,63,0.05) 0%, transparent 60%),
                    radial-gradient(ellipse at 70% 70%, rgba(45,87,67,0.06) 0%, transparent 60%);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 40px;
  box-shadow: 0 8px 48px rgba(0,0,0,0.5);
}
.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}
.auth-logo .brand {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  color: var(--gold);
}
.auth-logo .tagline {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 4px;
}
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--dark-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--cream);
  font-size: 0.92rem;
  font-family: 'DM Sans', sans-serif;
  transition: border-color 0.2s;
}
.form-control:focus {
  outline: none;
  border-color: var(--gold);
}
.form-error {
  background: rgba(139,32,32,0.3);
  border: 1px solid rgba(139,32,32,0.5);
  border-radius: 8px;
  padding: 10px 14px;
  color: #e88080;
  font-size: 0.85rem;
  margin-bottom: 16px;
  display: none;
}
.form-error.visible { display: block; }

.btn-primary {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dim));
  color: var(--dark);
  border: none;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.2s;
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  transform: translateY(-1px);
}
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.auth-note {
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 20px;
}

/* ---- Next delivery highlight ---- */
.next-delivery-banner {
  background: linear-gradient(135deg, rgba(200,147,63,0.1), rgba(200,147,63,0.04));
  border: 1px solid rgba(200,147,63,0.25);
  border-radius: 12px;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}
.next-delivery-banner .nd-date {
  text-align: center;
  min-width: 60px;
}
.next-delivery-banner .nd-day {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  color: var(--gold);
  line-height: 1;
}
.next-delivery-banner .nd-month {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
}
.next-delivery-banner .nd-info { flex: 1; }
.next-delivery-banner .nd-product {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 600;
}
.next-delivery-banner .nd-meta { font-size: 0.82rem; color: var(--muted); margin-top: 2px; }
.next-delivery-banner .nd-badge {
  font-size: 0.72rem;
  padding: 4px 12px;
  border: 1px solid var(--gold);
  border-radius: 20px;
  color: var(--gold);
  font-weight: 500;
}

/* ---- Success message ---- */
.success-banner {
  background: linear-gradient(135deg, rgba(45,87,67,0.15), rgba(45,87,67,0.08));
  border: 1px solid rgba(45,87,67,0.4);
  border-radius: 10px;
  padding: 16px 20px;
  color: #6bc98a;
  font-size: 0.9rem;
  margin-bottom: 20px;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .portal-shell { flex-direction: column; }
  .portal-sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    overflow-x: auto;
  }
  .sidebar-logo { padding: 14px 20px; border-bottom: none; border-right: 1px solid var(--border); flex-shrink: 0; }
  .sidebar-tier { display: none; }
  .sidebar-nav { display: flex; flex-direction: row; padding: 0; }
  .nav-item { padding: 14px 16px; border-left: none; border-bottom: 3px solid transparent; }
  .nav-item.active { border-bottom-color: var(--gold); border-left: none; }
  .sidebar-footer { display: none; }
  .page { padding: 20px 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---- Loading spinner ---- */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(200,147,63,0.3);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}