/* ============================================================
   AISAS V3 — Multi-University Platform
   Supports Khmer (Noto Sans Khmer) + English
   ============================================================ */
:root {
  --primary:   #0D2137;
  --secondary: #1565C0;
  --accent:    #FF6D00;
  --success:   #2E7D32;
  --warning:   #F57F17;
  --danger:    #C62828;
  --gold:      #F9A825;
  --light-bg:  #F4F6F8;
  --card-radius: 14px;
  --shadow:    0 2px 16px rgba(13,33,55,.10);
  --sidebar-w: 256px;
  --topbar-h:  60px;
}

/* ── Fonts ─────────────────────────────────────────────────── */
body {
  font-family: 'Noto Sans Khmer','Segoe UI',system-ui,sans-serif;
  font-size: 14px;
  background: var(--light-bg);
  color: #1a2535;
}
.lang-en body, [lang="en"] { font-family: 'Segoe UI', system-ui, sans-serif; }

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-w); height: 100vh;
  background: var(--primary);
  display: flex; flex-direction: column;
  z-index: 1000; overflow: hidden;
  transition: width .25s ease;
}
.sidebar.collapsed { width: 62px; }
.sidebar.collapsed .nav-label,
.sidebar.collapsed .brand-name,
.sidebar.collapsed .nav-section { display: none; }
.sidebar.collapsed .nav-link span { display: none; }

.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  text-decoration: none;
}
.brand-logo {
  width: 38px; height: 38px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.brand-name { color: white; font-size: 15px; font-weight: 700; line-height: 1.2; }
.brand-sub  { color: rgba(255,255,255,.5); font-size: 11px; }
.brand-version {
  margin-left: auto;
  background: var(--accent); color: white;
  font-size: 9px; padding: 1px 6px; border-radius: 8px; font-weight: 700;
}

.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.nav-section {
  font-size: 10px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: rgba(255,255,255,.35);
  padding: 10px 16px 3px;
}
.sidebar-nav .nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; color: rgba(255,255,255,.72);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: all .15s;
  white-space: nowrap;
}
.sidebar-nav .nav-link i { font-size: 16px; width: 20px; flex-shrink: 0; text-align: center; }
.sidebar-nav .nav-link:hover  { background: rgba(255,255,255,.07); color: white; }
.sidebar-nav .nav-link.active {
  background: rgba(21,101,192,.25); color: white;
  border-left-color: var(--accent);
}
.sidebar-footer { padding: 8px 0; border-top: 1px solid rgba(255,255,255,.1); }

/* ── Main Layout ─────────────────────────────────────────────── */
.main-content { margin-left: var(--sidebar-w); min-height: 100vh; transition: margin-left .25s; }
.main-content.expanded { margin-left: 62px; }

.topbar {
  height: var(--topbar-h);
  background: white;
  border-bottom: 1px solid #E0E7EF;
  display: flex; align-items: center; gap: 12px;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.topbar-title { font-size: 16px; font-weight: 700; color: var(--primary); flex: 1; }

/* University badge in topbar */
.uni-badge {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 12px; background: var(--primary)0D;
  border-radius: 20px; border: 1px solid var(--primary)20;
  font-size: 12px; font-weight: 600; color: var(--primary);
  max-width: 220px; overflow: hidden;
}
.uni-badge img { width: 22px; height: 22px; object-fit: cover; border-radius: 50%; }

.content-area { padding: 24px; }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  border: none; border-radius: var(--card-radius);
  box-shadow: var(--shadow); background: white;
}
.card-header {
  background: white; border-bottom: 1px solid #E8EEF5;
  border-radius: var(--card-radius) var(--card-radius) 0 0 !important;
  padding: 16px 20px; font-weight: 700;
  color: var(--primary); font-size: 14px;
}

