/* ============================================================
   ART Research Management Platform — Design System
   Stitch: Warm Dark #1c1c18 | Navy #091830 | Gold #C9922A
   Typography: Playfair Display (headings) + Inter (body)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;800&family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --navy:         #091830;
  --navy-dark:    #050d1a;
  --navy-light:   #0d2650;
  --warm-dark:    #1c1c18;
  --gold:         #C9922A;
  --gold-light:   #d9a43a;
  --gold-dark:    #a57020;
  --bg:           #f4f2ee;
  --card:         #ffffff;
  --border:       #e6e2da;
  --text:         #1c1c18;
  --text-muted:   #6b6860;
  --success:      #2e7d32;
  --success-bg:   #e8f5e9;
  --warning:      #e65100;
  --warning-bg:   #fff3e0;
  --danger:       #c62828;
  --danger-bg:    #ffebee;
  --info:         #1565c0;
  --info-bg:      #e3f2fd;
  --sidebar-w:    240px;
  --header-h:     60px;
  --radius:       8px;
  --radius-card:  12px;
  --shadow:       0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:    0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:    0 10px 20px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.07);
  --font:         'Inter', system-ui, -apple-system, sans-serif;
  --heading-font: 'Playfair Display', Georgia, serif;
}

/* ── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font); background: var(--bg); color: var(--text);
       line-height: 1.5; min-height: 100vh; }
a { color: var(--navy); text-decoration: none; }
a:hover { color: var(--gold); }
img { max-width: 100%; }
button { cursor: pointer; font-family: var(--font); }
input, select, textarea { font-family: var(--font); }

/* ── Typography ─────────────────────────────────────────────── */
h1 { font-family: var(--heading-font); font-size: 1.75rem; font-weight: 700; color: var(--navy); }
h2 { font-family: var(--heading-font); font-size: 1.375rem; font-weight: 700; color: var(--navy); }
h3 { font-family: var(--heading-font); font-size: 1.125rem; font-weight: 700; color: var(--navy); }
h4 { font-size: 1rem; font-weight: 600; }
p  { color: var(--text-muted); line-height: 1.7; }

/* ── Layout ─────────────────────────────────────────────────── */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); background: var(--navy); color: #fff;
  position: fixed; top: 0; left: 0; height: 100vh;
  display: flex; flex-direction: column; z-index: 100;
  transition: transform .3s ease;
  border-right: 1px solid rgba(255,255,255,.06);
}
.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo .logo-name { font-family: var(--heading-font); font-size: 1.25rem; font-weight: 800; color: #fff; }
.sidebar-logo .logo-sub  { font-size: .6rem; color: var(--gold);
                             letter-spacing: 1.5px; text-transform: uppercase; margin-top: 3px; }
.sidebar-nav { flex: 1; padding: 16px 0; overflow-y: auto; }
.nav-section { padding: 8px 16px 4px;
                font-size: .6rem; text-transform: uppercase;
                letter-spacing: 1.5px; color: rgba(255,255,255,.35);
                font-weight: 700; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 20px; color: rgba(255,255,255,.7);
  font-size: .85rem; font-weight: 500; cursor: pointer;
  transition: all .15s; border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: rgba(201,146,42,.12); color: #fff;
                    border-left-color: var(--gold); }
.nav-item .nav-icon { width: 18px; text-align: center; font-size: .95rem; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.08); }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%;
                background: var(--gold); color: var(--navy);
                display: flex; align-items: center; justify-content: center;
                font-weight: 700; font-size: .8rem; flex-shrink: 0; }
.user-info .user-name  { font-size: .8rem; font-weight: 600; color: #fff; }
.user-info .user-role  { font-size: .65rem; color: rgba(255,255,255,.45); text-transform: capitalize; }

.main-content {
  margin-left: var(--sidebar-w); flex: 1;
  display: flex; flex-direction: column; min-height: 100vh;
}
.topbar {
  height: var(--header-h); background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 0 var(--border);
}
.topbar-title { font-size: 1rem; font-weight: 600; color: var(--navy); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.page-content { padding: 24px; flex: 1; }

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--card); border-radius: var(--radius-card);
  border: 1px solid var(--border); box-shadow: var(--shadow); padding: 20px;
}
.card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: .95rem; font-weight: 600; color: var(--navy); }

