/* ============================================
   CounselSpace.Ai - Design System & Styles
   Premium Mobile-First Student Mental Health App
   ============================================ */

/* ---------- CSS Custom Properties ---------- */
:root {
  /* ============================================
     PALET BARU (mengikuti 12 desain Canva)
     ============================================ */

  /* Navy bertekstur - latar utama */
  --navy-950: #101A33;
  --navy-900: #16223F;
  --navy-800: #1E2C50;
  --navy-700: #26365E;
  --navy-600: #2E4070;

  /* Biru aksi (tombol glossy) */
  --blue-300: #6FD3FF;
  --blue-400: #29ABE2;
  --blue-500: #1E9BF0;
  --blue-600: #1565D8;
  --blue-800: #0B3E8F;
  --blue-950: #0A1F45;

  /* Aksen hi-tech (kartu menu, PNG 2) */
  --cyan-400: #17E9C6;
  --cyan-300: #5CF5DC;
  --slate-card: #2A3038;

  /* Kuis (PNG 8) */
  --cream-100: #F2EBE0;
  --cream-300: #F6DFB2;
  --sage-400: #A9C0A1;

  /* Chat guru BK (PNG 12) */
  --purple-300: #D9A8F0;
  --pink-500: #F94FA5;

  --panel-white: #FFFFFF;

  /* ============================================
     ALIAS - nama lama tetap hidup, warna baru.
     JANGAN dihapus: dipakai ~2400 baris CSS lama.
     ============================================ */

  /* Colors - Base */
  --bg-primary: var(--navy-800);
  --bg-secondary: var(--navy-700);
  --bg-tertiary: var(--navy-600);
  --bg-card: rgba(38, 54, 94, 0.82);
  --bg-card-solid: var(--navy-700);

  /* Colors - Accent (teal-* kini memetakan ke biru aksi) */
  --teal-600: #1565D8;
  --teal-500: #1E9BF0;
  --teal-400: #45C8FF;
  --teal-300: #8ADCFF;
  --indigo-500: #7C5CE0;
  --indigo-400: #A78BFA;
  --amber-500: #F59E0B;
  --amber-400: #FBBF24;
  --red-500: #EF4444;
  --red-400: #F87171;
  --green-500: #22C55E;
  --green-400: #4ADE80;
  --sage: var(--sage-400);

  /* Colors - Text */
  --text-primary: #F4F8FF;
  --text-secondary: #A9BCE0;
  --text-tertiary: #7488B4;
  --text-muted: #56698F;

  /* Alias yatim: dipakai di CSS lama tapi tak pernah didefinisikan,
     sehingga aturannya diam-diam gagal. Didefinisikan di sini. */
  --accent: var(--blue-500);
  --border-color: rgba(140, 190, 255, 0.18);
  --transition: 0.3s ease;
  --bg-hover: rgba(140, 190, 255, 0.08);

  /* Glassmorphism */
  --glass-bg: rgba(38, 54, 94, 0.82);
  --glass-border: rgba(140, 190, 255, 0.18);
  --glass-blur: blur(16px);
  --glass-bg-light: rgba(38, 54, 94, 0.6);

  /* Gradients */
  --gradient-teal: linear-gradient(180deg, #3FC0FF 0%, #1E9BF0 45%, #0B5FBF 100%);
  --gradient-teal-soft: linear-gradient(135deg, rgba(30, 155, 240, 0.22), rgba(21, 101, 216, 0.1));
  --gradient-indigo: linear-gradient(135deg, #7C5CE0, #A78BFA);
  --gradient-amber: linear-gradient(135deg, #F59E0B, #FBBF24);
  --gradient-red: linear-gradient(135deg, #EF4444, #F87171);
  --gradient-green: linear-gradient(135deg, #22C55E, #4ADE80);
  --gradient-hero: linear-gradient(135deg, #16223F 0%, #1E2C50 50%, #0B3E8F 100%);

  /* Gradient khas desain baru */
  --gradient-glossy: linear-gradient(180deg, #6FD3FF 0%, #29ABE2 18%, #1565D8 55%, #0B3E8F 100%);
  --gradient-pill-title: linear-gradient(180deg, #123A7A 0%, #0A1F45 100%);
  --gradient-cyan: linear-gradient(135deg, #17E9C6, #5CF5DC);

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 24px;
  --radius-full: 50%;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-teal: 0 6px 18px rgba(21, 101, 216, 0.45);
  --shadow-glossy: 0 6px 0 rgba(8, 40, 96, 0.55), 0 10px 22px rgba(4, 16, 40, 0.5);
  --glow-blue: 0 0 26px rgba(120, 190, 255, 0.6);
  --glow-cyan: 0 0 18px rgba(23, 233, 198, 0.5);
  --shadow-red: 0 4px 20px rgba(239, 68, 68, 0.3);
  --shadow-amber: 0 4px 20px rgba(245, 158, 11, 0.3);
  --shadow-green: 0 4px 20px rgba(34, 197, 94, 0.3);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.3s ease;
  --transition-slow: 0.5s ease;

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Poppins', 'Inter', -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display-lg: 1.5rem;
  --font-xs: 0.75rem;
  --font-sm: 0.8125rem;
  --font-base: 0.9375rem;
  --font-md: 1rem;
  --font-lg: 1.125rem;
  --font-xl: 1.25rem;
  --font-2xl: 1.5rem;
  --font-3xl: 2rem;
  --font-4xl: 2.5rem;

  /* Layout */
  --bottom-nav-height: 72px;
  --max-width: 480px;
}

/* ---------- Reset & Normalize ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-base);
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  background-image: radial-gradient(ellipse at 50% 0%, #26365E 0%, #1E2C50 45%, #16223F 100%);
  background-attachment: fixed;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Tekstur noise halus seperti latar bertekstur di desain Canva */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.4;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

a {
  color: var(--teal-400);
  text-decoration: none;
}

a:hover {
  color: var(--teal-300);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  font-size: inherit;
}

input, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  border: none;
  outline: none;
  background: none;
}

ul, ol {
  list-style: none;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--text-tertiary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--text-tertiary) transparent;
}

/* ---------- App Container ---------- */
.app-container {
  max-width: var(--max-width);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  overflow-x: hidden;
}

/* ---------- Page System ---------- */
.page {
  display: none;
  padding: var(--space-md);
  padding-bottom: calc(var(--bottom-nav-height) + var(--space-lg));
  min-height: 100vh;
  min-height: 100dvh;
  opacity: 0;
  transform: translateY(12px);
}

.page:not(.page-active) {
  display: none !important;
}

.page.page-active {
  display: block;
  opacity: 1 !important;
  transform: translateY(0) !important;
  animation: pageEnter 0.35s ease forwards;
}

.page.page-exit {
  animation: pageExit 0.25s ease forwards;
}

@keyframes pageEnter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pageExit {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-12px);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes slideDown {
  from { transform: translateY(0); }
  to { transform: translateY(100%); }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 8px rgba(13, 148, 136, 0.4);
  }
  50% {
    box-shadow: 0 0 20px rgba(13, 148, 136, 0.7);
  }
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes breatheIn {
  0% { transform: scale(0.6); opacity: 0.4; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes breatheOut {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(0.6); opacity: 0.4; }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes confetti {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(-200px) rotate(720deg);
    opacity: 0;
  }
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes countUp {
  from { opacity: 0; transform: scale(0.5); }
  to { opacity: 1; transform: scale(1); }
}

/* ---------- Bottom Navigation ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--max-width);
  height: var(--bottom-nav-height);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-top: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 var(--space-sm);
  padding-bottom: env(safe-area-inset-bottom, 0);
  z-index: 1000;
  transition: transform var(--transition-base);
}

.bottom-nav.hidden {
  transform: translateX(-50%) translateY(100%);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: var(--space-sm) var(--space-sm);
  border-radius: var(--radius-md);
  color: var(--text-tertiary);
  font-size: var(--font-xs);
  font-weight: 500;
  transition: all var(--transition-base);
  position: relative;
  min-width: 56px;
}

.nav-item .nav-icon {
  font-size: 1.35rem;
  line-height: 1;
  transition: transform var(--transition-base);
}

.nav-item .nav-label {
  font-size: 0.65rem;
  letter-spacing: 0.02em;
}

.nav-item.active {
  color: var(--teal-400);
}

.nav-item.active .nav-icon {
  transform: scale(1.15);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  background: var(--gradient-teal);
  border-radius: 0 0 4px 4px;
}

.nav-item:active {
  transform: scale(0.92);
}

/* ---------- Card Component ---------- */
.card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-base);
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.card-sm {
  padding: var(--space-md);
}

.card-interactive {
  cursor: pointer;
}

.card-interactive:active {
  transform: scale(0.97);
  box-shadow: var(--shadow-md);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 14px 24px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: var(--font-base);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: var(--gradient-teal);
  color: white;
  box-shadow: var(--shadow-teal);
}

.btn-primary:hover {
  box-shadow: 0 6px 28px rgba(13, 148, 136, 0.45);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
  background: rgba(51, 65, 85, 0.8);
}

.btn-danger {
  background: var(--gradient-red);
  color: white;
  box-shadow: var(--shadow-red);
}

.btn-warning {
  background: var(--gradient-amber);
  color: #1E293B;
  box-shadow: var(--shadow-amber);
}

.btn-success {
  background: var(--gradient-green);
  color: white;
  box-shadow: var(--shadow-green);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--teal-500);
  color: var(--teal-400);
}

.btn-outline:hover {
  background: rgba(13, 148, 136, 0.1);
}

.btn-block {
  width: 100%;
}

.btn-lg {
  padding: 16px 32px;
  font-size: var(--font-lg);
  border-radius: var(--radius-lg);
}

.btn-sm {
  padding: 8px 16px;
  font-size: var(--font-sm);
  border-radius: var(--radius-sm);
}

.btn-pill {
  border-radius: var(--radius-pill);
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-full);
}

/* ---------- Form Inputs ---------- */
.form-group {
  margin-bottom: var(--space-md);
}

.form-label {
  display: block;
  font-size: var(--font-sm);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.form-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-tertiary);
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--font-base);
  transition: all var(--transition-base);
}

.form-input::placeholder {
  color: var(--text-tertiary);
}

.form-input:focus {
  border-color: var(--teal-500);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
  background: rgba(51, 65, 85, 0.6);
}

textarea.form-input {
  resize: vertical;
  min-height: 80px;
}

/* ---------- Progress Bar ---------- */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: var(--gradient-teal);
  border-radius: 3px;
  transition: width 0.4s ease;
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

.progress-text {
  font-size: var(--font-xs);
  color: var(--text-secondary);
  margin-top: var(--space-xs);
  text-align: right;
}

/* ---------- Chat Bubbles ---------- */
.chat-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
  overflow-y: auto;
  flex: 1;
}

.chat-bubble {
  max-width: 82%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: var(--font-sm);
  line-height: 1.5;
  animation: fadeInUp 0.25s ease;
  word-wrap: break-word;
}

/* Terkirim (siswa) - biru, rata kanan (PNG 10) */
.chat-bubble.sent {
  background: var(--blue-500);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 6px;
  box-shadow: 0 4px 12px rgba(11, 62, 143, 0.4);
}

/* Diterima (bot/guru) - putih, rata kiri (PNG 10) */
.chat-bubble.received {
  background: var(--panel-white);
  color: #23303F;
  align-self: flex-start;
  border-bottom-left-radius: 6px;
  box-shadow: 0 4px 12px rgba(4, 16, 40, 0.28);
}

.chat-bubble .bubble-time {
  font-size: 0.65rem;
  opacity: 0.6;
  margin-top: 4px;
  display: block;
}

.chat-input-bar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-top: 1px solid var(--glass-border);
  position: relative;
  z-index: 10;
}

.chat-input-bar .form-input {
  flex: 1;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
}

.chat-input-bar .btn-send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--gradient-teal);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.1rem;
}

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  align-self: flex-start;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: var(--text-tertiary);
  border-radius: 50%;
  animation: typingDot 1.4s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
}

