/**
 * SinBar Academy - Core Design Tokens, Reset & Global Styles
 * Inspired by Framer Nudge Aesthetic: Spatial Minimalism, Obsidian Slate, Glassmorphism, & Electric Indigo Glow.
 * Fonts dimuat sekali dari HTML (preconnect), jangan @import ulang di sini.
 */

/* --- CSS Variables & Design System Tokens --- */
:root {
  /* Obsidian Dark Theme (Default) */
  --bg-app: #080c14;
  --bg-card: rgba(18, 24, 38, 0.7);
  --bg-card-hover: rgba(28, 36, 56, 0.85);
  --bg-surface: #0e1422;
  --bg-surface-elevated: #151d30;
  --bg-input: rgba(255, 255, 255, 0.04);
  --bg-glass: rgba(18, 24, 38, 0.6);
  --bg-glass-nav: rgba(8, 12, 20, 0.85);

  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-glass: rgba(255, 255, 255, 0.1);
  --border-focus: rgba(99, 102, 241, 0.6);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #080c14;

  --accent-primary: #6366f1; /* Electric Indigo */
  --accent-secondary: #8b5cf6; /* Violet Glow */
  --accent-glow: rgba(99, 102, 241, 0.35);
  --accent-glow-strong: rgba(99, 102, 241, 0.55);

  --color-success: #10b981;
  --color-success-bg: rgba(16, 185, 129, 0.12);
  --color-warning: #f59e0b;
  --color-warning-bg: rgba(245, 158, 11, 0.12);
  --color-danger: #ef4444;
  --color-danger-bg: rgba(239, 68, 68, 0.12);
  --color-info: #38bdf8;
  --color-info-bg: rgba(56, 189, 248, 0.12);

  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --radius-full: 9999px;

  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px -4px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 40px -8px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 35px -5px rgba(99, 102, 241, 0.3);

  --transition-fast: 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-smooth: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 0.5s cubic-bezier(0.16, 1, 0.3, 1);

  --max-width-main: 1240px;
}

/* --- Clean Light Theme Support --- */
[data-theme='light'] {
  --bg-app: #f8fafc;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: rgba(255, 255, 255, 0.98);
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f1f5f9;
  --bg-input: rgba(0, 0, 0, 0.04);
  --bg-glass: rgba(255, 255, 255, 0.8);
  --bg-glass-nav: rgba(248, 250, 252, 0.9);

  --border-subtle: rgba(0, 0, 0, 0.06);
  --border-glass: rgba(0, 0, 0, 0.09);
  --border-focus: rgba(79, 70, 229, 0.5);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #f8fafc;

  --accent-primary: #4f46e5;
  --accent-secondary: #7c3aed;
  --accent-glow: rgba(79, 70, 229, 0.18);
  --accent-glow-strong: rgba(79, 70, 229, 0.3);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 24px -4px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 16px 40px -8px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 35px -5px rgba(79, 70, 229, 0.18);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background-color var(--transition-smooth), color var(--transition-smooth);
}

#app {
  flex: 1;
  width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

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

img, video, iframe {
  max-width: 100%;
  display: block;
}

/* --- Typography & Headings --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-primary);
  letter-spacing: -0.025em;
}

.text-gradient {
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 50%, var(--accent-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme='light'] .text-gradient {
  background: linear-gradient(135deg, #0f172a 0%, #334155 50%, var(--accent-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.text-success { color: var(--color-success) !important; }
.text-danger { color: var(--color-danger) !important; }
.text-accent { color: var(--accent-primary) !important; }

/* --- Global Container --- */
.container {
  width: 100%;
  max-width: var(--max-width-main);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* --- Button Component System --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.75rem 1.4rem;
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
}

.btn i {
  width: 1.15rem;
  height: 1.15rem;
  stroke-width: 2.2;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: #ffffff;
  box-shadow: 0 4px 18px var(--accent-glow);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px var(--accent-glow-strong);
  filter: brightness(1.08);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-outline {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(12px);
}

.btn-outline:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
  transform: translateY(-2px);
}

