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

/* ─── TOKENS ──────────────────────────────────────────────────────────────── */
:root {
  --blue:        #0C589A;
  --blue-dark:   #094a82;
  --blue-light:  #e8f2fc;
  --green:       #065f46;
  --green-dark:  #044e3a;
  --green-light: #ecfdf5;
  --red:         #B82538;
  --red-dark:    #9a1e2f;
  --red-light:   #fdeaed;
  --white:       #ffffff;
  --black:       #000000;
  --gray-50:     #f9fafb;
  --gray-100:    #f3f4f6;
  --gray-200:    #e5e7eb;
  --gray-300:    #d1d5db;
  --gray-400:    #9ca3af;
  --gray-500:    #6b7280;
  --gray-600:    #4b5563;
  --gray-700:    #374151;
  --gray-800:    #1f2937;
  --gray-900:    #111827;
  --success:     #166534;
  --success-bg:  #dcfce7;
  --warning:     #92400e;
  --warning-bg:  #fef3c7;
  --error:       #991b1b;
  --error-bg:    #fee2e2;
  --radius-sm:   6px;
  --radius:      10px;
  --radius-lg:   16px;
  --radius-xl:   24px;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.08);
  --shadow:      0 4px 16px rgba(0,0,0,.10);
  --shadow-lg:   0 8px 32px rgba(0,0,0,.14);
  --shadow-blue: 0 4px 20px rgba(12,88,154,.25);
  --transition:  all .2s ease;
}

/* ─── RESET ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--blue); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--blue-dark); }
img { max-width: 100%; display: block; }
ul { list-style: none; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* ─── TYPOGRAPHY ──────────────────────────────────────────────────────────── */
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 800; line-height: 1.2; }
h2 { font-size: clamp(1.4rem, 3vw, 2rem);   font-weight: 700; line-height: 1.3; }
h3 { font-size: 1.25rem; font-weight: 600; }
h4 { font-size: 1rem;    font-weight: 600; }
p  { color: var(--gray-600); }

/* ─── LAYOUT ──────────────────────────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.container-sm { max-width: 760px; margin: 0 auto; padding: 0 24px; }
.page-content { padding: 48px 0; }

/* ─── NAVBAR ──────────────────────────────────────────────────────────────── */
.navbar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-sm);
}
.navbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 68px; max-width: 1200px; margin: 0 auto; padding: 0 24px;
}
.navbar-brand {
  display: flex; align-items: center; gap: 12px;
}
.navbar-brand img { height: 42px; }
.navbar-brand-text { display: flex; flex-direction: column; }
.navbar-brand-text .brand-title { font-size: .95rem; font-weight: 700; color: var(--blue); line-height: 1.2; }
.navbar-brand-text .brand-sub   { font-size: .7rem; color: var(--gray-500); }
.navbar-links { display: flex; align-items: center; gap: 8px; }
.navbar-links a {
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: .9rem; font-weight: 500; color: var(--gray-600);
  transition: var(--transition);
}
.navbar-links a:hover, .navbar-links a.active { background: var(--blue-light); color: var(--blue); }
.navbar-links .btn-nav {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--blue); color: var(--white) !important;
  padding: 8px 20px; border-radius: var(--radius-sm);
}
.navbar-links .btn-nav:hover { background: var(--blue-dark); }
.navbar-links .btn-nav-red {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--red); color: var(--white) !important;
  padding: 8px 20px; border-radius: var(--radius-sm);
}
.navbar-links .btn-nav-red:hover { background: var(--red-dark); }
.navbar-hamburger { display: none; background: none; border: none; padding: 8px; }
.navbar-hamburger span { display: block; width: 22px; height: 2px; background: var(--gray-700); margin: 5px 0; border-radius: 2px; transition: var(--transition); }