.quick-reply-btn {
  padding: 8px 14px;
  background: rgba(13, 148, 136, 0.15);
  border: 1px solid rgba(13, 148, 136, 0.3);
  border-radius: var(--radius-pill);
  color: var(--teal-400);
  font-size: var(--font-xs);
  font-weight: 500;
  transition: all var(--transition-base);
  white-space: nowrap;
}

.quick-reply-btn:active {
  background: rgba(13, 148, 136, 0.3);
  transform: scale(0.95);
}

/* ---------- Modal & Overlay ---------- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: var(--space-md);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 440px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  transform: scale(0.9) translateY(20px);
  transition: transform var(--transition-base);
}

.modal-overlay.active .modal-content {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--glass-border);
}

.modal-header h3 {
  font-size: var(--font-lg);
  font-weight: 600;
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: background var(--transition-fast);
}

.modal-close:hover {
  background: rgba(239, 68, 68, 0.2);
  color: var(--red-400);
}

.modal-body {
  padding: var(--space-lg);
}

.modal-footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--glass-border);
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
}

/* ---------- Toast Notifications ---------- */
.toast-container {
  position: fixed;
  top: var(--space-md);
  left: 50%;
  transform: translateX(-50%);
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  width: calc(100% - 32px);
  max-width: calc(var(--max-width) - 32px);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 14px 18px;
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  font-size: var(--font-sm);
  font-weight: 500;
  pointer-events: auto;
  animation: toastIn 0.35s ease forwards;
}

.toast.toast-out {
  animation: toastOut 0.3s ease forwards;
}

.toast-success {
  border-left: 3px solid var(--green-500);
}

.toast-error {
  border-left: 3px solid var(--red-500);
}

.toast-warning {
  border-left: 3px solid var(--amber-500);
}

.toast-info {
  border-left: 3px solid var(--teal-500);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
}

/* ---------- Loading Spinner ---------- */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  z-index: 3000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.loading-overlay.active {
  opacity: 1;
  visibility: visible;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--bg-tertiary);
  border-top-color: var(--teal-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-text {
  color: var(--text-secondary);
  font-size: var(--font-sm);
}

/* ---------- Status Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: var(--font-xs);
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.badge-aman {
  background: rgba(34, 197, 94, 0.15);
  color: var(--green-400);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-waspada {
  background: rgba(245, 158, 11, 0.15);
  color: var(--amber-400);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-bahaya {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red-400);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ============================================
   PAGE-SPECIFIC STYLES
   ============================================ */

/* ---------- Splash Screen ---------- */
#page-splash {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-xl);
  background: var(--bg-primary);
  position: relative;
  overflow: hidden;
}

#page-splash::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 40%, rgba(13, 148, 136, 0.12) 0%, transparent 50%),
              radial-gradient(circle at 70% 60%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
              radial-gradient(circle at 50% 80%, rgba(245, 158, 11, 0.06) 0%, transparent 40%);
  animation: gradientShift 8s ease infinite;
  background-size: 200% 200%;
}

.splash-particles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--teal-400);
  border-radius: 50%;
  opacity: 0.3;
  animation: float 6s ease-in-out infinite;
}

.particle:nth-child(1) { left: 10%; top: 20%; animation-delay: 0s; animation-duration: 5s; }
.particle:nth-child(2) { left: 30%; top: 70%; animation-delay: 1s; animation-duration: 7s; width: 6px; height: 6px; background: var(--indigo-400); }
.particle:nth-child(3) { left: 60%; top: 15%; animation-delay: 2s; animation-duration: 6s; }
.particle:nth-child(4) { left: 80%; top: 50%; animation-delay: 0.5s; animation-duration: 8s; width: 3px; height: 3px; background: var(--amber-400); }
.particle:nth-child(5) { left: 45%; top: 85%; animation-delay: 1.5s; animation-duration: 5.5s; width: 5px; height: 5px; }
.particle:nth-child(6) { left: 20%; top: 45%; animation-delay: 3s; animation-duration: 7s; background: var(--indigo-400); }
.particle:nth-child(7) { left: 75%; top: 30%; animation-delay: 2.5s; animation-duration: 6.5s; width: 3px; height: 3px; background: var(--green-400); }
.particle:nth-child(8) { left: 55%; top: 60%; animation-delay: 0.8s; animation-duration: 5.8s; }

.splash-logo {
  font-size: 4rem;
  margin-bottom: var(--space-lg);
  animation: float 3s ease-in-out infinite;
  position: relative;
  z-index: 1;
}

