/* LSBS — La Salle Business Simulation */
/* Design: dark green & gold — school colours */

:root {
  --green-900: #0d2818;
  --green-800: #143520;
  --green-700: #1b4a2e;
  --green-600: #225f3a;
  --green-500: #2a7448;
  --green-400: #3a9461;
  --green-300: #5bb57f;
  --green-100: #d0f0de;
  --green-50:  #edf9f3;
  --gold-600:  #b08b1a;
  --gold-500:  #d4a820;
  --gold-400:  #efc030;
  --gold-300:  #f5d060;
  --gold-100:  #fdf3c8;
  --sidebar-w: 240px;
  --radius:    10px;
  --shadow:    0 2px 12px rgba(0,0,0,0.09);
  --text:      #1a2e22;
  --text-muted:#5a7060;
  --border:    #d8e8dc;
  --bg:        #f4f8f5;
  --card-bg:   #ffffff;
  --danger:    #c0392b;
  --warn:      #d68910;
  --info:      #1a6fa8;
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
}

/* ── Sidebar ─────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--green-900);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  top: 0; left: 0;
  overflow-y: auto;
  z-index: 100;
  transition: transform 0.25s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 18px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.brand-icon {
  width: 38px; height: 38px;
  background: var(--gold-400);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--green-900);
  flex-shrink: 0;
}
.brand-name { font-family: 'Space Grotesk', sans-serif; font-weight: 700; color: #fff; font-size: 16px; line-height: 1.2; }
.brand-sub  { font-size: 11px; color: rgba(255,255,255,0.45); }

.sidebar-nav { flex: 1; padding: 12px 10px; }
.nav-section-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: rgba(255,255,255,0.3); padding: 14px 8px 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: 7px;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
  margin-bottom: 1px;
}
.nav-item svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active { background: var(--gold-400); color: var(--green-900); font-weight: 600; }
.nav-item.active svg { stroke: var(--green-900); }

.sidebar-footer {
  padding: 14px 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; gap: 8px;
}
.user-chip { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.user-avatar { width: 32px; height: 32px; background: var(--green-500); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: #fff; flex-shrink: 0; }
.user-info { min-width: 0; }
.user-name { font-size: 13px; color: #fff; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: rgba(255,255,255,0.4); }
.btn-logout { display: flex; align-items: center; padding: 6px; border-radius: 6px; color: rgba(255,255,255,0.4); transition: color 0.15s; }
.btn-logout:hover { color: #f87171; }
.btn-logout svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; }

/* ── Main ────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.topbar {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: 17px; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-muted); }
.sidebar-toggle { display: none; background: none; border: none; cursor: pointer; padding: 6px; border-radius: 6px; }
.sidebar-toggle svg { width: 20px; height: 20px; fill: none; stroke: var(--text); stroke-width: 1.8; }

.page-body { padding: 28px 28px; flex: 1; }

/* ── Cards ───────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow);
}
.card-title { font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: 16px; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }

/* ── Stat cards ──────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
.stat-value { font-family: 'Space Grotesk', sans-serif; font-size: 24px; font-weight: 700; color: var(--green-700); line-height: 1.1; }
.stat-sub   { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-card.gold .stat-value  { color: var(--gold-600); }
.stat-card.green .stat-value { color: var(--green-500); }
.stat-card.red .stat-value   { color: var(--danger); }

/* ── Resource pills ──────────────────────────────── */
.res-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.res-pill { display: flex; align-items: center; gap: 8px; background: var(--green-50); border: 1px solid var(--green-100); border-radius: 8px; padding: 8px 14px; }
.res-icon { font-size: 18px; }
.res-name { font-size: 12px; color: var(--text-muted); }
.res-qty  { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 18px; color: var(--green-700); }