.btn-outline-success {
  background: var(--color-success-bg);
  color: var(--color-success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.btn-accent-glow {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: #ffffff;
  box-shadow: 0 4px 20px var(--accent-glow);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-accent-glow:hover {
  box-shadow: 0 6px 30px var(--accent-glow-strong);
  transform: translateY(-2px);
}

.btn-lg {
  padding: 0.95rem 1.8rem;
  font-size: 1.05rem;
  border-radius: var(--radius-md);
}

.btn-sm {
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  border-radius: var(--radius-xs);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.9rem;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-icon:hover, .btn-icon.active {
  color: var(--accent-primary);
  border-color: var(--border-focus);
  background: var(--bg-card-hover);
}

.btn-icon i {
  width: 1rem;
  height: 1rem;
}

/* --- Global Toast System --- */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.9rem 1.25rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(16px);
  min-width: 280px;
  max-width: 420px;
}

.toast-item i {
  width: 1.2rem;
  height: 1.2rem;
  flex-shrink: 0;
}

.toast-item.toast-success {
  border-color: rgba(16, 185, 129, 0.4);
}
.toast-item.toast-success .toast-icon {
  color: var(--color-success);
}

.toast-item.toast-warning {
  border-color: rgba(245, 158, 11, 0.4);
}
.toast-item.toast-warning .toast-icon {
  color: var(--color-warning);
}

.toast-item.toast-info {
  border-color: rgba(99, 102, 241, 0.4);
}
.toast-item.toast-info .toast-icon {
  color: var(--accent-primary);
}

.toast-message {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 500;
}

.toast-close {
  cursor: pointer;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.toast-close:hover {
  color: var(--text-primary);
}

/* --- Search & Auth glass modals (selaras navbar) --- */
.search-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 12, 20, 0.58);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-smooth), visibility var(--transition-smooth);
}

.search-modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.search-modal-box {
  position: fixed;
  top: 11%;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  width: min(92vw, 560px);
  background: var(--bg-glass-nav);
  border: 1px solid var(--border-glass);
  border-radius: 22px;
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
  z-index: 10001;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-smooth), transform var(--transition-smooth), visibility var(--transition-smooth);
  overflow: hidden;
}

.search-modal-box.open {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.glass-icon-btn {
  width: 2.4rem;
  height: 2.4rem;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--bg-input);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.glass-icon-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-focus);
}

.glass-icon-btn svg {
  width: 1.05rem;
  height: 1.05rem;
}

.search-modal-header {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
}

.search-modal-field {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  height: 2.55rem;
  padding: 0 0.95rem;
  background: var(--bg-input);
  border: 1px solid var(--border-glass);
  border-radius: 999px;
}

.search-modal-field svg {
  width: 1.05rem;
  height: 1.05rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-modal-field input {
  flex: 1;
  min-width: 0;
  font-size: 0.92rem;
  color: var(--text-primary);
}

.search-modal-field input::placeholder {
  color: var(--text-muted);
}

.search-shortcut-hint {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 0.22rem 0.45rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  color: var(--text-secondary);
}

.search-modal-body {
  max-height: min(52vh, 400px);
  overflow-y: auto;
  padding: 0.85rem 0.85rem 1rem;
}

.search-category-section {
  margin-bottom: 1rem;
}

.search-section-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.45rem;
  padding: 0 0.35rem;
}

.search-section-title i {
  width: 0.9rem;
  height: 0.9rem;
}

.search-results-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.8rem;
  border-radius: 14px;
  background: transparent;
  transition: background var(--transition-fast);
}

.search-result-item:hover {
  background: var(--bg-input);
}

.res-icon {
  width: 2.15rem;
  height: 2.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-input);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  color: var(--accent-primary);
  flex-shrink: 0;
}