.splash-title {
  font-size: var(--font-3xl);
  font-weight: 700;
  margin-bottom: var(--space-sm);
  position: relative;
  z-index: 1;
  background: linear-gradient(135deg, var(--teal-400), var(--indigo-400));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.splash-tagline {
  font-size: var(--font-lg);
  color: var(--text-secondary);
  margin-bottom: var(--space-2xl);
  position: relative;
  z-index: 1;
}

.splash-btn {
  position: relative;
  z-index: 1;
  padding: 16px 48px;
  font-size: var(--font-lg);
  animation: pulseGlow 2s ease-in-out infinite;
}

/* ---------- Dashboard ---------- */
.dashboard-header {
  margin-bottom: var(--space-lg);
}

.greeting-text {
  font-size: var(--font-2xl);
  font-weight: 700;
  margin-bottom: 2px;
}

.greeting-date {
  font-size: var(--font-sm);
  color: var(--text-secondary);
}

.quick-stats {
  margin-bottom: var(--space-lg);
}

.stats-card {
  background: var(--gradient-teal-soft);
  border: 1px solid rgba(13, 148, 136, 0.2);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.stats-icon {
  font-size: 2rem;
}

.stats-info {
  flex: 1;
}

.stats-label {
  font-size: var(--font-xs);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stats-value {
  font-size: var(--font-xl);
  font-weight: 700;
}

.feature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.feature-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  cursor: pointer;
  transition: all var(--transition-base);
  text-align: center;
}

.feature-card:active {
  transform: scale(0.96);
}

.feature-card .feature-icon {
  font-size: 2rem;
  margin-bottom: var(--space-sm);
  display: block;
}

.feature-card .feature-title {
  font-size: var(--font-sm);
  font-weight: 600;
  margin-bottom: 4px;
}

.feature-card .feature-desc {
  font-size: var(--font-xs);
  color: var(--text-tertiary);
  line-height: 1.4;
}

.feature-card:nth-child(1) { border-top: 2px solid var(--teal-500); }
.feature-card:nth-child(2) { border-top: 2px solid var(--indigo-500); }
.feature-card:nth-child(3) { border-top: 2px solid var(--amber-500); }
.feature-card:nth-child(4) { border-top: 2px solid var(--green-500); }

.section-title {
  font-size: var(--font-lg);
  font-weight: 600;
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.history-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
}

.history-item:active {
  transform: scale(0.98);
}

.history-score {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: var(--font-sm);
  flex-shrink: 0;
}

.history-score.score-aman {
  background: rgba(34, 197, 94, 0.15);
  color: var(--green-400);
  border: 2px solid rgba(34, 197, 94, 0.3);
}

.history-score.score-waspada {
  background: rgba(245, 158, 11, 0.15);
  color: var(--amber-400);
  border: 2px solid rgba(245, 158, 11, 0.3);
}

.history-score.score-bahaya {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red-400);
  border: 2px solid rgba(239, 68, 68, 0.3);
}

.history-info {
  flex: 1;
}

.history-category {
  font-weight: 600;
  font-size: var(--font-sm);
}

.history-date {
  font-size: var(--font-xs);
  color: var(--text-tertiary);
}

.empty-state {
  text-align: center;
  padding: var(--space-xl);
  color: var(--text-tertiary);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

.empty-state p {
  font-size: var(--font-sm);
}

/* ---------- Screening Page ---------- */
#page-screening {
  padding-top: var(--space-md);
}

.screening-header {
  margin-bottom: var(--space-lg);
}

.screening-progress {
  margin-bottom: var(--space-md);
}

.screening-progress .progress-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

.screening-progress .progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #17E9C6, #1E9BF0);
  border-radius: 999px;
  box-shadow: 0 0 12px rgba(23, 233, 198, 0.6);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.screening-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.screening-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #F4F8FF;
  background: rgba(30, 155, 240, 0.16);
  border: 1.5px solid rgba(111, 211, 255, 0.4);
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all var(--transition-fast);
}

.screening-back:hover {
  background: rgba(30, 155, 240, 0.32);
  border-color: rgba(111, 211, 255, 0.8);
  color: #ffffff;
  transform: translateX(-2px);
}

.screening-back:active {
  transform: scale(0.96);
}

.screening-counter {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #fff;
  background: linear-gradient(135deg, rgba(30, 155, 240, 0.4), rgba(21, 101, 216, 0.6));
  border: 1px solid rgba(111, 211, 255, 0.4);
  padding: 6px 14px;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Footer navigasi kuis: Sebelumnya / Selanjutnya / Selesai */
.cs-quiz-footer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-top: var(--space-lg);
  padding-top: var(--space-sm);
}

.cs-quiz-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 12px;
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.cs-quiz-action-btn--prev {
  background: rgba(22, 34, 63, 0.85);
  border: 1.5px solid rgba(140, 190, 255, 0.35);
  color: var(--text-primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.cs-quiz-action-btn--prev:hover {
  background: rgba(38, 54, 94, 0.95);
  border-color: rgba(140, 190, 255, 0.7);
  transform: translateX(-2px);
}

.cs-quiz-action-btn--prev:active {
  transform: scale(0.96);
}

.cs-quiz-action-btn--next {
  background: linear-gradient(135deg, #1E9BF0, #1565D8);
  border: 1.5px solid rgba(111, 211, 255, 0.75);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(21, 101, 216, 0.45);
}

.cs-quiz-action-btn--next:hover {
  filter: brightness(1.1);
  transform: translateX(2px);
  box-shadow: 0 6px 20px rgba(21, 101, 216, 0.6);
}

.cs-quiz-action-btn--next:active {
  transform: scale(0.96);
}

.cs-quiz-action-btn--submit {
  background: linear-gradient(135deg, #22C55E, #16A34A);
  border: 1.5px solid rgba(134, 239, 172, 0.85);
  color: #ffffff;
  box-shadow: 0 4px 18px rgba(34, 197, 94, 0.45);
  padding: 12px 24px;
}

.cs-quiz-action-btn--submit:hover {
  filter: brightness(1.1);
  transform: scale(1.02);
  box-shadow: 0 6px 24px rgba(34, 197, 94, 0.6);
}

.cs-quiz-action-btn--submit:active {
  transform: scale(0.96);
}


/* Pre-screening identity form */
.identity-form {
  padding: var(--space-lg) 0;
}

.identity-form h2 {
  font-size: var(--font-2xl);
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.identity-form p {
  color: var(--text-secondary);
  margin-bottom: var(--space-xl);
  font-size: var(--font-sm);
}

/* ---------- Result Page ---------- */
#page-result {
  text-align: center;
  padding-top: var(--space-xl);
}

.result-circle-wrap {
  margin-bottom: var(--space-xl);
  animation: scaleIn 0.5s ease;
}

.result-circle {
  width: 180px;
  height: 180px;
  margin: 0 auto;
  position: relative;
}

.result-circle svg {
  transform: rotate(-90deg);
  width: 180px;
  height: 180px;
}

.result-circle .circle-bg {
  fill: none;
  stroke: var(--bg-tertiary);
  stroke-width: 8;
}

.result-circle .circle-fill {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.5s ease;
}

.result-circle .circle-fill.aman { stroke: var(--green-500); }
.result-circle .circle-fill.waspada { stroke: var(--amber-500); }
.result-circle .circle-fill.bahaya { stroke: var(--red-500); }

.result-score-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.result-score-number {
  font-size: var(--font-4xl);
  font-weight: 700;
  line-height: 1;
}

.result-score-label {
  font-size: var(--font-xs);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.result-category {
  margin-bottom: var(--space-md);
  animation: fadeInUp 0.4s ease 0.3s both;
}

.result-description {
  color: var(--text-secondary);
  margin-bottom: var(--space-xl);
  font-size: var(--font-sm);
  line-height: 1.7;
  animation: fadeInUp 0.4s ease 0.4s both;
  padding: 0 var(--space-md);
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  animation: fadeInUp 0.4s ease 0.5s both;
}

/* ---------- Edu Corner ---------- */
.edu-tabs {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  overflow-x: auto;
  padding-bottom: var(--space-xs);
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.edu-tabs::-webkit-scrollbar {
  display: none;
}

.edu-tab {
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  font-size: var(--font-sm);
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border: 1px solid transparent;
  white-space: nowrap;
  transition: all var(--transition-base);
}

.edu-tab.active {
  background: rgba(13, 148, 136, 0.15);
  color: var(--teal-400);
  border-color: rgba(13, 148, 136, 0.3);
}

.edu-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.edu-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition-base);
}

.edu-card:active {
  transform: scale(0.98);
}

.edu-card-thumb {
  width: 100%;
  height: 180px;
  background: var(--bg-tertiary);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.edu-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.edu-card-thumb .play-icon {
  position: absolute;
  width: 56px;
  height: 56px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  transition: transform var(--transition-base);
}

.edu-card:hover .play-icon {
  transform: scale(1.1);
}

.edu-card-thumb .poster-icon {
  font-size: 3rem;
  opacity: 0.5;
}

.edu-card-body {
  padding: var(--space-md);
}

.edu-card-type {
  font-size: var(--font-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--teal-400);
  margin-bottom: 4px;
}

.edu-card-title {
  font-size: var(--font-base);
  font-weight: 600;
  margin-bottom: 4px;
  line-height: 1.4;
}

.edu-card-snippet {
  font-size: var(--font-xs);
  color: var(--text-tertiary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Celebration */
.celebration-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2500;
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation: confettiDrop 3s ease-out forwards;
}

@keyframes confettiDrop {
  0% {
    transform: translateY(-100vh) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

/* ---------- Chat Page ---------- */
#page-chat {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  padding-bottom: var(--bottom-nav-height);
}

.chat-tabs {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
  margin-bottom: var(--space-sm);
}

.chat-tab {
  flex: 1;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  border: 1px solid transparent;
  font-size: var(--font-sm);
  font-weight: 500;
  text-align: center;
  color: var(--text-secondary);
  transition: all var(--transition-base);
}

.chat-tab.active {
  background: rgba(13, 148, 136, 0.15);
  color: var(--teal-400);
  border-color: rgba(13, 148, 136, 0.3);
}

.chat-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: var(--space-sm) var(--space-md);
  font-size: var(--font-xs);
  color: var(--text-secondary);
}

.chat-status .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green-500);
}

.chat-status .status-dot.offline {
  background: var(--text-tertiary);
}

.chat-panel {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.chat-panel.active {
  display: flex;
}

.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
}

/* ---------- Emergency Page ---------- */
#page-emergency {
  text-align: center;
}

.emergency-header {
  margin-bottom: var(--space-xl);
  padding-top: var(--space-lg);
}

.sos-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--space-md);
  background: rgba(239, 68, 68, 0.15);
  border: 2px solid rgba(239, 68, 68, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  animation: pulse 2s ease-in-out infinite;
}

.emergency-header h2 {
  font-size: var(--font-2xl);
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.emergency-header p {
  color: var(--text-secondary);
  font-size: var(--font-sm);
  line-height: 1.6;
}

.emergency-contacts {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
  text-align: left;
}

.emergency-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-base);
}

.emergency-card:active {
  transform: scale(0.98);
}

.emergency-card .e-icon {
  width: 48px;
  height: 48px;
  background: rgba(239, 68, 68, 0.15);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.emergency-card .e-info {
  flex: 1;
}

.emergency-card .e-name {
  font-weight: 600;
  font-size: var(--font-base);
  margin-bottom: 2px;
}

.emergency-card .e-detail {
  font-size: var(--font-xs);
  color: var(--text-secondary);
}

.emergency-card .e-action {
  color: var(--teal-400);
  font-size: 1.2rem;
}

.calming-message {
  padding: var(--space-lg);
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.15);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-lg);
}

