/* ============================================================
   FONTS
   ============================================================ */
@font-face {
  font-family: 'AeroviasBrasil';
  src: url('../fonts/AeroviasBrasilNF.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-page); color: var(--text-body); min-height: 100vh;
  transition: background .2s, color .2s; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }
ul { list-style: none; }

/* ============================================================
   DESIGN TOKENS — DARK (default)
   ============================================================ */
:root[data-theme="dark"], :root {
  --navy:      #0f1929;
  --navy-mid:  #162035;
  --navy-lt:   #1e2e4f;
  --gold:      #c9a227;
  --gold-lt:   #e8c547;
  --gold-pale: #2a2210;
  --white:     #e8edf5;
  --gray-50:   #151e2e;
  --gray-100:  #1c2740;
  --gray-200:  #7a8ba8;
  --gray-400:  #8d9ab5;
  --gray-600:  #a8b5cc;
  --gray-800:  #c8d0e0;
  --green:     #2ecc78;
  --green-lt:  #0d2d1e;
  --red:       #e05560;
  --red-lt:    #2d1015;
  --orange:    #e07b39;
  --orange-lt: #2d1e0d;
  --blue:      #4a90e8;
  --blue-lt:   #0d1e38;
  --radius:    8px;
  --radius-lg: 14px;
  --shadow:    0 2px 8px rgba(0,0,0,.35);
  --shadow-lg: 0 6px 24px rgba(0,0,0,.5);
  --bg-page:   #0d1524;
  --bg-card:   #131d30;
  --bg-input:  #0f1929;
  --bg-table-head: #0f1929;
  --bg-row-hover:  #1a2540;
  --border:    #243050;
  --text-body: #cdd5e8;
  --text-muted-val: #6b7a96;
}

/* ============================================================
   DESIGN TOKENS — LIGHT
   ============================================================ */
:root[data-theme="light"] {
  --navy:      #1a2744;
  --navy-mid:  #243358;
  --navy-lt:   #2e4070;
  --gold:      #c9a227;
  --gold-lt:   #e8c547;
  --gold-pale: #fdf6e3;
  --white:     #ffffff;
  --gray-50:   #f4f6fb;
  --gray-100:  #e8ecf3;
  --gray-200:  #cdd3df;
  --gray-400:  #8d97ae;
  --gray-600:  #5a6478;
  --gray-800:  #2e3545;
  --green:     #2a9d5c;
  --green-lt:  #e6f7ee;
  --red:       #d64045;
  --red-lt:    #fdeaea;
  --orange:    #e07b39;
  --orange-lt: #fef0e6;
  --blue:      #2a6fc9;
  --blue-lt:   #e8f0fb;
  --radius:    8px;
  --radius-lg: 14px;
  --shadow:    0 2px 8px rgba(26,39,68,.10);
  --shadow-lg: 0 6px 24px rgba(26,39,68,.14);
  --bg-page:   #f4f6fb;
  --bg-card:   #ffffff;
  --bg-input:  #ffffff;
  --bg-table-head: #f4f6fb;
  --bg-row-hover:  #f4f6fb;
  --border:    #cdd3df;
  --text-body: #1a2744;
  --text-muted-val: #8d97ae;
}

/* ============================================================
   LAYOUT
   ============================================================ */
#app { display: flex; flex-direction: column; min-height: 100vh; }

.app-status-banner {
  padding: .7rem 1rem;
  text-align: center;
  font-size: .84rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}
.app-status-banner-offline {
  background: var(--orange-lt);
  color: var(--orange);
}

.topbar {
  background: var(--navy);
  color: var(--white);
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.topbar-brand { font-size: 2.2rem; font-weight: 700; letter-spacing: .5px; font-family: 'AeroviasBrasil', sans-serif;
  display: flex; align-items: center; gap: .5rem; min-width: 0; flex: 1; overflow: hidden; }
.topbar-brand span.gold { color: var(--gold); flex-shrink: 0; }
.topbar-right { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; }
.topbar-user { font-size: .85rem; color: var(--gray-200); }
.topbar-project { font-size: .78rem; background: var(--navy-lt); color: var(--gold-lt);
  padding: 2px 10px; border-radius: 99px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 600;
  letter-spacing: normal;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }

/* Hamburger menu */
.hamburger-btn { background: none; border: none; color: var(--white); cursor: pointer;
  font-size: 1.4rem; padding: .2rem .4rem; line-height: 1; flex-shrink: 0; }
.hamburger-btn i { display: block; }
.topbar-menu {
  position: absolute; top: 56px; right: 0;
  background: var(--navy-mid); border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 220px; z-index: 200;
  padding: .5rem 0;
}
.topbar-menu-item {
  display: flex; align-items: center; gap: .6rem;
  padding: .6rem 1.1rem; font-size: .9rem;
  color: var(--white); cursor: pointer; background: none; border: none;
  width: 100%; text-align: left;
  transition: background .12s;
}
.topbar-menu-item:hover { background: var(--navy-lt); }
.topbar-menu-item-label { display: inline-flex; align-items: center; gap: .6rem; }
.topbar-menu-icon { width: 1rem; text-align: center; flex-shrink: 0; }
.topbar-menu-divider { border: none; border-top: 1px solid var(--border); margin: .35rem 0; }
.topbar-menu-label { padding: .3rem 1.1rem; font-size: .72rem; color: var(--gray-400);
  text-transform: uppercase; letter-spacing: .5px; }
.toggle-track {
  display: inline-flex; align-items: center;
  width: 36px; height: 20px; border-radius: 10px;
  background: var(--gray-600); flex-shrink: 0;
  transition: background .2s; position: relative;
}
.toggle-track.on { background: var(--gold); }
.toggle-thumb {
  position: absolute; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff;
  transition: left .2s;
}
.toggle-track.on .toggle-thumb { left: 18px; }

@media (max-width: 700px) {
  .topbar-user { display: none; }
  .role-switcher-desktop { display: none; }
}

.nav-tabs {
  background: var(--navy-mid);
  display: flex;
  padding: 0 1.5rem;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-tabs::-webkit-scrollbar { display: none; }
.nav-tab {
  padding: .75rem 1.1rem;
  font-size: .88rem;
  color: var(--gray-200);
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.nav-tab:hover { color: var(--white); }
.nav-tab.active { color: var(--gold-lt); border-bottom-color: var(--gold); }

.main-content {
  flex: 1;
  padding: 1.5rem;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

/* ============================================================
   CARDS & PANELS
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}
.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-body);
  margin-bottom: 1rem;
}
.card-sm { padding: 1rem; }

.hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-lt) 100%);
  color: var(--white);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1.5rem;
}
.hero h1 { font-size: 1.6rem; font-weight: 800; margin-bottom: .4rem; }
.hero p { color: var(--gray-200); font-size: .95rem; }

/* ============================================================
   STATS ROW
   ============================================================ */
.stats-row { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.25rem;
  flex: 1; min-width: 130px;
  display: flex; flex-direction: column; gap: .25rem;
}
.stat-val { font-size: 1.8rem; font-weight: 800; color: var(--text-body); }
.stat-lbl { font-size: .78rem; color: var(--gray-400); text-transform: uppercase; letter-spacing: .5px; }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; padding: .6rem .9rem; background: var(--bg-table-head);
  color: var(--gray-600); font-weight: 600; font-size: .78rem; text-transform: uppercase;
  letter-spacing: .4px; border-bottom: 2px solid var(--border); }
td { padding: .7rem .9rem; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text-body); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-row-hover); }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .3px;
}
.badge-draft     { background: var(--gray-100); color: var(--gray-600); }
.badge-open      { background: var(--green-lt); color: var(--green); }
.badge-submitted { background: var(--blue-lt);  color: var(--blue); }
.badge-approved  { background: var(--blue-lt);  color: var(--blue); }
.badge-released  { background: var(--orange-lt);color: var(--orange); }
.badge-complete  { background: var(--green-lt); color: var(--green); }
.badge-pending_submit { background: var(--orange-lt); color: var(--orange); border: 1px solid var(--orange); }
.badge-winner    { background: var(--gold-pale); color: var(--gold); }
.badge-published { background: var(--green-lt);  color: var(--green); }
.badge-judging   { background: var(--orange-lt); color: var(--orange); }
.badge-closed    { background: var(--gray-100);  color: var(--gray-600); }
.badge-setup     { background: var(--blue-lt);   color: var(--blue); }
.badge-gold      { background: var(--gold-pale); color: var(--gold);   border: 1px solid var(--gold); }
.badge-silver    { background: var(--gray-100);  color: var(--gray-600); border: 1px solid var(--gray-400); }
.badge-bronze    { background: var(--orange-lt); color: var(--orange); border: 1px solid var(--orange); }
.badge-admin     { background: var(--navy); color: var(--white); }
.badge-staff     { background: var(--navy-mid); color: var(--white); }
.badge-judge     { background: var(--blue-lt); color: var(--blue); }
.badge-applicant { background: var(--gray-100); color: var(--gray-600); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1.1rem;
  border-radius: var(--radius);
  border: none;
  font-size: .88rem; font-weight: 600;
  transition: opacity .15s, transform .1s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--navy-lt); color: var(--white); }