/* ── KPI Stats ──────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--card); border-radius: var(--radius-card);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  padding: 20px; display: flex; align-items: center; gap: 16px;
}
.stat-icon { width: 48px; height: 48px; border-radius: 10px;
              display: flex; align-items: center; justify-content: center;
              font-size: 1.4rem; flex-shrink: 0; }
.stat-icon.navy  { background: rgba(9,24,48,.08); color: var(--navy); }
.stat-icon.gold  { background: rgba(201,146,42,.12); color: var(--gold-dark); }
.stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-icon.red   { background: var(--danger-bg); color: var(--danger); }
.stat-icon.blue  { background: var(--info-bg); color: var(--info); }
.stat-value { font-size: 1.6rem; font-weight: 800; color: var(--navy); line-height: 1; }
.stat-label { font-size: .72rem; color: var(--text-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: .5px; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius); font-size: .85rem;
  font-weight: 600; border: none; transition: all .15s; white-space: nowrap;
}
.btn-primary   { background: var(--gold); color: var(--navy); font-weight: 700; }
.btn-primary:hover   { background: var(--gold-light); }
.btn-gold      { background: var(--gold); color: var(--navy); font-weight: 700; }
.btn-gold:hover      { background: var(--gold-light); }
.btn-navy      { background: var(--navy); color: #fff; }
.btn-navy:hover      { background: var(--navy-dark); }
.btn-outline   { background: transparent; color: var(--navy); border: 1.5px solid var(--navy); }
.btn-outline:hover   { background: var(--navy); color: #fff; }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover    { background: #b71c1c; }
.btn-ghost     { background: transparent; color: var(--text-muted); border: 1.5px solid var(--border); }
.btn-ghost:hover     { background: var(--bg); color: var(--navy); border-color: var(--navy); }
.btn-sm { padding: 5px 12px; font-size: .78rem; }
.btn-lg { padding: 12px 24px; font-size: .95rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: .8rem; font-weight: 600;
               color: var(--navy); margin-bottom: 5px; }
.form-label .req { color: var(--danger); margin-left: 2px; }
.form-control {
  width: 100%; padding: 9px 12px; border-radius: var(--radius);
  border: 1.5px solid var(--border); font-size: .875rem;
  color: var(--text); background: #fff; transition: border-color .15s;
  outline: none;
}
.form-control:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(9,24,48,.08); }
.form-control.error { border-color: var(--danger); }
.form-hint  { font-size: .75rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: .75rem; color: var(--danger); margin-top: 4px; display: none; }
.form-error.show { display: block; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── Badges / Status ────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; padding: 3px 10px;
  border-radius: 20px; font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
}
.badge-green   { background: var(--success-bg); color: var(--success); }
.badge-orange  { background: var(--warning-bg); color: var(--warning); }
.badge-red     { background: var(--danger-bg);  color: var(--danger); }
.badge-grey    { background: #f0ede8; color: #666; }
.badge-blue    { background: var(--info-bg); color: var(--info); }
.badge-navy    { background: rgba(9,24,48,.08); color: var(--navy); }
.badge-gold    { background: rgba(201,146,42,.12); color: var(--gold-dark); }

/* ── Tables ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
thead th { background: var(--bg); color: var(--navy); font-size: .7rem;
            font-weight: 700; text-transform: uppercase; letter-spacing: .8px;
            padding: 10px 12px; text-align: left;
            border-bottom: 2px solid var(--border); }
tbody td { padding: 12px 12px; border-bottom: 1px solid var(--border);
            vertical-align: middle; }
tbody tr:hover td { background: #faf8f4; }
tbody tr:last-child td { border-bottom: none; }

/* ── Alerts ─────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px; border-radius: var(--radius);
  font-size: .85rem; display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 16px;
}
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid #a5d6a7; }
.alert-error   { background: var(--danger-bg);  color: var(--danger);  border: 1px solid #ef9a9a; }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid #ffcc80; }
.alert-info    { background: var(--info-bg);    color: var(--info);    border: 1px solid #90caf9; }

/* ── Progress Bar ───────────────────────────────────────────── */
.progress-track { background: var(--border); border-radius: 99px; height: 8px; }
.progress-fill  { background: var(--navy); border-radius: 99px; height: 8px;
                   transition: width .4s ease; }