.calming-message p {
  color: var(--green-400);
  font-size: var(--font-sm);
  line-height: 1.6;
}

/* ---------- Tabs Component (generic) ---------- */
.tabs {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  font-size: var(--font-sm);
  font-weight: 500;
  color: var(--text-tertiary);
  border-bottom: 2px solid transparent;
  transition: all var(--transition-base);
}

.tab.active {
  color: var(--teal-400);
  border-bottom-color: var(--teal-500);
}

/* ---------- Utility Classes ---------- */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-teal { color: var(--teal-400); }
.text-amber { color: var(--amber-400); }
.text-red { color: var(--red-400); }
.text-green { color: var(--green-400); }
.text-muted { color: var(--text-secondary); }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }

.hidden { display: none !important; }

.w-full { width: 100%; }

.anim-delay-1 { animation-delay: 0.1s; }
.anim-delay-2 { animation-delay: 0.2s; }
.anim-delay-3 { animation-delay: 0.3s; }
.anim-delay-4 { animation-delay: 0.4s; }

/* ---------- Video embed ---------- */
.video-embed {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 */
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-tertiary);
}

.video-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* ---------- Responsive ---------- */
@media (min-width: 481px) {
  .app-container {
    border-left: 1px solid var(--glass-border);
    border-right: 1px solid var(--glass-border);
  }
}

@media (min-width: 768px) {
  :root {
    --font-base: 1rem;
    --font-lg: 1.25rem;
    --font-2xl: 1.75rem;
    --font-3xl: 2.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Identity Form modal-like page ---------- */
.identity-card {
  text-align: left;
}

.identity-card h2 {
  text-align: center;
}

.identity-card .identity-icon {
  text-align: center;
  font-size: 3rem;
  margin-bottom: var(--space-md);
}

/* ---------- Counselor List and Chat Revisions ---------- */
.counselor-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 0.5rem 1rem;
  overflow-y: auto;
}

.counselor-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-sm);
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
}

.counselor-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 10%;
  width: 80%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(20, 184, 166, 0.25), transparent);
}

.counselor-card:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(20, 184, 166, 0.3);
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(20, 184, 166, 0.15);
}

.counselor-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  overflow: hidden;
  border: 3px solid rgba(20, 184, 166, 0.3);
  flex-shrink: 0;
  margin-bottom: 0.25rem;
  transition: all var(--transition);
}

.counselor-card:hover .counselor-avatar {
  border-color: var(--accent);
  transform: scale(1.05);
}

.counselor-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.counselor-info {
  width: 100%;
}

.counselor-info h4 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 4px;
}

.counselor-info .service-hours {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 8px;
}

/* Pulsing Neon Animation for Online Status */
@keyframes status-pulse {
  0% {
    transform: scale(0.9);
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6);
  }
  70% {
    transform: scale(1.1);
    box-shadow: 0 0 0 8px rgba(52, 211, 153, 0);
  }
  100% {
    transform: scale(0.9);
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0);
  }
}

.counselor-status {
  font-size: 0.75rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 20px;
  transition: all var(--transition);
}

.counselor-status.online {
  color: #34d399;
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.2);
  box-shadow: 0 2px 10px rgba(52, 211, 153, 0.05);
}

.counselor-status.offline {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.counselor-status .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  position: relative;
}

.counselor-status.online .status-dot {
  background: #34d399;
  animation: status-pulse 2s infinite ease-in-out;
}

.counselor-status.offline .status-dot {
  background: var(--text-muted);
  opacity: 0.6;
}

.chat-counselor-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  border-bottom: 1px solid var(--border-color);
  background: var(--glass-bg);
}

.btn-back-counselors {
  background: transparent;
  border: none;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-md);
  transition: background var(--transition);
}

.btn-back-counselors:hover {
  background: var(--bg-hover);
}

.counselor-header-profile {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex: 1;
  min-width: 0;
}

.counselor-header-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  overflow: hidden;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
}

.counselor-header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.counselor-header-info h4 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  padding: 4px 10px;
  border-radius: 12px;
}

.chat-status-badge.online {
  color: #34d399;
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.15);
}

.chat-status-badge.offline {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.chat-status-badge .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.chat-status-badge.online .status-dot {
  background: #34d399;
  animation: status-pulse 2s infinite ease-in-out;
}

.chat-status-badge.offline .status-dot {
  background: var(--text-muted);
  opacity: 0.6;
}

.identity-selector-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-xs) var(--space-sm);
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border-color);
}