/* ── Tables ──────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; padding: 10px 14px; background: var(--bg); color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 500; border-bottom: 1px solid var(--border); }
td { padding: 11px 14px; border-bottom: 1px solid #f0f4f1; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--green-50); }

/* ── Forms ───────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--text); }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 7px;
  font-family: inherit; font-size: 14px; color: var(--text); background: #fff;
  outline: none; transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--green-400); box-shadow: 0 0 0 3px rgba(42,116,72,0.1); }
.input-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ── Buttons ─────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 18px; border-radius: 8px; border: none; cursor: pointer; font-family: 'DM Sans', sans-serif; font-size: 14px; font-weight: 500; transition: all 0.15s; text-decoration: none; }
.btn-primary   { background: var(--green-600); color: #fff; }
.btn-primary:hover { background: var(--green-500); }
.btn-gold      { background: var(--gold-400); color: var(--green-900); }
.btn-gold:hover{ background: var(--gold-300); }
.btn-outline   { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--green-400); color: var(--green-600); background: var(--green-50); }
.btn-danger    { background: #fee2e2; color: var(--danger); border: 1px solid #fca5a5; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm        { padding: 6px 12px; font-size: 13px; }
.btn svg       { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }

/* ── Badges ──────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.badge-green  { background: var(--green-100); color: var(--green-700); }
.badge-gold   { background: var(--gold-100); color: var(--gold-600); }
.badge-red    { background: #fee2e2; color: var(--danger); }
.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-gray   { background: #f3f4f6; color: #4b5563; }

/* ── Flash ───────────────────────────────────────── */
.flash { padding: 12px 18px; margin: 0 28px 16px; border-radius: var(--radius); display: flex; justify-content: space-between; align-items: center; font-size: 14px; }
.flash-info    { background: #dbeafe; color: #1e40af; }
.flash-success { background: var(--green-100); color: var(--green-700); }
.flash-error   { background: #fee2e2; color: var(--danger); }
.flash-warning { background: var(--gold-100); color: var(--gold-600); }
.flash button  { background: none; border: none; cursor: pointer; font-size: 18px; line-height: 1; opacity: 0.6; }
.flash button:hover { opacity: 1; }

/* ── Auth pages ──────────────────────────────────── */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--green-900); padding: 20px; }
.auth-card { background: var(--card-bg); border-radius: 16px; padding: 40px 36px; width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo .mark { width: 52px; height: 52px; background: var(--green-700); border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-family: 'Space Grotesk', sans-serif; font-weight: 800; font-size: 20px; color: var(--gold-400); margin-bottom: 12px; }
.auth-logo h1   { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 22px; }
.auth-logo p    { font-size: 13px; color: var(--text-muted); }
.auth-error { background: #fee2e2; color: var(--danger); padding: 10px 14px; border-radius: 7px; font-size: 13px; margin-bottom: 16px; }

/* ── Grid helpers ────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

/* ── Leaderboard ─────────────────────────────────── */
.lb-row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 8px; margin-bottom: 6px; background: var(--card-bg); border: 1px solid var(--border); }
.lb-rank { font-family: 'Space Grotesk', sans-serif; font-weight: 800; font-size: 20px; width: 32px; color: var(--text-muted); }
.lb-rank.top1 { color: #d4af37; }
.lb-rank.top2 { color: #9ca3af; }
.lb-rank.top3 { color: #b87333; }
.lb-name { flex: 1; font-weight: 500; }
.lb-cash { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 16px; color: var(--green-600); }

/* ── Progress bar ────────────────────────────────── */
.progress { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--green-400); border-radius: 3px; transition: width 0.5s; }

/* ── Round badge ─────────────────────────────────── */
.round-badge { background: var(--green-700); color: var(--gold-300); font-family: 'Space Grotesk', sans-serif; font-size: 13px; font-weight: 600; padding: 4px 12px; border-radius: 20px; }
.event-badge { font-size: 12px; padding: 3px 10px; border-radius: 20px; }
.event-positive { background: var(--green-100); color: var(--green-700); }
.event-negative { background: #fee2e2; color: var(--danger); }
.event-neutral  { background: #f3f4f6; color: #4b5563; }

/* ── Product card (production page) ─────────────── */
.product-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.product-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; background: var(--card-bg); transition: box-shadow 0.15s; }
.product-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.1); }
.product-name { font-weight: 600; font-size: 15px; margin-bottom: 8px; }
.product-recipe { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }
.product-recipe span { display: inline-block; background: var(--green-50); border-radius: 4px; padding: 1px 6px; margin: 1px; }

/* ── Alert ───────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: var(--radius); font-size: 14px; margin-bottom: 16px; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.alert-success { background: var(--green-100); color: var(--green-700); border: 1px solid var(--green-300); }
.alert-danger  { background: #fee2e2; color: var(--danger); border: 1px solid #fca5a5; }
.alert-warning { background: var(--gold-100); color: var(--gold-600); border: 1px solid var(--gold-300); }

/* ── Section header ──────────────────────────────── */
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.section-title  { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 20px; }

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .page-body { padding: 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