.progress-fill.gold { background: var(--gold); }
.progress-fill.green { background: var(--success); }

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(9,24,48,.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 16px; opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--card); border-radius: var(--radius-card); width: 100%;
  max-width: 540px; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg); transform: translateY(16px);
  transition: transform .2s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header { display: flex; justify-content: space-between; align-items: center;
                 padding: 20px 24px; border-bottom: 1px solid var(--border); }
.modal-title  { font-family: var(--heading-font); font-size: 1rem; font-weight: 700; color: var(--navy); }
.modal-close  { background: none; border: none; font-size: 1.2rem;
                 color: var(--text-muted); cursor: pointer; padding: 4px; }
.modal-body   { padding: 20px 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border);
                 display: flex; gap: 10px; justify-content: flex-end; }

/* ── Tabs ───────────────────────────────────────────────────── */
.tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 20px; gap: 0; }
.tab-btn {
  padding: 10px 20px; font-size: .85rem; font-weight: 600;
  color: var(--text-muted); background: none; border: none;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  cursor: pointer; transition: all .15s;
}
.tab-btn:hover  { color: var(--navy); }
.tab-btn.active { color: var(--navy); border-bottom-color: var(--gold); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Loading Spinner ────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid var(--border);
  border-top-color: var(--gold); animation: spin .7s linear infinite;
  flex-shrink: 0;
}
.spinner.sm { width: 14px; height: 14px; }
.spinner.lg { width: 36px; height: 36px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-state { display: flex; align-items: center; justify-content: center;
                  gap: 12px; padding: 40px; color: var(--text-muted); }

/* ── Empty State ────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-icon  { font-size: 3rem; margin-bottom: 12px; opacity: .4; }
.empty-title { font-size: 1rem; font-weight: 600; color: var(--navy); margin-bottom: 6px; }
.empty-text  { font-size: .85rem; color: var(--text-muted); margin-bottom: 20px; }

/* ── Auth Pages ─────────────────────────────────────────────── */
.auth-page { min-height: 100vh; display: flex; align-items: center;
              justify-content: center;
              background: linear-gradient(145deg, var(--warm-dark) 0%, var(--navy) 55%, var(--navy-light) 100%);
              padding: 24px; flex-direction: column; }
.auth-card { background: var(--card); border-radius: var(--radius-card);
              border: 1px solid rgba(255,255,255,.08); box-shadow: 0 24px 48px rgba(0,0,0,.35);
              width: 100%; max-width: 440px; padding: 36px 40px; }
.auth-logo   { text-align: center; margin-bottom: 28px; }
.auth-logo .logo-big { font-family: var(--heading-font); font-size: 2.2rem; font-weight: 800; color: var(--navy); }
.auth-logo .logo-tagline { font-size: .68rem; color: var(--gold); font-weight: 600;
                             letter-spacing: 1.5px; text-transform: uppercase; margin-top: 4px; }
.auth-title  { font-family: var(--heading-font); font-size: 1.3rem; font-weight: 700; color: var(--navy);
                text-align: center; margin-bottom: 4px; }
.auth-sub    { font-size: .82rem; color: var(--text-muted);
                text-align: center; margin-bottom: 24px; }

/* ── Notification Bell ──────────────────────────────────────── */
.notif-btn { position: relative; background: none; border: none;
              font-size: 1.1rem; color: var(--text-muted); padding: 6px; }
.notif-badge { position: absolute; top: 0; right: 0; width: 16px; height: 16px;
                background: var(--danger); color: #fff; border-radius: 50%;
                font-size: .6rem; font-weight: 700; display: flex;
                align-items: center; justify-content: center; }

/* ── Chat (AI Assistant) ────────────────────────────────────── */
.chat-wrap   { display: flex; flex-direction: column; height: 520px; }
.chat-msgs   { flex: 1; overflow-y: auto; padding: 16px; display: flex;
                flex-direction: column; gap: 12px; }
.chat-bubble { max-width: 80%; padding: 10px 14px; border-radius: var(--radius-card);
                font-size: .875rem; line-height: 1.6; }
.chat-bubble.user { background: var(--navy); color: #fff;
                     align-self: flex-end; border-bottom-right-radius: 4px; }
.chat-bubble.ai   { background: var(--bg); border: 1px solid var(--border);
                     align-self: flex-start; border-bottom-left-radius: 4px; }
.chat-input-row { display: flex; gap: 8px; padding: 12px 16px;
                   border-top: 1px solid var(--border); }
.chat-input-row input { flex: 1; }

/* ── Package Cards ──────────────────────────────────────────── */
.packages-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.package-card {
  background: var(--card); border-radius: var(--radius-card); border: 2px solid var(--border);
  padding: 24px; cursor: pointer; transition: all .2s;
  display: flex; flex-direction: column;
}
.package-card:hover { border-color: var(--navy); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.package-card.selected { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,146,42,.18); }
.package-name  { font-family: var(--heading-font); font-size: 1rem; font-weight: 700; color: var(--navy); margin-bottom: 4px; }
.package-price { font-size: .8rem; color: var(--gold-dark); font-weight: 700; margin-bottom: 12px; }
.package-desc  { font-size: .82rem; color: var(--text-muted); margin-bottom: 16px; flex: 1; }
.package-features { list-style: none; }
.package-features li { font-size: .78rem; color: var(--text-muted); padding: 3px 0;
                         display: flex; align-items: flex-start; gap: 6px; }
.package-features li::before { content: "✓"; color: var(--gold); font-weight: 700; flex-shrink: 0; }

/* ── Project Status Colors ──────────────────────────────────── */
.status-intake              { background: #f0ede8; color: #555; }
.status-team_assignment     { background: var(--info-bg); color: var(--info); }
.status-in_progress         { background: var(--warning-bg); color: var(--warning); }
.status-pending_qc          { background: #fff8e1; color: #f57f17; }
.status-qc_failed           { background: var(--danger-bg); color: var(--danger); }
.status-pending_defense     { background: #f3e5f5; color: #6a1b9a; }
.status-defense_passed      { background: var(--success-bg); color: var(--success); }
.status-pending_client_review { background: var(--info-bg); color: var(--info); }
.status-client_revision     { background: var(--warning-bg); color: var(--warning); }
.status-completed           { background: var(--success-bg); color: var(--success); }
.status-cancelled           { background: #f0ede8; color: #999; }

/* ── Welcome Modal (first-login) ────────────────────────────── */
.welcome-modal .modal { max-width: 500px; }
.welcome-steps { display: flex; flex-direction: column; gap: 16px; margin: 4px 0 20px; }
.welcome-step {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 16px; border-radius: var(--radius);
  background: var(--bg); border: 1px solid var(--border);
}
.welcome-step-num {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  background: var(--gold); color: var(--navy);
  display: flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 800;
}
.welcome-step-body .step-title { font-weight: 600; font-size: .875rem; color: var(--navy); margin-bottom: 2px; }
.welcome-step-body .step-desc  { font-size: .8rem; color: var(--text-muted); line-height: 1.5; }
.welcome-modal-hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 24px; text-align: center; margin: -20px -24px 20px;
}
.welcome-modal-hero h2 { color: #fff; font-size: 1.25rem; margin-bottom: 6px; }
.welcome-modal-hero p  { color: rgba(255,255,255,.7); font-size: .85rem; margin: 0; }

/* ── Responsive ─────────────────────────────────────────────── */
.hamburger { display: none; background: none; border: none;
              font-size: 1.3rem; color: var(--navy); cursor: pointer; }
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .hamburger { display: block; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-content { padding: 16px; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 24px 20px; }
  .packages-grid { grid-template-columns: 1fr; }
}

/* ── Utilities ──────────────────────────────────────────────── */
.flex { display: flex; } .flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.text-center { text-align: center; }
.text-sm { font-size: .8rem; } .text-xs { font-size: .72rem; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
@media (max-width: 768px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