.identity-toggle-group {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.05);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.identity-btn {
  background: transparent;
  border: none;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 4px var(--space-sm);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.identity-btn.active {
  background: var(--accent);
  color: var(--bg-primary);
  box-shadow: 0 2px 6px rgba(20, 184, 166, 0.3);
}

/* ============================================================
   ===============  LAPISAN DESAIN BARU (v2)  =================
   Komponen turunan dari 12 desain Canva.
   Prefix .cs-* agar tidak bentrok dengan kelas lama.
   ============================================================ */

.app-container {
  position: relative;
  z-index: 1;
}

/* ---------- 1. GLOW PILL TITLE (judul tiap halaman) ---------- */
.cs-title-pill {
  position: relative;
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: var(--space-lg) auto var(--space-xl);
  padding: 12px 34px;
  background: var(--gradient-pill-title);
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 14px;
  box-shadow: var(--glow-blue), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  font-family: var(--font-display);
  font-size: var(--font-display-lg);
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-align: center;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}

/* Bloom putih di sisi atas, seperti pantulan cahaya di desain */
.cs-title-pill::before {
  content: '';
  position: absolute;
  top: -14px;
  left: 12%;
  right: 12%;
  height: 20px;
  border-radius: 50%;
  background: rgba(190, 225, 255, 0.75);
  filter: blur(11px);
  pointer-events: none;
}

.cs-title-pill--sm {
  padding: 9px 24px;
  font-size: 1.15rem;
  margin: var(--space-md) auto var(--space-lg);
}

/* ---------- 2. TOMBOL GLOSSY BIRU ---------- */
.cs-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 14px 30px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  background: var(--gradient-glossy);
  box-shadow: var(--shadow-glossy), inset 0 2px 0 rgba(255, 255, 255, 0.45);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 2px 5px rgba(4, 22, 56, 0.65);
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-base), filter var(--transition-base);
  -webkit-tap-highlight-color: transparent;
}

/* Kilau kaca di separuh atas */
.cs-btn::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 6px;
  right: 6px;
  height: 42%;
  border-radius: 9px 9px 22px 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.cs-btn:hover {
  filter: brightness(1.08);
  box-shadow: var(--shadow-glossy), var(--glow-blue), inset 0 2px 0 rgba(255, 255, 255, 0.45);
}

.cs-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 rgba(8, 40, 96, 0.55), 0 4px 10px rgba(4, 16, 40, 0.5),
    inset 0 2px 0 rgba(255, 255, 255, 0.35);
}

/* Varian bentuk */
.cs-btn--pill { border-radius: 999px; }
.cs-btn--pill::after { border-radius: 999px; }
.cs-btn--block { width: 100%; }
.cs-btn--lg { padding: 17px 38px; font-size: 1.25rem; }
.cs-btn--sm { padding: 9px 18px; font-size: 0.85rem; border-width: 1.5px; }

/* Varian chevron (label "Nama Siswa" di PNG 9) */
.cs-btn--chevron {
  border-radius: 4px;
  clip-path: polygon(14px 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 14px 100%, 0 50%);
  border: none;
  box-shadow: none;
  padding: 12px 34px;
}
.cs-btn--chevron::after { border-radius: 0; }

/* Varian outline tipis untuk aksi sekunder */
.cs-btn--ghost {
  background: rgba(38, 54, 94, 0.7);
  border-color: rgba(140, 190, 255, 0.55);
  box-shadow: 0 4px 12px rgba(4, 16, 40, 0.4);
  text-shadow: none;
}
.cs-btn--ghost::after { display: none; }

/* ---------- 3. KARTU HI-TECH CHAMFER (menu, PNG 2) ---------- */
.cs-card-tech {
  position: relative;
  display: block;
  width: 100%;
  padding: 26px 22px;
  margin-bottom: var(--space-lg);
  background: var(--slate-card);
  clip-path: polygon(0 14px, 14px 0, calc(100% - 26px) 0, 100% 26px, 100% calc(100% - 14px),
    calc(100% - 14px) 100%, 26px 100%, 0 calc(100% - 26px));
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-align: center;
  color: #fff;
  cursor: pointer;
  transition: transform var(--transition-base), filter var(--transition-base);
  -webkit-tap-highlight-color: transparent;
}

/* Siku garis cyan di sudut - dibuat dari dua pseudo-element */
.cs-card-tech::before,
.cs-card-tech::after {
  content: '';
  position: absolute;
  width: 46px;
  height: 46px;
  pointer-events: none;
}

.cs-card-tech::before {
  top: -5px;
  left: -5px;
  border-top: 3px solid var(--cyan-400);
  border-left: 3px solid var(--cyan-400);
  filter: drop-shadow(var(--glow-cyan));
}

.cs-card-tech::after {
  right: -5px;
  bottom: -5px;
  border-right: 3px solid var(--cyan-400);
  border-bottom: 3px solid var(--cyan-400);
  filter: drop-shadow(var(--glow-cyan));
}

.cs-card-tech:hover {
  filter: brightness(1.12);
}

.cs-card-tech:active {
  transform: scale(0.975);
}

/* Pembungkus agar siku cyan tidak terpotong tepi layar */
.cs-card-tech-wrap {
  position: relative;
  padding: 6px;
}

/* ---------- 4. KARTU KUIS KRIM (PNG 8) ---------- */
.cs-quiz-card {
  position: relative;
  padding: 22px 20px;
  background: var(--cream-100);
  border: 2px solid rgba(90, 110, 80, 0.35);
  border-radius: 14px;
  box-shadow: 8px 8px 0 rgba(11, 62, 143, 0.55), -6px -6px 0 var(--sage-400);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.55;
  color: #23303F;
}

.cs-option {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.cs-option-letter {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--cream-300);
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 700;
  color: #2A2118;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.cs-option-body {
  flex: 1;
  min-width: 0;
  padding: 13px 16px;
  background: var(--cream-100);
  border: 2px solid rgba(150, 120, 80, 0.45);
  border-radius: 12px;
  box-shadow: inset 0 0 0 3px var(--cream-100), inset 0 0 0 4px rgba(180, 150, 110, 0.5);
  font-size: 0.9rem;
  font-weight: 500;
  color: #23303F;
  transition: background var(--transition-base), box-shadow var(--transition-base);
}

.cs-option.selected .cs-option-letter {
  background: var(--blue-500);
  color: #fff;
  transform: scale(1.06);
  box-shadow: var(--glow-blue);
}

.cs-option.selected .cs-option-body {
  background: #fff;
  box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 4px var(--blue-500);
}

.cs-option:active .cs-option-letter {
  transform: scale(0.94);
}

/* ---------- Header panel putih (PNG 10 & 12) ---------- */
.cs-chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--panel-white);
  border-radius: 0 0 18px 18px;
  box-shadow: 0 4px 16px rgba(4, 16, 40, 0.35);
}

.cs-chat-header .cs-avatar {
  flex: 0 0 auto;
}

.cs-chat-header-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.2;
  color: #16223F;
}

.cs-chat-header-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 500;
  color: #3C4A63;
}

.cs-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green-500);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.8);
}

.cs-status-dot--off {
  background: var(--text-tertiary);
  box-shadow: none;
}

/* ---------- Avatar bulat ---------- */
.cs-avatar {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  overflow: hidden;
  background: #CFE4F5;
  font-size: 1.4rem;
  color: #16223F;
}

.cs-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cs-avatar--lg { width: 76px; height: 76px; font-size: 2.2rem; }
.cs-avatar--xl { width: 168px; height: 168px; font-size: 4.5rem; }

/* ---------- Utilitas ---------- */
.cs-stack { display: flex; flex-direction: column; gap: var(--space-md); }
.cs-center { text-align: center; }

.cs-hero-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.28;
  color: #fff;
  text-shadow: 0 2px 10px rgba(4, 16, 40, 0.5);
}

.cs-hero-sub {
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* Screen reader only utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ---------- HALAMAN SPLASH (PNG 1) ---------- */
/* Spesifisitas dinaikkan agar menang atas `.page.page-active { display: block }` */
.page.cs-splash.page-active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0 !important;
  overflow: hidden;
  position: relative;
}

.cs-splash {
  position: relative;
  padding: 0 !important;
  overflow: hidden;
  width: 100%;
  height: 100%;
}

.cs-splash-title {
  display: none;
}

/* Ilustrasi menutupi seluruh halaman splash */
.cs-splash-scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
}

.cs-splash-scene img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* Tombol MULAI berbentuk kotak tegas, jelas terlihat, premium & glossy */
.cs-splash-btn {
  position: absolute;
  left: 50%;
  bottom: clamp(28px, 6vh, 48px);
  transform: translateX(-50%);
  width: clamp(220px, 72%, 330px);
  max-width: 86%;
  padding: 16px 30px;
  z-index: 5;
  border-radius: 14px;
  background: linear-gradient(180deg, #1E9BF0 0%, #1565D8 45%, #0B3E8F 100%);
  border: 2px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 6px 0 #072a6b, 0 10px 24px rgba(4, 16, 40, 0.5), 0 0 24px rgba(30, 155, 240, 0.6), inset 0 2px 0 rgba(255, 255, 255, 0.5);
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(4, 22, 56, 0.7);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--transition-fast), box-shadow var(--transition-base), filter var(--transition-base);
  animation: splashBtnGlow 2.5s ease-in-out infinite;
}