.res-icon.icon-video { color: #38bdf8; }
.res-icon.icon-article { color: #10b981; }
.res-icon.icon-quiz { color: #f59e0b; }

.res-icon i {
  width: 1.1rem;
  height: 1.1rem;
}

.res-body { flex: 1; min-width: 0; }

.res-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
}

.res-sub {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.res-arrow {
  width: 1rem;
  height: 1rem;
  color: var(--text-muted);
}

.search-empty-state {
  text-align: center;
  padding: 2.2rem 1rem;
  color: var(--text-muted);
}

.search-empty-state i {
  width: 2.2rem;
  height: 2.2rem;
  margin-bottom: 0.7rem;
  opacity: 0.6;
}

.search-empty-state h4 {
  font-size: 1.05rem;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.search-empty-state p {
  font-size: 0.88rem;
}

.auth-modal-box {
  position: fixed;
  top: 50%;
  left: 50%;
  width: min(92vw, 400px);
  padding: 1.65rem 1.4rem 1.35rem;
  transform: translate(-50%, calc(-50% + 8px));
  z-index: 10020;
  overflow: visible;
  background: var(--bg-surface);
}

.search-modal-box.auth-modal-box.open {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%);
}

.auth-modal-close {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
}

.auth-modal-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1.15rem;
}

.auth-modal-box #authModalTitle {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.3rem;
}

.auth-modal-sub {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  line-height: 1.45;
}

.auth-hint {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.auth-inline-error,
.auth-inline-success {
  margin: 0;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  font-size: 0.82rem;
  line-height: 1.4;
}

.auth-inline-error {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.28);
}

.auth-inline-success {
  background: rgba(16, 185, 129, 0.12);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.28);
}

.auth-modal-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.auth-field span {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.auth-input {
  width: 100%;
  height: 2.65rem;
  padding: 0 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border-glass);
  border-radius: 999px;
  color: var(--text-primary);
  font-size: 0.92rem;
}

.auth-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.auth-submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2.7rem;
  margin-top: 0.25rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: #fff;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 18px var(--accent-glow);
}

.auth-submit-btn:hover {
  box-shadow: 0 10px 24px var(--accent-glow-strong);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: lowercase;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.auth-google-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  height: 2.65rem;
  border-radius: 999px;
  background: var(--bg-input);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.auth-google-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.auth-toggle-row {
  text-align: center;
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.auth-toggle-row a {
  color: var(--accent-primary);
  font-weight: 700;
}

@media (max-width: 520px) {
  .search-shortcut-hint { display: none; }
  .search-modal-box { top: 8%; }
  .auth-modal-box { padding: 1.4rem 1.15rem 1.2rem; }
}

/* --- Auth gate (belum login) --- */
.auth-gate-page {
  min-height: calc(100vh - 8rem);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem 4rem;
}

.auth-gate-card {
  max-width: 420px;
  width: 100%;
  text-align: center;
  padding: 2rem 1.5rem;
  border-radius: 18px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.auth-gate-card .brand-icon-box {
  margin: 0 auto 1rem;
}

.auth-gate-card h2 {
  margin: 0 0 0.6rem;
  font-size: 1.35rem;
  color: var(--text-primary);
}

.auth-gate-card p {
  margin: 0 0 1.25rem;
  color: var(--text-secondary);
  line-height: 1.55;
  font-size: 0.95rem;
}

.auth-gate-spinner {
  width: 1.75rem;
  height: 1.75rem;
  margin: 0 auto 0.85rem;
  border: 2px solid var(--border-subtle);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: authGateSpin 0.7s linear infinite;
}

@keyframes authGateSpin {
  to { transform: rotate(360deg); }
}

/* --- Keyframe Animations --- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes slideIn {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(30px); }
}

.animate-fade-in { animation: fadeIn 0.5s ease forwards; }
.animate-fade-in-up { animation: fadeInUp 0.55s ease forwards; }
.animate-fade-in-up-delay { animation: fadeInUp 0.55s ease 0.16s forwards; opacity: 0; }
.animate-fade-in-up-delay-2 { animation: fadeInUp 0.55s ease 0.32s forwards; opacity: 0; }
.animate-fade-in-up-delay-3 { animation: fadeInUp 0.55s ease 0.48s forwards; opacity: 0; }
.animate-slide-in { animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.animate-slide-out { animation: slideOut 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards; }

.reveal-up {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.reveal-up.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-up.reveal-done {
  opacity: 1;
  transform: none;
  transition: none;
}

@media (prefers-reduced-motion: reduce) {
  .animate-fade-in,
  .animate-fade-in-up,
  .animate-fade-in-up-delay,
  .animate-fade-in-up-delay-2,
  .animate-fade-in-up-delay-3 {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .reveal-up,
  .reveal-up.is-visible,
  .reveal-up.reveal-done {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