.btn-primary:hover { background: var(--navy-mid); }
.btn-gold { background: var(--gold); color: #1a1a00; }
.btn-gold:hover { background: var(--gold-lt); }
.btn-outline { background: transparent; color: var(--text-body); border: 1.5px solid var(--border); }
.btn-outline:hover { background: var(--bg-row-hover); }
.btn-danger { background: var(--red); color: var(--white); }
.btn-danger:hover { opacity: .85; }
.btn-ghost { background: transparent; color: var(--gray-600); border: 1.5px solid var(--border); }
.btn-ghost:hover { background: var(--bg-row-hover); color: var(--text-body); }
.btn-sm { padding: .3rem .75rem; font-size: .8rem; }
.btn-lg { padding: .75rem 1.75rem; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 1.1rem; }
.form-label { display: block; font-size: .85rem; font-weight: 600; color: var(--gray-600);
  margin-bottom: .35rem; }
.form-label .req { color: var(--red); margin-left: 2px; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: .5rem .75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: .9rem;
  color: var(--text-body);
  background: var(--bg-input);
  transition: border-color .15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--gold); }
.form-textarea { min-height: 90px; resize: vertical; }
.form-help { font-size: .78rem; color: var(--gray-400); margin-top: .25rem; }
.form-error { font-size: .78rem; color: var(--red); margin-top: .25rem; }
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 180px; }
.form-check { display: flex; align-items: center; gap: .5rem; font-size: .88rem; }
.form-check input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--navy); }
.range-row { display: flex; align-items: center; gap: .75rem; }
.range-row input[type=range] { flex: 1; accent-color: var(--gold); }
.range-val { min-width: 28px; text-align: center; font-weight: 700; color: var(--text-body); }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 999; padding: 1rem;
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
  padding: 1.75rem;
}
.modal-scroll-panel {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  max-height: var(--modal-scroll-max-h, 160px);
  overflow-y: auto;
  padding: .5rem;
  background: var(--gray-50);
  border-radius: var(--radius);
}
.modal,
.modal-scroll-panel {
  scrollbar-width: thin;
  scrollbar-color: var(--navy-lt) transparent;
}
.modal::-webkit-scrollbar,
.modal-scroll-panel::-webkit-scrollbar {
  width: 12px;
}
.modal::-webkit-scrollbar-track,
.modal-scroll-panel::-webkit-scrollbar-track {
  background: transparent;
}
.modal::-webkit-scrollbar-thumb,
.modal-scroll-panel::-webkit-scrollbar-thumb {
  background: var(--navy-lt);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}