/* Kilau kaca di separuh atas tombol kotak */
.cs-splash-btn::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 4px;
  right: 4px;
  height: 44%;
  border-radius: 10px 10px 18px 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.02));
  pointer-events: none;
}

.cs-splash-btn-icon {
  width: 20px;
  height: 20px;
  stroke: #ffffff;
  transition: transform 0.2s ease;
  filter: drop-shadow(0 1px 2px rgba(4, 22, 56, 0.5));
}

.cs-splash-btn:hover {
  filter: brightness(1.1);
  transform: translateX(-50%) translateY(-2px);
  box-shadow: 0 8px 0 #072a6b, 0 14px 28px rgba(4, 16, 40, 0.6), 0 0 32px rgba(30, 155, 240, 0.85), inset 0 2px 0 rgba(255, 255, 255, 0.6);
}

.cs-splash-btn:hover .cs-splash-btn-icon {
  transform: translateX(4px);
}

.cs-splash-btn:active {
  transform: translateX(-50%) translateY(4px);
  box-shadow: 0 2px 0 #072a6b, 0 4px 10px rgba(4, 16, 40, 0.5), inset 0 2px 0 rgba(255, 255, 255, 0.35);
}

@keyframes splashBtnGlow {
  0%, 100% {
    box-shadow: 0 6px 0 #072a6b, 0 10px 24px rgba(4, 16, 40, 0.5), 0 0 20px rgba(30, 155, 240, 0.5), inset 0 2px 0 rgba(255, 255, 255, 0.5);
  }
  50% {
    box-shadow: 0 6px 0 #072a6b, 0 12px 28px rgba(4, 16, 40, 0.6), 0 0 34px rgba(30, 155, 240, 0.9), inset 0 2px 0 rgba(255, 255, 255, 0.7);
  }
}

/* ---------- LOGIN & REGISTER ---------- */
.cs-auth {
  padding-top: var(--space-lg) !important;
}

.cs-auth-card {
  max-width: 400px;
  margin: 0 auto;
  padding: var(--space-md) var(--space-lg) var(--space-lg);
  background: rgba(22, 34, 63, 0.72);
  border: 1px solid var(--glass-border);
  border-radius: 22px;
  box-shadow: 0 12px 34px rgba(4, 16, 40, 0.45);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

.cs-auth-card .cs-title-pill {
  margin-top: 22px;
}

.cs-auth-sub {
  margin-bottom: var(--space-lg);
  font-size: var(--font-sm);
  text-align: center;
  color: var(--text-secondary);
}

.cs-auth-submit {
  margin-top: var(--space-lg);
}

.cs-auth-toggle {
  margin-top: var(--space-lg);
  font-size: var(--font-sm);
  text-align: center;
  color: var(--text-secondary);
}

.cs-auth-toggle a {
  font-weight: 600;
  color: var(--teal-400);
}

/* Input bergaya desain baru */
.cs-auth-card .form-input,
.cs-form .form-input {
  background: rgba(10, 31, 69, 0.6);
  border: 1.5px solid rgba(140, 190, 255, 0.28);
  border-radius: 12px;
}

.cs-auth-card .form-input:focus,
.cs-form .form-input:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(30, 155, 240, 0.2);
  background: rgba(10, 31, 69, 0.85);
}

/* ---------- DASHBOARD / MENU (PNG 2) ---------- */
.cs-menu-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--space-xl);
}

.cs-menu-grid .cs-card-tech {
  margin-bottom: 0;
}

.cs-section-title {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.greeting-text {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
}

/* ---------- SELF-CHECK INTRO (PNG 6) ---------- */
.page.cs-screening-page.page-active {
  padding: 0 !important;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  overflow-x: hidden;
}

.cs-selfcheck-container {
  position: relative;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding: var(--space-md);
  padding-bottom: calc(var(--bottom-nav-height) + var(--space-lg));
  overflow: hidden;
}

.cs-selfcheck-container.hidden {
  display: none !important;
}

.cs-selfcheck-scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
}

.cs-selfcheck-scene img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.cs-selfcheck-actions {
  position: relative;
  z-index: 5;
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
}

.cs-screening-quiz-wrap {
  padding: var(--space-md);
  padding-bottom: calc(var(--bottom-nav-height) + var(--space-lg));
  position: relative;
  z-index: 5;
}

.cs-form {
  padding: var(--space-md) var(--space-md) var(--space-xs);
  margin-bottom: var(--space-lg);
  background: rgba(22, 34, 63, 0.65);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
}

.cs-form-note {
  margin-bottom: var(--space-md);
  font-size: var(--font-sm);
  color: var(--text-secondary);
}

.cs-mt-sm {
  margin-top: var(--space-sm);
}

/* ---------- HALAMAN KUIS (PNG 8) ---------- */
.cs-quiz-card {
  margin-bottom: var(--space-xl);
  animation: fadeInUp 0.35s ease;
}

.cs-quiz-number {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-bottom: 10px;
  border-radius: 50%;
  background: var(--blue-600);
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
}

.cs-quiz-text {
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.55;
  color: #23303F;
}

.cs-options {
  animation: fadeInUp 0.4s ease;
}

/* ---------- HALAMAN HASIL (PNG 9) ---------- */
.cs-result {
  padding-left: 0 !important;
  padding-right: 0 !important;
}

.cs-result .result-circle-wrap {
  padding: var(--space-lg) 0 var(--space-xl);
}

/* Panel putih di paruh bawah, seperti desain */
.cs-result-panel {
  padding: var(--space-xl) var(--space-md) var(--space-lg);
  background: var(--panel-white);
  border-radius: 28px 28px 0 0;
  box-shadow: 0 -8px 30px rgba(4, 16, 40, 0.45);
  text-align: center;
  color: #23303F;
  min-height: 46vh;
}

.cs-result-label {
  margin-bottom: var(--space-sm);
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #16223F;
}

.cs-result-panel .result-category {
  margin-bottom: var(--space-md);
}

.cs-result-panel .result-description {
  margin-bottom: var(--space-lg);
  font-size: 0.9rem;
  line-height: 1.6;
  color: #3C4A63;
}

/* Tombol aksi yang dirender JS ikut gaya glossy pill */
.cs-result-panel .result-actions .btn {
  width: 100%;
  margin-bottom: var(--space-sm);
  padding: 13px 26px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  background: var(--gradient-glossy);
  box-shadow: var(--shadow-glossy), inset 0 2px 0 rgba(255, 255, 255, 0.45);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 2px 5px rgba(4, 22, 56, 0.65);
}

.cs-result-panel .result-actions .btn:active {
  transform: translateY(3px);
}

/* ---------- EDU CORNER (PNG 3/4/5) ---------- */
.cs-edu-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: var(--space-xl);
  padding: 0;
  border: none;
  background: none;
  overflow: visible;
}

.cs-edu-tabs .edu-tab {
  flex: 0 0 auto;
  padding: 9px 22px;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  background: rgba(38, 54, 94, 0.7);
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-secondary);
  transition: all var(--transition-base);
}

.cs-edu-tabs .edu-tab.active {
  border-color: rgba(255, 255, 255, 0.92);
  background: var(--gradient-glossy);
  box-shadow: var(--shadow-glossy), inset 0 2px 0 rgba(255, 255, 255, 0.4);
  color: #fff;
  text-shadow: 0 2px 5px rgba(4, 22, 56, 0.6);
}

/* Kartu konten bergaya PNG 4 & 5 */
#page-edu .edu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--space-md);
}

#page-edu .edu-card {
  overflow: hidden;
  border: 1px solid rgba(140, 190, 255, 0.22);
  border-radius: 18px;
  background: rgba(22, 34, 63, 0.78);
  box-shadow: 0 10px 24px rgba(4, 16, 40, 0.42);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  cursor: pointer;
}

#page-edu .edu-card:active {
  transform: scale(0.975);
}

#page-edu .edu-card-thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #CFE8F7 0%, #A9D6EE 100%);
  overflow: hidden;
}

#page-edu .edu-card-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#page-edu .edu-card-body {
  padding: 12px 14px 16px;
}

#page-edu .edu-card-type {
  margin-bottom: 5px;
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--teal-400);
}

#page-edu .edu-card-title {
  margin-bottom: 5px;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.35;
  color: #fff;
}

#page-edu .edu-card-snippet {
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- CHAT: SPACEBOT & GURU BK (PNG 10 & 12) ---------- */
#page-chat .chat-messages {
  padding: var(--space-md) var(--space-sm);
}