/* ── KPI Cards ──────────────────────────────────────────────── */
.kpi-card {
  border-radius: var(--card-radius); padding: 20px 22px;
  color: white; position: relative; overflow: hidden;
  box-shadow: var(--shadow);
}
.kpi-card::after {
  content: ''; position: absolute; right: -15px; top: -15px;
  width: 80px; height: 80px; background: rgba(255,255,255,.1); border-radius: 50%;
}
.kpi-value { font-size: 2rem; font-weight: 800; line-height: 1; }
.kpi-label { font-size: 12px; opacity: .85; margin-top: 4px; }
.kpi-icon  { font-size: 2.2rem; opacity: .25; position: absolute; right: 18px; bottom: 8px; }
.kpi-primary   { background: linear-gradient(135deg, #0D2137, #1565C0); }
.kpi-secondary { background: linear-gradient(135deg, #1565C0, #42A5F5); }
.kpi-success   { background: linear-gradient(135deg, #2E7D32, #43A047); }
.kpi-accent    { background: linear-gradient(135deg, #E65100, #FF6D00); }
.kpi-gold      { background: linear-gradient(135deg, #F57F17, #F9A825); }

/* ── University Cards (Home/Public) ─────────────────────────── */
.uni-card {
  border-radius: var(--card-radius); overflow: hidden;
  transition: transform .2s, box-shadow .2s;
  border: 1px solid #E8EEF5; background: white;
  text-decoration: none; color: inherit;
  display: block;
}
.uni-card:hover { transform: translateY(-4px); box-shadow: 0 8px 32px rgba(13,33,55,.15); }
.uni-card-logo  {
  height: 120px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0D2137, #1565C0);
}
.uni-card-logo img { max-height: 80px; max-width: 140px; object-fit: contain; filter: brightness(10); }
.uni-card-body { padding: 16px; }
.uni-card-name { font-weight: 700; font-size: 14px; color: var(--primary); line-height: 1.4; }
.uni-card-abbr {
  display: inline-block; background: var(--secondary);
  color: white; font-size: 10px; padding: 2px 8px;
  border-radius: 10px; margin-top: 4px;
}

/* ── Tables ─────────────────────────────────────────────────── */
.table { font-size: 13px; }
.table thead th {
  background: var(--primary); color: white;
  font-weight: 700; border: none; padding: 11px 14px;
}
.table tbody tr:hover { background: #F4F6F8; }
.table tbody td { padding: 11px 14px; vertical-align: middle; border-color: #EEF2F7; }
.status-badge { font-size: 11px; padding: 3px 10px; border-radius: 12px; font-weight: 700; }
.status-open      { background: #E8F5E9; color: #1B5E20; }
.status-closed    { background: #FFEBEE; color: #B71C1C; }
.status-draft     { background: #FFF8E1; color: #E65100; }
.status-archived  { background: #ECEFF1; color: #37474F; }
.status-pending   { background: #FFF3E0; color: #E65100; }
.status-approved  { background: #E8F5E9; color: #1B5E20; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-control, .form-select {
  border: 1.5px solid #D0DAE8; border-radius: 8px;
  padding: 9px 13px; font-size: 14px;
  font-family: 'Noto Sans Khmer','Segoe UI',sans-serif;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(21,101,192,.12);
}
.form-label { font-weight: 600; font-size: 13px; color: #444; margin-bottom: 5px; }
.btn-primary   { background: var(--primary);   border-color: var(--primary); }
.btn-primary:hover { background: #0a1a2e; border-color: #0a1a2e; }
.btn-secondary { background: var(--secondary); border-color: var(--secondary); }
.btn-accent    { background: var(--accent); border-color: var(--accent); color: white; }

/* ── Auth Pages ─────────────────────────────────────────────── */
.auth-wrapper {
  min-height: 100vh;
  background: linear-gradient(135deg, #0D2137 0%, #1565C0 60%, #0D47A1 100%);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.auth-card {
  width: 100%; max-width: 440px; background: white;
  border-radius: 20px; padding: 40px;
  box-shadow: 0 24px 80px rgba(0,0,0,.25);
}
.auth-logo {
  width: 56px; height: 56px; background: var(--primary);
  border-radius: 14px; display: flex; align-items: center;
  justify-content: center; color: white; font-size: 24px; margin: 0 auto 14px;
}
.auth-title { font-size: 22px; font-weight: 800; color: var(--primary); text-align: center; }
.auth-sub { font-size: 13px; color: #888; text-align: center; margin-bottom: 28px; }

/* ── Survey ─────────────────────────────────────────────────── */
.survey-section {
  background: white; border-radius: var(--card-radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.survey-section-header {
  background: var(--primary); color: white;
  padding: 14px 22px; font-weight: 700;
  display: flex; align-items: center; gap: 10px;
}
.survey-section-body { padding: 22px; }
.question-block { margin-bottom: 22px; padding-bottom: 20px; border-bottom: 1px solid #EEF2F7; }
.question-block:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.question-text { font-weight: 600; margin-bottom: 12px; color: #1a2535; font-size: 14px; }
.required-star { color: var(--danger); }
.survey-section-body .form-check-label {
  color: #1a2535; font-size: 14px; font-weight: 500; cursor: pointer;
}
.survey-section-body .form-check-input {
  width: 1.1em; height: 1.1em; cursor: pointer;
  border: 2px solid #7B9AB8;
}
.survey-section-body .form-check-input:checked {
  background-color: var(--secondary); border-color: var(--secondary);
}
.survey-section-body .form-check { padding-left: 1.8em; margin-bottom: 10px; }
.survey-section-body .form-check:hover .form-check-label { color: var(--secondary); }

/* Likert Scale */
.likert-group { display: flex; gap: 8px; flex-wrap: wrap; }
.likert-option { flex: 1; min-width: 70px; }
.likert-option input { display: none; }
.likert-option label {
  display: block; text-align: center; padding: 8px 4px;
  border: 2px solid #D0DAE8; border-radius: 10px; cursor: pointer;
  font-size: 12px; transition: all .15s; background: white; color: #2c3e50;
}
.likert-option input:checked + label {
  background: var(--secondary); border-color: var(--secondary); color: white;
}
.likert-option label:hover { border-color: var(--secondary); }

/* ── Public Homepage ─────────────────────────────────────────── */
.hero-section {
  background: linear-gradient(135deg, #0D2137 0%, #1565C0 100%);
  padding: 80px 0; color: white;
}
.platform-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.15); padding: 6px 16px;
  border-radius: 20px; font-size: 12px; margin-bottom: 20px;
  backdrop-filter: blur(10px);
}
.stat-card {
  background: rgba(255,255,255,.1); border-radius: 12px;
  padding: 20px; text-align: center; backdrop-filter: blur(10px);
}

/* ── Language Toggle ─────────────────────────────────────────── */
.lang-btn { font-size: 12px; padding: 3px 10px; border-radius: 16px; }
.lang-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { width: 62px; }
  .sidebar .brand-name, .sidebar .nav-section, .sidebar span { display: none; }
  .main-content { margin-left: 62px; }
  .content-area { padding: 16px; }
}
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #f0f4f8; }
::-webkit-scrollbar-thumb { background: #b0c4d8; border-radius: 3px; }
.font-monospace { font-family: 'Courier New', monospace !important; }