.modal::-webkit-scrollbar-thumb:hover,
.modal-scroll-panel::-webkit-scrollbar-thumb:hover {
  background: var(--gold);
  background-clip: content-box;
}
.modal-title { font-size: 1.15rem; font-weight: 700; color: var(--text-body); margin-bottom: 1.25rem; }
.modal-actions { display: flex; gap: .75rem; justify-content: flex-end; margin-top: 1.25rem; }

/* ============================================================
   ALERTS & BANNERS
   ============================================================ */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  font-size: .88rem;
  margin-bottom: 1rem;
  display: flex; align-items: flex-start; gap: .5rem;
}
.alert-info    { background: var(--blue-lt);   color: var(--blue); }
.alert-success { background: var(--green-lt);  color: var(--green); }
.alert-warn    { background: var(--orange-lt); color: var(--orange); }
.alert-error   { background: var(--red-lt);    color: var(--red); }

.offline-banner {
  background: var(--orange);
  color: var(--white);
  text-align: center;
  padding: .4rem 1rem;
  font-size: .85rem;
  font-weight: 600;
}

/* ============================================================
   MISC UTILITY
   ============================================================ */
.flex       { display: flex; }
.flex-col   { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm     { gap: .5rem; }
.gap-md     { gap: 1rem; }
.mt-sm      { margin-top: .5rem; }
.mt-md      { margin-top: 1rem; }
.mt-lg      { margin-top: 1.5rem; }
.mb-sm      { margin-bottom: .5rem; }
.mb-md      { margin-bottom: 1rem; }
.mb-lg      { margin-bottom: 1.5rem; }
.text-sm    { font-size: .83rem; }
.text-xs    { font-size: .75rem; }
.text-muted { color: var(--gray-400); }
.text-gold  { color: var(--gold); }
.text-red   { color: var(--red); }
.text-green { color: var(--green); }
.fw-bold    { font-weight: 700; }
.hidden     { display: none !important; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
.pill-list { display: flex; flex-wrap: wrap; gap: .4rem; }

/* ============================================================
   LANDING PAGE
   ============================================================ */
.landing-wrap {
  min-height: 100vh;
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-lt) 60%, #2e5090 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 2rem 1rem;
}
.landing-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
  width: 100%; max-width: 440px;
}
.landing-logo { text-align: center; margin-bottom: 1.75rem; }
.landing-logo h1 { font-size: 4rem; font-weight: 900; color: var(--text-body); font-family: 'AeroviasBrasil', sans-serif; }
.landing-logo h1 span { color: var(--gold); }
.landing-logo p { color: var(--gray-400); font-size: .9rem; margin-top: .25rem; }
.magic-link-box {
  background: var(--gold-pale);
  border: 1.5px solid var(--gold);
  border-radius: var(--radius);
  padding: 1rem;
  margin-top: 1rem;
  font-size: .85rem;
}
.magic-link-box a { color: var(--blue); font-weight: 600; word-break: break-all; }
.project-list-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: .5rem;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.project-list-item:hover { border-color: var(--gold); background: var(--bg-row-hover); }