.chat-bubble .bubble-time {
  opacity: 0.55;
}

/* Panel Guru BK memakai palet ungu/pink dari PNG 12 */
#chat-panel-bk .chat-bubble.received {
  background: var(--purple-300);
  color: #2C1B3A;
  box-shadow: 0 4px 12px rgba(60, 20, 90, 0.3);
}

#chat-panel-bk .chat-bubble.sent {
  background: var(--pink-500);
  color: #fff;
  box-shadow: 0 4px 12px rgba(160, 20, 90, 0.35);
}

/* Bilah input & tombol kirim */
#page-chat .chat-input-bar {
  background: rgba(16, 26, 51, 0.9);
  border-top: 1px solid var(--glass-border);
}

#page-chat .chat-input-bar .form-input {
  background: rgba(10, 31, 69, 0.7);
  border: 1.5px solid rgba(140, 190, 255, 0.28);
  border-radius: 999px;
}

#page-chat .btn-send {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--gradient-glossy);
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 4px 12px rgba(11, 62, 143, 0.45);
  color: #fff;
}

#page-chat .btn-send:active {
  transform: scale(0.93);
}

/* Balasan cepat */
#page-chat .quick-reply-btn {
  padding: 7px 15px;
  border: 1.5px solid rgba(140, 190, 255, 0.4);
  border-radius: 999px;
  background: rgba(38, 54, 94, 0.75);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* Tab AI / Guru BK */
#page-chat .chat-tabs {
  display: flex;
  gap: 8px;
  padding: var(--space-sm) var(--space-sm) 0;
}

#page-chat .chat-tab {
  flex: 1;
  padding: 10px 8px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  background: rgba(38, 54, 94, 0.7);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all var(--transition-base);
}

#page-chat .chat-tab.active {
  border-color: rgba(255, 255, 255, 0.92);
  background: var(--gradient-glossy);
  box-shadow: var(--shadow-glossy), inset 0 2px 0 rgba(255, 255, 255, 0.4);
  color: #fff;
  text-shadow: 0 2px 5px rgba(4, 22, 56, 0.6);
}

/* ---------- DAFTAR GURU BK (PNG 11) ---------- */
#counselor-list-container .counselor-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 14px;
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  background: rgba(22, 34, 63, 0.7);
  box-shadow: 0 8px 20px rgba(4, 16, 40, 0.4);
  text-align: left;
  cursor: pointer;
  transition: transform var(--transition-base), filter var(--transition-base);
}

#counselor-list-container .counselor-card:active {
  transform: scale(0.98);
}

#counselor-list-container .counselor-avatar {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0;
  border-radius: 50%;
  overflow: hidden;
  background: #CFE4F5;
  font-size: 1.9rem;
}

#counselor-list-container .counselor-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#counselor-list-container .counselor-info {
  flex: 1;
  min-width: 0;
}

/* Nama guru tampil sebagai pill biru glossy, seperti desain */
#counselor-list-container .counselor-info h4 {
  display: inline-block;
  max-width: 100%;
  margin: 0 0 5px;
  padding: 7px 18px;
  border: 1.5px solid rgba(255, 255, 255, 0.8);
  border-radius: 8px;
  background: var(--gradient-glossy);
  box-shadow: 0 4px 10px rgba(11, 62, 143, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.4);
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 4px rgba(4, 22, 56, 0.6);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#counselor-list-container .service-hours {
  display: block;
  font-size: 0.7rem;
  color: var(--text-secondary);
}

#counselor-list-container .counselor-status {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.65rem;
  color: var(--text-secondary);
}

/* ---------- HEADER CHAT GURU BK (PNG 12) ---------- */
.chat-counselor-header.cs-chat-header {
  justify-content: flex-start;
  gap: 10px;
}

.chat-counselor-header .btn-back-counselors {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(22, 34, 63, 0.08);
  font-size: 1.1rem;
  font-weight: 700;
  color: #16223F;
}

.chat-counselor-header .counselor-header-profile {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.chat-counselor-header .counselor-header-avatar {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  background: #CFE4F5;
  font-size: 1.35rem;
}

.chat-counselor-header .counselor-header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cs-chat-header-hours {
  display: block;
  font-size: 0.7rem;
  color: #5A6B87;
}

.chat-counselor-header .chat-status-badge {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  color: #3C4A63;
}

.chat-counselor-header .status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--text-tertiary);
}

.chat-counselor-header .chat-status-badge.online .status-dot,
.chat-counselor-header .status-dot.online {
  background: var(--green-500);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.8);
}

/* Bilah pemilih identitas */
.identity-selector-bar {
  background: rgba(16, 26, 51, 0.75);
  border-bottom: 1px solid var(--glass-border);
}

/* ---------- EMERGENCY / SOS ---------- */
#page-emergency .emergency-card {
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  background: rgba(22, 34, 63, 0.72);
  box-shadow: 0 8px 20px rgba(4, 16, 40, 0.4);
}

#page-emergency .e-name {
  font-family: var(--font-display);
  font-weight: 600;
}

#page-emergency .calming-message {
  border: 1px solid rgba(23, 233, 198, 0.28);
  border-radius: 18px;
  background: rgba(23, 233, 198, 0.08);
}

/* ---------- MODAL, TOAST, LOADING ---------- */
.modal-content {
  border: 1px solid var(--glass-border);
  border-radius: 24px 24px 0 0;
  background: var(--navy-900);
}

.modal-header h3 {
  font-family: var(--font-display);
  font-weight: 700;
}

.toast {
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  background: rgba(22, 34, 63, 0.95);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

.loading-overlay {
  background: rgba(16, 26, 51, 0.86);
}

.spinner {
  border-top-color: var(--blue-500);
}

/* ---------- BOTTOM NAV ---------- */
.bottom-nav {
  background: rgba(16, 26, 51, 0.92);
}

.nav-item .nav-label {
  font-family: var(--font-display);
  font-weight: 500;
}

/* ---------- Responsif ---------- */
@media (max-width: 380px) {
  .cs-title-pill { padding: 10px 22px; font-size: 1.25rem; }
  .cs-btn { padding: 12px 22px; font-size: 0.95rem; }
  .cs-btn--lg { padding: 14px 26px; font-size: 1.1rem; }
  .cs-card-tech { padding: 22px 16px; font-size: 1.15rem; }
  .cs-option-letter { width: 44px; height: 44px; font-size: 1.4rem; }
}

@media (prefers-reduced-motion: reduce) {
  .cs-btn, .cs-card-tech, .cs-option-letter, .cs-option-body {
    transition: none;
  }
}

/* ============================================
   DASHBOARD HERO CARD (Page 2 Design)
   ============================================ */
#page-dashboard {
  padding: 0 !important;
  padding-bottom: calc(var(--bottom-nav-height) + var(--space-lg)) !important;
}

.cs-hero-card {
  position: relative;
  width: 100%;
  min-height: 520px;
  height: 75vh;
  max-height: 680px;
  border-radius: 0 0 28px 28px;
  overflow: visible;
  background: #0f182e url('../images/page2-scene.png?v=2.0') center top / cover no-repeat;
  display: flex;
  flex-direction: column;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5), 0 0 24px rgba(41, 171, 226, 0.2);
}

/* Subtle overlay for text readability */
.cs-hero-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    180deg,
    rgba(15, 24, 46, 0.55) 0%,
    rgba(15, 24, 46, 0.15) 40%,
    rgba(15, 24, 46, 0.25) 70%,
    rgba(15, 24, 46, 0.7) 100%
  );
  z-index: 1;
  pointer-events: none;
}

/* --- Hero Header --- */
.cs-hero-header {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 24px 20px 12px;
}

.cs-logout-btn {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 20px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10;
}

.cs-logout-btn:hover {
  background: rgba(255, 59, 48, 0.35); /* Red glass glow on hover */
  border-color: rgba(255, 59, 48, 0.45);
  box-shadow: 0 4px 16px rgba(255, 59, 48, 0.25);
  transform: translateY(-1px);
}