/* ─── BUTTONS ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 22px; border-radius: var(--radius-sm);
  font-size: .9rem; font-weight: 600; border: none;
  transition: var(--transition); cursor: pointer; white-space: nowrap;
}
.btn-primary   { background: var(--blue);  color: var(--white); box-shadow: var(--shadow-blue); }
.btn-primary:hover { background: var(--blue-dark); transform: translateY(-1px); }
.btn-danger    { background: var(--red);   color: var(--white); }
.btn-danger:hover  { background: var(--red-dark); transform: translateY(-1px); }
.btn-outline   { background: transparent; border: 2px solid var(--blue); color: var(--blue); }
.btn-outline:hover { background: var(--blue-light); }
.btn-ghost     { background: var(--gray-100); color: var(--gray-700); }
.btn-ghost:hover   { background: var(--gray-200); }
.btn-success   { background: #16a34a; color: var(--white); }
.btn-success:hover { background: #15803d; }
.btn-sm { padding: 6px 14px; font-size: .82rem; }
.btn-lg { padding: 14px 32px; font-size: 1rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }
.btn-icon { width: 36px; height: 36px; padding: 0; justify-content: center; border-radius: var(--radius-sm); }

/* ─── CARDS ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--white); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); border: 1px solid var(--gray-100);
  overflow: hidden;
}
.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
}
.card-body { padding: 24px; }
.card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-100);
  background: var(--gray-50);
}

/* ─── FORMS ───────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block; margin-bottom: 6px;
  font-size: .875rem; font-weight: 600; color: var(--gray-700);
}
.form-label .required { color: var(--red); margin-left: 2px; }
.form-control {
  width: 100%; padding: 11px 14px;
  border: 1.5px solid var(--gray-200); border-radius: var(--radius-sm);
  font-size: .9rem; color: var(--gray-800); background: var(--white);
  transition: var(--transition);
}
.form-control:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(12,88,154,.12);
}
.form-control:disabled { background: var(--gray-50); color: var(--gray-400); }
textarea.form-control { resize: vertical; min-height: 140px; }
select.form-control { cursor: pointer; }
.form-hint  { margin-top: 5px; font-size: .78rem; color: var(--gray-500); }
.form-error { margin-top: 5px; font-size: .78rem; color: var(--red); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media(max-width:600px) { .form-row { grid-template-columns: 1fr; } }

/* ─── BADGES ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: .75rem; font-weight: 600;
}
.badge-blue    { background: var(--blue-light); color: var(--blue); }
.badge-red     { background: var(--red-light);  color: var(--red); }
.badge-green   { background: var(--success-bg); color: var(--success); }
.badge-yellow  { background: var(--warning-bg); color: var(--warning); }
.badge-gray    { background: var(--gray-100);   color: var(--gray-600); }
.badge-orange  { background: #fff3e0;            color: #e65100; }
.badge-purple  { background: #f3e5f5;            color: #7b1fa2; }
/* ─── TABLES ──────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead { background: var(--gray-50); }
th { padding: 12px 16px; text-align: left; font-weight: 600; color: var(--gray-600); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; border-bottom: 2px solid var(--gray-200); white-space: nowrap; }
td { padding: 14px 16px; border-bottom: 1px solid var(--gray-100); color: var(--gray-700); vertical-align: middle; }
tbody tr:hover { background: var(--gray-50); }
tbody tr:last-child td { border-bottom: none; }

/* ─── STAT CARDS ──────────────────────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
.stat-card {
  background: var(--white); border-radius: var(--radius-lg);
  padding: 20px; box-shadow: var(--shadow); border: 1px solid var(--gray-100);
  display: flex; flex-direction: column; gap: 8px;
}
.stat-card .stat-icon {
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
}
.stat-card .stat-value { font-size: 2rem; font-weight: 800; color: var(--gray-900); line-height: 1; }
.stat-card .stat-label { font-size: .8rem; color: var(--gray-500); font-weight: 500; }

/* ─── ALERTS ──────────────────────────────────────────────────────────────── */
.alert {
  padding: 14px 18px; border-radius: var(--radius-sm);
  font-size: .875rem; display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 16px;
}
.alert-info    { background: var(--blue-light); color: var(--blue); border-left: 4px solid var(--blue); }
.alert-success { background: var(--success-bg); color: var(--success); border-left: 4px solid #16a34a; }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-left: 4px solid #d97706; }
.alert-error   { background: var(--error-bg);   color: var(--error);   border-left: 4px solid var(--red); }

/* ─── TOASTS ──────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 28px; right: 28px; z-index: 9999;
  padding: 14px 22px; border-radius: var(--radius);
  font-size: .9rem; font-weight: 500; color: var(--white);
  box-shadow: var(--shadow-lg);
  transform: translateY(20px); opacity: 0;
  transition: all .35s cubic-bezier(.34,1.56,.64,1);
  max-width: 360px;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast-success { background: #16a34a; }
.toast-error   { background: var(--red); }
.toast-info    { background: var(--blue); }

/* ─── MODAL ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 1000; display: flex; align-items: center; justify-content: center;
  padding: 24px; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--white); border-radius: var(--radius-lg);
  max-width: 540px; width: 100%; box-shadow: var(--shadow-lg);
  transform: scale(.95); transition: transform .2s;
}
.modal-overlay.open .modal { transform: scale(1); }
.modal-header {
  padding: 20px 24px; border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 1.1rem; }
.modal-body   { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--gray-100); display: flex; justify-content: flex-end; gap: 10px; }
.modal-close  { background: none; border: none; font-size: 1.4rem; color: var(--gray-400); cursor: pointer; line-height: 1; }

/* ─── SIDEBAR LAYOUT (portal pages) ──────────────────────────────────────── */
.portal-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px; background: var(--blue); flex-shrink: 0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}
.sidebar-green { background: var(--green) !important; }
.sidebar-logo {
  padding: 24px 20px; border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex; align-items: center; gap: 12px;
}
.sidebar-logo img { height: 38px; filter: brightness(0) invert(1); }
.sidebar-logo-text .t1 { font-size: .85rem; font-weight: 700; color: #fff; line-height: 1.2; }
.sidebar-logo-text .t2 { font-size: .65rem; color: rgba(255,255,255,.6); }
.sidebar-nav { padding: 16px 12px; flex: 1; }
.sidebar-nav-label { font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: rgba(255,255,255,.4); padding: 12px 8px 6px; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: rgba(255,255,255,.75); font-size: .88rem; font-weight: 500;
  transition: var(--transition); margin-bottom: 2px;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
  background: rgba(255,255,255,.15); color: var(--white);
}
.sidebar-nav a .nav-icon { font-size: 1.1rem; width: 22px; text-align: center; }
.sidebar-footer {
  padding: 16px 12px; border-top: 1px solid rgba(255,255,255,.1);
}
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.sidebar-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,.2); display: flex; align-items: center;
  justify-content: center; font-weight: 700; color: #fff; font-size: .9rem; flex-shrink: 0;
}
.sidebar-user-info .u-name { font-size: .95rem; font-weight: 700; color: #fff; letter-spacing: 0.01em; }
.sidebar-user-info .u-role { font-size: .7rem; color: rgba(255,255,255,.5); }
.portal-main { flex: 1; overflow-y: auto; }
.portal-topbar {
  background: var(--white); border-bottom: 1px solid var(--gray-200);
  padding: 0 32px; height: 60px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 10;
}
.portal-topbar h2 { font-size: 1.1rem; font-weight: 700; color: var(--gray-800); }
.portal-body { padding: 32px; }

/* ─── PROGRESS RING ───────────────────────────────────────────────────────── */
.slot-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.slot-card {
  background: var(--white); border: 2px solid var(--gray-200);
  border-radius: var(--radius-lg); padding: 24px;
  text-align: center; transition: var(--transition);
}
.slot-card.used  { border-color: var(--blue); }
.slot-card.draft { border-color: var(--gray-300); }
.slot-card .slot-num { font-size: 2rem; font-weight: 800; color: var(--gray-300); }
.slot-card.used .slot-num  { color: var(--blue); }

/* ─── SCORE SLIDERS ───────────────────────────────────────────────────────── */
.score-slider { width: 100%; accent-color: var(--blue); }
.score-display {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--blue); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; font-weight: 800; flex-shrink: 0;
}
.criteria-row { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.criteria-label { flex: 1; font-weight: 600; color: var(--gray-700); font-size: .9rem; }
.criteria-slider { flex: 3; }

/* ─── WORD COUNT BAR ──────────────────────────────────────────────────────── */
.word-count-bar {
  height: 6px; border-radius: 3px; background: var(--gray-200);
  overflow: hidden; margin-top: 8px;
}
.word-count-fill {
  height: 100%; border-radius: 3px; background: var(--blue);
  transition: width .3s, background .3s;
}
.word-count-fill.warn  { background: #d97706; }
.word-count-fill.over  { background: var(--red); }
.word-count-text { font-size: .78rem; color: var(--gray-500); margin-top: 4px; }

/* ─── AUTHOR CARD ─────────────────────────────────────────────────────────── */
.author-card {
  background: var(--gray-50); border: 1px solid var(--gray-200);
  border-radius: var(--radius); padding: 16px; margin-bottom: 12px;
  position: relative;
}
.author-card .author-index {
  position: absolute; top: 12px; left: 12px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--blue); color: #fff;
  font-size: .75rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.author-card-body { padding-left: 36px; }

/* ─── FOOTER ──────────────────────────────────────────────────────────────── */
.footer {
  background: var(--gray-900); color: var(--gray-400);
  padding: 40px 0 24px;
}
.footer-inner { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 32px; max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.footer-brand { display: flex; flex-direction: column; gap: 12px; }
.footer-brand img { height: 40px; filter: brightness(0) invert(1) opacity(.7); }
.footer-brand p { font-size: .82rem; line-height: 1.7; }
.footer h4 { color: var(--white); font-size: .9rem; margin-bottom: 12px; }
.footer ul li { margin-bottom: 8px; }
.footer ul li a { font-size: .82rem; color: var(--gray-400); }
.footer ul li a:hover { color: var(--white); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.08); margin-top: 32px; padding-top: 20px; text-align: center; font-size: .78rem; }
@media(max-width: 768px) {
  .footer-inner { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .portal-body { padding: 20px; }
  .slot-grid { grid-template-columns: 1fr; }
}

/* ─── HERO ────────────────────────────────────────────────────────────────── */
@keyframes heroZoomOut {
  0% { transform: scale(1.15); }
  100% { transform: scale(1); }
}
.hero {
  background: var(--blue-dark);
  color: var(--white); padding: 80px 0;
  position: relative; overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(rgba(12, 88, 154, 0.6), rgba(9, 74, 130, 0.7)), url('/img/hero-bg.jpg') center/cover no-repeat;
  z-index: 0;
  animation: heroZoomOut 8s ease-out forwards;
}
.hero-inner { position: relative; z-index: 1; max-width: 1200px; margin: 0 auto; padding: 0 24px; display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 48px; }
.hero-badge { display: inline-flex; align-items: center; gap: 8px; background: rgba(255,255,255,.15); backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,.2); border-radius: 20px; padding: 6px 16px; font-size: .8rem; font-weight: 600; margin-bottom: 20px; }
.hero h1 { color: var(--white); margin-bottom: 16px; }
.hero p  { color: rgba(255,255,255,.8); font-size: 1.05rem; margin-bottom: 32px; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-card {
  background: rgba(255,255,255,.12); backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.2); border-radius: var(--radius-xl);
  padding: 32px; display: flex; flex-direction: column; gap: 20px;
}
.hero-card-stat { text-align: center; }
.hero-card-stat .big { font-size: 2.4rem; font-weight: 800; color: var(--white); }
.hero-card-stat .lbl { font-size: .78rem; color: rgba(255,255,255,.6); text-transform: uppercase; letter-spacing: .06em; }
@media(max-width: 768px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-card { display: none; }
}

/* ─── OTP INPUT ───────────────────────────────────────────────────────────── */
.otp-inputs { display: flex; gap: 12px; justify-content: center; }
.otp-inputs input {
  width: 56px; height: 64px; text-align: center;
  font-size: 1.6rem; font-weight: 700; border-radius: var(--radius);
  border: 2px solid var(--gray-200); background: var(--white);
  transition: var(--transition);
}
.otp-inputs input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(12,88,154,.12); outline: none; }

/* ─── EMPTY STATE ─────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--gray-400); }
.empty-state .icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state h3 { color: var(--gray-600); margin-bottom: 8px; }

/* ─── SPINNER ─────────────────────────────────────────────────────────────── */
.spinner {
  width: 40px; height: 40px; border: 3px solid var(--gray-200);
  border-top-color: var(--blue); border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-center { display: flex; justify-content: center; padding: 60px; }