/* ============================================================
   APPLICATION FORM
   ============================================================ */
.app-form-header {
  background: var(--gold-pale);
  border: 1.5px solid var(--gold);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  margin-bottom: 1.25rem;
  font-size: .85rem;
}
.app-criteria-panel {
  background: var(--bg-table-head);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1.25rem;
}
.app-criteria-title { font-weight: 700; font-size: .95rem; margin-bottom: .2rem; }
.app-criteria-subtitle { font-size: .8rem; color: var(--gray-500); margin-bottom: .85rem; }
.app-criteria-list { display: flex; flex-direction: column; gap: .65rem; }
.app-criteria-item {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem .85rem;
}
.app-criteria-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  font-weight: 600;
  font-size: .88rem;
}
.app-criteria-help { font-size: .8rem; color: var(--gray-500); margin-top: .35rem; }
.attachment-list { display: flex; flex-direction: column; gap: .5rem; margin-top: .5rem; }
.attachment-item {
  display: flex; align-items: center; gap: .5rem;
  background: var(--bg-table-head); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .5rem .75rem;
  font-size: .83rem; color: var(--text-body);
}
.attachment-item .remove-att { margin-left: auto; cursor: pointer; color: var(--red); font-size: 1rem; }

/* ============================================================
   JUDGING SCORECARD
   ============================================================ */
.score-item {
  background: var(--bg-table-head);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: .75rem;
}
.score-item-label { font-weight: 600; font-size: .9rem; margin-bottom: .5rem; }
.score-item-help { font-size: .78rem; color: var(--gray-400); margin-bottom: .5rem; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 700px) {
  .main-content { padding: 1rem .75rem; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stats-row { flex-direction: column; }
  .form-row { flex-direction: column; }
  .modal { padding: 1.25rem; }
  .hero { padding: 1.25rem; }
  .hero h1 { font-size: 1.25rem; }
  .topbar { padding: 0 1rem; }
}
@media (max-width: 480px) {
  .nav-tab { padding: .6rem .7rem; font-size: .82rem; }
}