.cs-logout-btn:active {
  transform: translateY(1px) scale(0.96);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.cs-logout-icon {
  font-size: 0.9rem;
}

.cs-hero-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1E9BF0, #0B3E8F);
  border: 2.5px solid rgba(111, 211, 255, 0.8);
  box-shadow: 0 0 18px rgba(111, 211, 255, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 1.5rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cs-hero-avatar:hover {
  transform: scale(1.1);
  box-shadow: 0 0 26px rgba(111, 211, 255, 0.95);
}

.cs-hero-greeting {
  color: #ffffff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}

.cs-hero-greeting h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.3;
}

.cs-hero-greeting p {
  font-size: 0.95rem;
  font-weight: 500;
  margin: 2px 0 0;
  color: #d0e8ff;
}

/* --- Robot Area --- */
.cs-hero-robot-area {
  position: relative;
  z-index: 10;
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 20px;
  pointer-events: none;
}

.cs-robot-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: auto;
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  will-change: transform;
}

/* Idle floating + swaying animation */
.cs-robot-wrapper:not(.is-moving) {
  animation: robotFloat 4s ease-in-out infinite;
}

@keyframes robotFloat {
  0%, 100% {
    transform: translateY(0px) rotate(0deg) scale(1);
  }
  25% {
    transform: translateY(-14px) rotate(3deg) scale(1.03);
  }
  50% {
    transform: translateY(-6px) rotate(-2deg) scale(1);
  }
  75% {
    transform: translateY(-18px) rotate(1deg) scale(1.02);
  }
}

.cs-robot-img {
  width: 100px;
  height: auto;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.5)) drop-shadow(0 0 20px rgba(111, 211, 255, 0.45));
  transition: filter 0.3s ease;
}

.cs-robot-wrapper.is-moving .cs-robot-img {
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.5)) drop-shadow(0 0 30px rgba(23, 233, 198, 0.7));
}

.cs-robot-glow {
  width: 70px;
  height: 12px;
  margin-top: -4px;
  background: radial-gradient(ellipse at center, rgba(111, 211, 255, 0.65) 0%, transparent 72%);
  border-radius: 50%;
  animation: glowPulse 2.5s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes glowPulse {
  0%   { transform: scale(0.7); opacity: 0.4; }
  100% { transform: scale(1.3); opacity: 1; }
}

/* --- Speech Bubble --- */
.cs-robot-bubble {
  position: absolute;
  top: -44px;
  background: rgba(16, 26, 51, 0.92);
  border: 1.5px solid #6FD3FF;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4), 0 0 12px rgba(111, 211, 255, 0.5);
  border-radius: 14px;
  padding: 6px 14px;
  white-space: nowrap;
  opacity: 0;
  transform: scale(0.85) translateY(6px);
  transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: none;
}

.cs-robot-bubble::after {
  content: '';
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 7px 7px 0 7px;
  border-style: solid;
  border-color: #6FD3FF transparent transparent transparent;
}

/* Show bubble on hover or when active */
.cs-robot-wrapper:hover .cs-robot-bubble,
.cs-robot-bubble.active-speech {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.cs-robot-bubble.active-speech {
  background: linear-gradient(135deg, #16223F, #0B3E8F);
  border-color: #17E9C6;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5), 0 0 18px rgba(23, 233, 198, 0.6);
}

.cs-bubble-text {
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
}

/* --- Quick Stats below hero --- */
#page-dashboard .quick-stats {
  padding: 16px 16px 0;
}

#page-dashboard .cs-section-title {
  padding-left: 16px;
}

#page-dashboard .history-list {
  padding: 0 16px;
}

/* ==========================================================================
   PERSONALISASI TEMA CHAT (WALLPAPER & CHAT BUBBLE)
   ========================================================================== */
#page-chat {
  --chat-wallpaper: transparent;
  --bubble-sent-bg: var(--blue-500);
  --bubble-sent-color: #ffffff;
  --bubble-sent-shadow: rgba(11, 62, 143, 0.4);
}

#page-chat .chat-messages {
  background: var(--chat-wallpaper) !important;
  transition: background 0.3s ease;
}

#page-chat .chat-bubble.sent {
  background: var(--bubble-sent-bg) !important;
  color: var(--bubble-sent-color) !important;
  box-shadow: 0 4px 12px var(--bubble-sent-shadow) !important;
  transition: background 0.3s ease, color 0.3s ease;
}

/* Paint Palette Button in Chat Header */
.chat-theme-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  cursor: pointer;
  color: #fff;
  transition: all 0.25s ease;
  margin-left: auto;
}

.chat-theme-btn:hover {
  background: rgba(255, 255, 255, 0.24);
  transform: scale(1.08) rotate(15deg);
}

.chat-theme-btn:active {
  transform: scale(0.95);
}

/* Glassmorphic Overlay Panel for Theme Customization */
.chat-theme-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(16, 26, 51, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.chat-theme-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.chat-theme-container {
  width: 100%;
  max-width: var(--max-width);
  background: linear-gradient(180deg, rgba(30, 41, 74, 0.95) 0%, rgba(18, 25, 47, 0.98) 100%);
  border-top: 2px solid rgba(255, 255, 255, 0.15);
  border-top-left-radius: 28px;
  border-top-right-radius: 28px;
  padding: 24px;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.6);
  transform: translateY(0);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.15);
}

.chat-theme-overlay.hidden .chat-theme-container {
  transform: translateY(100%);
}

.chat-theme-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 12px;
}

.chat-theme-header h4 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-close-theme {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-secondary);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 0.85rem;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-close-theme:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.chat-theme-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-height: 55vh;
  overflow-y: auto;
  padding-right: 4px;
}

.theme-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.theme-section label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.theme-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Preset circles and rectangles */
.theme-preset-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.25);
}

.theme-preset-btn:hover {
  transform: scale(1.1);
  border-color: #fff;
}

.theme-preset-btn.active {
  border-color: var(--cyan-400);
  box-shadow: 0 0 10px rgba(23, 233, 198, 0.6);
}

.theme-preset-btn.active::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 1rem;
  font-weight: bold;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.theme-custom-picker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
  background: rgba(255, 255, 255, 0.04);
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.theme-custom-picker span {
  font-size: 0.8rem;
  color: var(--text-secondary);
  flex: 1;
}

.theme-custom-picker input[type="color"] {
  -webkit-appearance: none;
  border: none;
  width: 40px;
  height: 30px;
  border-radius: 6px;
  cursor: pointer;
  background: none;
  padding: 0;
}

.theme-custom-picker input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.theme-custom-picker input[type="color"]::-webkit-color-swatch {
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  border-radius: 6px;
}

.chat-theme-footer {
  margin-top: 24px;
  display: flex;
  gap: 12px;
}

.btn-reset-theme {
  width: 100%;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-reset-theme:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
}

/* Category filter pills in Edu Corner */
.edu-category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin-bottom: var(--space-md);
  padding: 4px 0 var(--space-sm);
}

.edu-category-pill {
  flex: 0 0 auto;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.25s ease;
}

.edu-category-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  transform: translateY(-1px);
}

.edu-category-pill.active {
  background: var(--gradient-glossy);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 4px 10px rgba(21, 101, 216, 0.35);
}

/* AI Advice Panel Styles */
.cs-ai-advice-panel {
  text-align: left;
  margin-top: var(--space-md);
  margin-bottom: var(--space-lg);
  padding: var(--space-md);
  background: rgba(30, 155, 240, 0.05);
  border: 1px solid rgba(30, 155, 240, 0.15);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(30, 155, 240, 0.04);
}
.cs-ai-advice-header {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: #1e9bf0;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin-bottom: var(--space-sm);
  border-bottom: 1px solid rgba(30, 155, 240, 0.12);
  padding-bottom: var(--space-xs);
}
.cs-ai-advice-body {
  font-size: 0.85rem;
  line-height: 1.6;
  color: #3C4A63;
}
.cs-ai-advice-body h1, .cs-ai-advice-body h2, .cs-ai-advice-body h3 {
  font-family: var(--font-display);
  color: #16223F;
  margin-top: var(--space-sm);
  margin-bottom: var(--space-xs);
  font-size: 0.9rem;
}
.cs-ai-advice-body ul {
  padding-left: var(--space-md);
  margin: var(--space-xs) 0;
}
.cs-ai-advice-body li {
  margin-bottom: var(--space-xs);
}
.cs-ai-advice-body p {
  margin-bottom: var(--space-sm);
}
.shimmer-loader {
  background: linear-gradient(90deg, #eaf2f8 25%, #d4e6f1 50%, #eaf2f8 75%);
  background-size: 200% 100%;
  animation: loading-shimmer 1.5s infinite;
  height: 14px;
  border-radius: 4px;
  margin-bottom: 8px;
}
@keyframes loading-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
