/* ==============================================================================
   Member Area Gudang Konten - Premium Design System (UI UX Pro Max)
   - Brand: Gudang Konten (Warm Orange Accent, AA Contrast)
   - Calm, expensive, app-like feel. Zero AI slop.
   - Dual theme: Warm off-white (Light) & Deep bluish-black (Dark).
   - Fonts: Plus Jakarta Sans (Headings) + DM Sans (Body). Tabular-nums for digits.
   - 4px/8px scale, 8/12/16/24px radii, 1px dividing borders.
   ============================================================================== */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400..700;1,9..40,400..700&family=Plus+Jakarta+Sans:wght@500;600;700;800&display=swap');

:root {
  /* Brand Typography */
  --font-display: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-body: 'DM Sans', -apple-system, system-ui, sans-serif;

  /* Spacing Scale (4px/8px grid) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;

  /* Radius Scale */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-full: 9999px;

  /* Transitions & Motion (Emil Kowalski Principles) */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-emil: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-exit: cubic-bezier(0.4, 0, 1, 1);
  --duration-fast: 150ms;
  --duration-ui: 200ms;
  --duration-enter: 240ms;
  --duration-exit: 170ms;
  --duration: 0.2s;

  /* -------------------------------------------------------------
     LIGHT THEME (Warm off-white, crisp cards, near-black text)
     ------------------------------------------------------------- */
  --bg-page: #F8F8FA;
  --bg-surface: #FFFFFF;
  --bg-surface-subtle: #F3F4F6;
  --bg-surface-hover: #F9FAFB;
  --bg-input: #FFFFFF;

  --border: #E5E7EB;
  --border-subtle: #EEF0F2;
  --border-focus: #E8590C;

  --text-main: #111827;         /* Contrast ~16:1 against #FFF */
  --text-secondary: #374151;    /* Contrast ~9.5:1 */
  --text-muted: #525B6A;        /* Contrast ~5.5:1 (WCAG AA pass) */
  --text-subtle: #9CA3AF;
  --text-inverse: #FFFFFF;

  /* Brand Warm Orange (Derived from landing page) */
  --accent: #E8590C;            /* Primary brand accent */
  --accent-text: #C2410C;       /* High-contrast text on light */
  --accent-hover: #9A3412;
  --accent-active: #7C2D12;
  --accent-subtle: #FFF4ED;
  --accent-border: #FDBA74;
  --accent-btn: #D9480F;
  --accent-glow: rgba(232, 89, 12, 0.15);

  /* Status Colors (AA-Compliant) */
  --success: #15803D;
  --success-text: #166534;
  --success-subtle: #F0FDF4;
  --success-border: #BBF7D0;

  --warning: #B45309;
  --warning-subtle: #FEF3C7;
  --warning-border: #FDE68A;

  --danger: #B91C1C;
  --danger-subtle: #FEF2F2;
  --danger-border: #FECACA;

  /* Subtle elevations for floating elements only */
  --shadow-float: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --shadow-toast: 0 14px 30px rgba(0, 0, 0, 0.12);
  --shadow-sheet: 0 -10px 30px rgba(0, 0, 0, 0.08);

  /* Safe Area for iOS bottom nav */
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* -------------------------------------------------------------
   DARK THEME (Deep bluish-black #0B0F17, not pitch black)
   ------------------------------------------------------------- */
[data-theme="dark"] {
  --bg-page: #0B0F17;
  --bg-surface: #141B28;
  --bg-surface-subtle: #1B2435;
  --bg-surface-hover: #1E293B;
  --bg-input: #101622;

  --border: #232E42;
  --border-subtle: #192233;
  --border-focus: #FB923C;

  --text-main: #F3F4F6;
  --text-secondary: #D1D5DB;
  --text-muted: #9CA3AF;
  --text-subtle: #6B7280;
  --text-inverse: #0B0F17;

  /* Brand Warm Orange (Tuned for dark background luminescence) */
  --accent: #FB923C;
  --accent-text: #FDBA74;
  --accent-hover: #F97316;
  --accent-active: #EA580C;
  --accent-subtle: rgba(249, 115, 22, 0.14);
  --accent-border: rgba(251, 146, 60, 0.3);
  --accent-btn: #EA580C;
  --accent-glow: rgba(251, 146, 60, 0.2);

  /* Status Colors */
  --success: #4ADE80;
  --success-text: #86EFAC;
  --success-subtle: rgba(74, 222, 128, 0.12);
  --success-border: rgba(74, 222, 128, 0.25);

  --warning: #FBBF24;
  --warning-subtle: rgba(251, 191, 36, 0.12);
  --warning-border: rgba(251, 191, 36, 0.25);

  --danger: #F87171;
  --danger-subtle: rgba(248, 113, 113, 0.12);
  --danger-border: rgba(248, 113, 113, 0.25);

  --shadow-float: 0 16px 36px rgba(0, 0, 0, 0.45);
  --shadow-toast: 0 20px 40px rgba(0, 0, 0, 0.55);
  --shadow-sheet: 0 -12px 36px rgba(0, 0, 0, 0.5);
}

/* =============================================================
   BASE STYLES & RESET
   ============================================================= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
}

/* Theme Crossfade: 200ms smooth crossfade ONLY when toggled, ZERO flicker on initial load */
html.theme-transitioning,
html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
  transition: background-color var(--duration-ui) var(--ease-emil),
              border-color var(--duration-ui) var(--ease-emil),
              color var(--duration-ui) var(--ease-emil),
              box-shadow var(--duration-ui) var(--ease-emil) !important;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.55;
  min-height: 100vh;
  width: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-bottom: calc(72px + var(--safe-bottom));
}

@media (min-width: 1024px) {
  body {
    padding-bottom: 0;
  }
}

img, svg, video, canvas, audio, iframe, embed, object {
  max-width: 100%;
  height: auto;
}

p, span, a, h1, h2, h3, h4, h5, h6, label, div {
  overflow-wrap: anywhere;
}

/* Ensure flex/grid children default to min-width: 0 */
.grid > *,
.card,
.card > *,
.folder-row > *,
.ebook-card > *,
.niche-card > *,
.timeline-steps > *,
.profile-group > * {
  min-width: 0;
}

h1, .h1 {
  font-family: var(--font-display);
  color: var(--text-main);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
  font-size: 1.65rem; /* ~24.75px on 15px base */
}

@media (min-width: 768px) {
  h1, .h1 {
    font-size: 1.85rem;
  }
}

h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--text-main);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

/* Tabular figures for numbers, counters & stats */
.tabular-nums, .stat-value, .folder-num, .price, .badge, [data-counter] {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

a {
  color: var(--accent-text);
  text-decoration: none;
  transition: color var(--duration) var(--ease);
}

a:hover {
  color: var(--accent-hover);
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* Focus outline accessibility */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Touch Target Minimum 44px on interactive elements */
button, a.btn, input, select, .btn, .touch-target {
  min-height: 44px;
}

/* =============================================================
   LAYOUT STRUCTURE (Mobile-First with Desktop Sidebar)
   ============================================================= */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* Desktop Sidebar (< 1024px: hidden; >= 1024px: fixed left) */
.app-sidebar {
  display: none;
}

@media (min-width: 1024px) {
  .app-sidebar {
    display: flex;
    flex-direction: column;
    width: 250px;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    padding: var(--sp-6) var(--sp-4);
  }
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0 var(--sp-2) var(--sp-6);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--sp-4);
  min-height: 44px;
}

.brand-logo-img {
  height: 32px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
}

/* Light/Dark logo switching */
.logo-light { display: block; }
.logo-dark { display: none; }

[data-theme="dark"] .logo-light { display: none; }
[data-theme="dark"] .logo-dark { display: block; }

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  flex: 1;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px 14px;
  border-radius: var(--r-md);
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all var(--duration) var(--ease);
  min-height: 44px;
}

.sidebar-link svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.85;
  color: var(--text-muted);
  transition: color var(--duration) var(--ease);
}

.sidebar-link:hover {
  background-color: var(--bg-surface-subtle);
  color: var(--text-main);
}

.sidebar-link:hover svg {
  color: var(--accent);
}

.sidebar-link.active {
  background-color: var(--accent-subtle);
  color: var(--accent-text);
  border: 1px solid var(--accent-border);
}

.sidebar-link.active svg {
  color: var(--accent);
}

.sidebar-footer {
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

/* Main Content Area */
.app-main {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
}

@media (min-width: 1024px) {
  .app-main {
    margin-left: 250px;
  }
}

/* Mobile Top Bar */
.mobile-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
  padding: 0 var(--sp-4);
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
}

@media (min-width: 1024px) {
  .mobile-topbar {
    display: none;
  }
}

.content-wrapper {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: var(--sp-5) var(--sp-4) var(--sp-8);
}

@media (min-width: 768px) {
  .content-wrapper {
    padding: var(--sp-8) var(--sp-6) var(--sp-12);
  }
}

/* =============================================================
   MOBILE BOTTOM NAVIGATION (5 Tabs)
   ============================================================= */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(62px + var(--safe-bottom));
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-around;
  padding: 6px 4px var(--safe-bottom);
  z-index: 50;
  backdrop-filter: blur(8px);
}

@media (min-width: 1024px) {
  .bottom-nav {
    display: none;
  }
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 48px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-family: var(--font-display);
  font-weight: 600;
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-emil);
  position: relative;
  gap: 3px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.8;
  transition: transform var(--duration-fast) var(--ease-emil), stroke-width var(--duration-fast) var(--ease-emil);
}

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

.bottom-nav-item.active {
  color: var(--accent);
}

.bottom-nav-item.active svg {
  stroke-width: 2.2;
}

/* Sliding active indicator (Emil Kowalski transform shift) */
.bottom-nav-indicator {
  position: absolute;
  top: 0;
  left: 0;
  height: 3px;
  background-color: var(--accent);
  border-radius: var(--r-full);
  transition: transform var(--duration-ui) var(--ease-emil), width var(--duration-ui) var(--ease-emil);
  pointer-events: none;
  z-index: 2;
  opacity: 0;
}

/* =============================================================
   CARDS & PANELS (Border 1px, No gratuitous shadows)
   ============================================================= */
.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  position: relative;
  transition: border-color var(--duration) var(--ease);
  min-width: 0;
}

@media (min-width: 768px) {
  .card {
    padding: var(--sp-6);
  }
}

.card:hover {
  border-color: var(--border-focus);
}

.card-subtle {
  background-color: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
}

.card-highlight {
  border: 1px solid var(--accent-border);
  background-color: var(--accent-subtle);
}

/* =============================================================
   BUTTONS & TOUCH TARGETS (Min 44px)
   ============================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 44px;
  padding: 10px 18px;
  border-radius: var(--r-md);
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform var(--duration-fast) var(--ease-emil), background-color var(--duration-fast) var(--ease), border-color var(--duration-fast) var(--ease), color var(--duration-fast) var(--ease);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

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

.btn svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
  flex-shrink: 0;
}

.btn-primary {
  background-color: var(--accent-btn);
  color: #FFFFFF;
}

.btn-primary:active {
  background-color: var(--accent-active);
}

.btn-outline {
  background-color: transparent;
  border-color: var(--border);
  color: var(--text-main);
}

.btn-secondary {
  background-color: var(--bg-surface-subtle);
  border-color: var(--border);
  color: var(--text-main);
}

@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover {
    background-color: var(--accent-hover);
    color: #FFFFFF;
  }
  .btn-outline:hover {
    background-color: var(--bg-surface-subtle);
    border-color: var(--border-focus);
    color: var(--text-main);
  }
  .btn-secondary:hover {
    background-color: var(--bg-surface-hover);
    border-color: var(--accent-border);
  }
}

.btn-sm {
  min-height: 38px;
  padding: 8px 14px;
  font-size: 0.82rem;
  border-radius: var(--r-sm);
}

.btn-block {
  width: 100%;
}

/* =============================================================
   BADGES & CHIPS
   ============================================================= */
.chip, .badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--r-full);
  font-family: var(--font-display);
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.2;
}

.chip svg, .badge svg {
  width: 12px;
  height: 12px;
  stroke-width: 2.2;
}

.badge-owned, .badge-success {
  background-color: var(--success-subtle);
  color: var(--success-text);
  border: 1px solid var(--success-border);
}

.badge-locked {
  background-color: var(--bg-surface-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.badge-brand, .badge-warning {
  background-color: var(--accent-subtle);
  color: var(--accent-text);
  border: 1px solid var(--accent-border);
}

.badge-danger {
  background-color: var(--danger-subtle);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

/* =============================================================
   FORM ELEMENTS & INPUTS
   ============================================================= */
.form-group {
  margin-bottom: var(--sp-4);
}

.form-label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: var(--sp-2);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  background-color: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.92rem;
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: var(--sp-1);
}

/* Password Toggle Wrapper */
.password-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.password-input-wrap input {
  padding-right: 48px;
}

.btn-toggle-pw {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 44px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.btn-toggle-pw:hover {
  color: var(--text-main);
}

/* =============================================================
   SEGMENTED CONTROL (Theme Switcher / Tabs)
   ============================================================= */
.segmented-control {
  display: flex;
  background-color: var(--bg-surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 3px;
  gap: 3px;
}

.segmented-btn {
  flex: 1;
  min-height: 38px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: calc(var(--r-md) - 2px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all var(--duration) var(--ease);
}

.segmented-btn svg {
  width: 15px;
  height: 15px;
  stroke-width: 1.85;
}

.segmented-btn.active {
  background-color: var(--bg-surface);
  color: var(--text-main);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

[data-theme="dark"] .segmented-btn.active {
  background-color: var(--bg-surface-hover);
  color: var(--text-main);
}

/* =============================================================
   GRID SCALE (Mobile 2 cols, Desktop 4 cols)
   ============================================================= */
.grid {
  display: grid;
  gap: 12px;
}

@media (min-width: 768px) {
  .grid {
    gap: var(--sp-4);
  }
}

/* Niches Grid: 2 columns on mobile, 4 columns on desktop */
.grid-niches {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (min-width: 1024px) {
  .grid-niches {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--sp-5);
  }
}

/* E-Books Grid: 1 column on mobile (<=640px), 2 columns on tablet (641-1023px), 4 columns on desktop (>=1024px) */
.grid-ebooks {
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 641px) {
  .grid-ebooks {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }
}

@media (min-width: 1024px) {
  .grid-ebooks {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--sp-5);
  }
}

/* 2-col balanced responsive grid & dashboard owned niches */
.grid-2,
.grid-cols-2,
.grid-dashboard-owned {
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 641px) {
  .grid-2,
  .grid-cols-2,
  .grid-dashboard-owned {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }
}

/* 3-col stats grid */
.grid-3,
.grid-cols-3 {
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 640px) {
  .grid-3,
  .grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }
}

/* =============================================================
   NICHE CARD (4:5 Aspect Ratio, Clean hierarchy)
   ============================================================= */
.niche-card {
  display: flex;
  flex-direction: column;
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: border-color var(--duration-fast) var(--ease), box-shadow var(--duration-fast) var(--ease), transform var(--duration-fast) var(--ease-emil);
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

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

@media (hover: hover) and (pointer: fine) {
  .niche-card:hover {
    border-color: var(--border-focus);
  }
}

/* Locked Card Shake: ±3px, 180ms ease-out */
@keyframes shakeLocked {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-3px); }
  40% { transform: translateX(3px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

.niche-card.is-shaking {
  animation: shakeLocked 180ms cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

/* Scroll Reveal (reveal-on-scroll): GPU translateY + fade */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 320ms var(--ease-emil), transform 320ms var(--ease-emil);
  will-change: opacity, transform;
}

.reveal-on-scroll.in-view {
  opacity: 1;
  transform: translateY(0);
}

.niche-card-cover-wrap {
  width: 100%;
  aspect-ratio: 4 / 5;
  background-color: var(--bg-surface-subtle);
  position: relative;
  overflow: hidden;
}

.niche-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s var(--ease);
}

@media (hover: hover) and (pointer: fine) {
  .niche-card:hover .niche-card-img {
    transform: scale(1.02);
  }
}

.niche-card-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
}

.niche-card-content {
  padding: var(--sp-3) var(--sp-4) var(--sp-4);
  display: flex;
  flex-direction: column;
  flex: 1;
}

.niche-card-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text-main);
  line-height: 1.3;
}

.niche-card-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: var(--sp-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.niche-progress-line {
  width: 100%;
  height: 4px;
  background-color: var(--bg-surface-subtle);
  border-radius: var(--r-full);
  overflow: hidden;
  margin-top: auto;
}

/* Smooth Hardware-Accelerated Progress Bar (scaleX) */
.niche-progress-fill {
  height: 100%;
  width: 100%;
  background-color: var(--accent);
  border-radius: var(--r-full);
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 250ms var(--ease-emil);
  will-change: transform;
}

/* Counter text fade transition */
.counter-fade {
  display: inline-block;
  transition: opacity var(--duration-fast) var(--ease-emil), transform var(--duration-fast) var(--ease-emil);
}

.counter-fade.is-updating {
  opacity: 0.25;
  transform: translateY(-2px);
}

/* Locked Card State (Tempting & Full-Color) */
.niche-card.is-locked .niche-card-cover-wrap {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-md) var(--r-md) 0 0;
}

.niche-card.is-locked .niche-card-img {
  filter: none;
  opacity: 1;
  transform-origin: center center;
  transition: transform 240ms cubic-bezier(0.23, 1, 0.32, 1);
}

@media (hover: hover) and (pointer: fine) {
  .niche-card.is-locked:hover .niche-card-img {
    transform: scale(1.03);
  }
}

@media (prefers-reduced-motion: reduce) {
  .niche-card.is-locked:hover .niche-card-img {
    transform: none;
  }
}

/* Gradient Overlay Gelap di Bagian Bawah Cover untuk Keterbacaan */
.niche-card-cover-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(11, 15, 23, 0.82) 0%, rgba(11, 15, 23, 0.25) 45%, transparent 70%);
  pointer-events: none;
  z-index: 2;
}

/* Chip Gembok & Terkunci di Pojok Kanan Atas */
.niche-chip-locked {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: var(--r-full);
  padding: 3px 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  z-index: 3;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  pointer-events: none;
}

/* Chip Badge Khusus Niche di Pojok Kiri Atas */
.niche-chip-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--accent);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 800;
  border-radius: var(--r-full);
  padding: 3px 9px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  z-index: 3;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  letter-spacing: 0.02em;
  pointer-events: none;
}

/* Folder List Item pada Panel Niche Terkunci */
.locked-sheet-folder-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.locked-sheet-folder-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  font-size: 0.82rem;
}

.locked-sheet-folder-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.locked-sheet-folder-title {
  font-weight: 700;
  color: var(--text-main);
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: 0.84rem;
  line-height: 1.35;
}

.locked-sheet-folder-badge {
  font-size: 0.74rem;
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: var(--r-full);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* Dashboard Locked Niche Scroll-Snap Carousel */
.locked-niche-carousel {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 12px;
  margin: 0;
  padding-left: 0;
  padding-right: 0;
  scrollbar-width: thin;
  max-width: 100%;
}

.locked-niche-carousel > .niche-card {
  flex: 0 0 230px;
  max-width: 250px;
  scroll-snap-align: start;
}

@media (min-width: 768px) {
  .locked-niche-carousel {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    overflow-x: visible;
    scroll-snap-type: none;
    margin: 0;
    padding: 0;
    gap: 16px;
  }

  .locked-niche-carousel > .niche-card {
    flex: auto;
    max-width: none;
  }
}

/* =============================================================
   E-BOOK CARD (3:4 Aspect Ratio)
   - <=640px: 1 column horizontal card (96px cover, full-width 44px button)
   - 641-1023px: 2 columns vertical card
   - >=1024px: 4 columns vertical card
   ============================================================= */
.ebook-card {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 12px;
  gap: 12px;
  overflow: hidden;
  transition: all var(--duration) var(--ease);
  min-width: 0;
}

.ebook-card:hover {
  border-color: var(--border-focus);
}

.ebook-cover-wrap {
  width: 96px;
  min-width: 96px;
  aspect-ratio: 3 / 4;
  border-radius: 12px;
  background-color: var(--bg-surface-subtle);
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}

.ebook-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  transition: transform 0.3s var(--ease);
}

.ebook-cover-fallback {
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent-subtle), var(--bg-surface-elevated));
  color: var(--accent-text);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.5rem;
  border-radius: 12px;
}

.ebook-card:hover .ebook-cover-img {
  transform: scale(1.02);
}

.ebook-content {
  padding: 0;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.ebook-badge-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.ebook-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 4px;
  line-height: 1.3;
  color: var(--text-main);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.ebook-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.35;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.ebook-action-wrap {
  margin-top: auto;
  width: 100%;
}

.ebook-btn-download {
  width: 100%;
  min-height: 44px;
  height: 44px;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0 12px;
  justify-content: center;
  border-radius: var(--r-md);
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

@media (min-width: 641px) {
  .ebook-card {
    flex-direction: column;
    padding: 0;
    gap: 0;
  }
  .ebook-cover-wrap {
    width: 100%;
    min-width: 0;
    border-radius: 0;
  }
  .ebook-cover-img,
  .ebook-cover-fallback {
    border-radius: 0;
  }
  .ebook-content {
    padding: var(--sp-4);
  }
  .ebook-badge-label {
    display: inline-block;
    margin-bottom: 4px;
  }
  .ebook-desc {
    margin-bottom: var(--sp-4);
  }
}

/* =============================================================
   DETAIL NICHE & FOLDER LIST ROWS
   ============================================================= */
.niche-detail-header {
  margin-bottom: 20px;
  padding: 0;
  overflow: hidden;
}

.niche-detail-header-inner {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  min-width: 0;
}

.niche-detail-cover {
  width: 96px;
  min-width: 96px;
  aspect-ratio: 4 / 5;
  background-color: var(--bg-surface-subtle);
  border-right: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.niche-detail-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.niche-detail-info {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

@media (min-width: 641px) {
  .niche-detail-cover {
    width: 140px;
    min-width: 140px;
  }
  .niche-detail-info {
    padding: 24px 28px;
  }
}

.folder-row {
  display: flex;
  flex-direction: column;
  padding: 14px 16px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: 12px;
  gap: 12px;
  transition: all var(--duration) var(--ease);
  min-width: 0;
}

.folder-row:hover {
  border-color: var(--border-focus);
}

.folder-row.is-done {
  border-color: var(--success-border);
  background-color: var(--success-subtle);
}

.folder-row-main {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  min-width: 0;
}

.folder-num {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--accent-text);
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: var(--r-sm);
  background-color: var(--accent-subtle);
  border: 1px solid var(--accent-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.folder-title-wrap {
  flex: 1;
  min-width: 0;
}

.folder-title-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.96rem;
  color: var(--text-main);
  line-height: 1.35;
  margin: 0 0 4px;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
}

.folder-sub-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  overflow-wrap: anywhere;
}

.folder-sub-divider {
  color: var(--text-subtle);
}

.folder-opened-date {
  color: var(--success-text);
  font-weight: 600;
}

.folder-row-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.folder-row.is-done .folder-row-actions {
  border-top-color: var(--success-border);
}

.folder-progress-toggle-form {
  margin: 0;
}

@media (max-width: 375px) {
  .folder-row-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .folder-row-actions .btn-open-drive {
    width: 100%;
  }
  .folder-progress-toggle-form {
    width: 100%;
  }
  .checkbox-touch-target {
    width: 100%;
  }
}

@media (min-width: 769px) {
  .folder-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    gap: 16px;
  }
  .folder-row-main {
    align-items: center;
    flex: 1;
    min-width: 0;
  }
  .folder-row-actions {
    width: auto;
    padding-top: 0;
    border-top: none;
    flex-shrink: 0;
    justify-content: flex-end;
    gap: 14px;
  }
  .folder-row.is-done .folder-row-actions {
    border-top: none;
  }
}

/* Large touch-friendly checkbox (Min 44x44px target) */
.checkbox-touch-target {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  min-width: 44px;
  cursor: pointer;
  user-select: none;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.custom-checkbox {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  background-color: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--duration-fast) var(--ease), border-color var(--duration-fast) var(--ease), transform var(--duration-fast) var(--ease-emil);
}

.custom-checkbox svg path {
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
  transition: stroke-dashoffset 200ms cubic-bezier(0.23, 1, 0.32, 1);
}

input[type="checkbox"]:checked + .custom-checkbox {
  background-color: var(--success);
  border-color: var(--success);
  color: #FFFFFF;
  animation: checkboxPop 160ms cubic-bezier(0.23, 1, 0.32, 1);
}

input[type="checkbox"]:checked + .custom-checkbox svg path {
  stroke-dashoffset: 0;
}

@keyframes checkboxPop {
  0% { transform: scale(0.92); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

/* =============================================================
   PANDUAN / ONBOARDING STEP TIMELINE
   ============================================================= */
.timeline-steps {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--sp-6);
  padding-left: 0;
}

.timeline-steps::before {
  content: '';
  position: absolute;
  top: 14px;
  bottom: 24px;
  left: 15px;
  width: 2px;
  background-color: var(--border);
}

@media (min-width: 641px) {
  .timeline-steps {
    padding-left: 16px;
  }
  .timeline-steps::before {
    left: 31px;
  }
}

.step-item {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-4);
  position: relative;
}

.step-num-badge {
  width: 32px;
  height: 32px;
  border-radius: var(--r-full);
  background-color: var(--bg-surface);
  border: 2px solid var(--accent);
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  z-index: 2;
}

.step-content {
  flex: 1;
}

.step-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.step-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* 16:9 Video Wrapper */
.video-ratio-wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--r-md);
  overflow: hidden;
  background-color: #000000;
  margin-top: var(--sp-3);
  border: 1px solid var(--border);
}

.video-ratio-wrap iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* =============================================================
   PROFIL INSET LIST GROUPS
   ============================================================= */
.profile-group {
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: var(--sp-5);
}

.profile-group-header {
  padding: 14px 18px 8px;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.profile-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-top: 1px solid var(--border-subtle);
  min-height: 48px;
}

.profile-row-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-main);
}

/* =============================================================
   FLOATING WHATSAPP BUTTON (Small, does not cover bottom nav)
   - Appears after page load with fade + translateY 8px (250ms delay)
   - Never moves continuously (clean & calm)
   ============================================================= */
.whatsapp-fab-float {
  position: fixed;
  bottom: calc(72px + var(--safe-bottom) + 12px);
  right: 16px;
  width: 44px;
  height: 44px;
  background-color: #25D366;
  color: #FFFFFF;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-float);
  z-index: 45;
  text-decoration: none;
  opacity: 0;
  transform: translateY(8px);
  animation: fabEnter 300ms var(--ease-emil) forwards;
  animation-delay: 250ms;
  transition: transform var(--duration-fast) var(--ease-emil), background-color var(--duration-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}

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

.whatsapp-fab-float:active {
  transform: scale(0.96);
}

@media (min-width: 1024px) {
  .whatsapp-fab-float {
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
  }
}

@media (hover: hover) and (pointer: fine) {
  .whatsapp-fab-float:hover {
    transform: scale(1.06);
    color: #FFFFFF;
  }
}

.whatsapp-fab-float svg {
  width: 24px;
  height: 24px;
}

/* =============================================================
   LOCKED BOTTOM SHEET / MODAL
   - Enter: translateY from bottom + overlay fade (240ms ease-emil)
   - Exit: exits faster than enters (170ms ease-exit)
   - Drag down to dismiss support
   ============================================================= */
.sheet-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(11, 15, 23, 0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  opacity: 0;
  transition: opacity var(--duration-enter) var(--ease-emil);
}

.sheet-backdrop.active {
  display: flex;
  opacity: 1;
}

.sheet-backdrop.closing {
  opacity: 0;
  transition: opacity var(--duration-exit) var(--ease-exit);
}

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: var(--sp-6) var(--sp-5) calc(var(--sp-8) + var(--safe-bottom));
  box-shadow: var(--shadow-sheet);
  transform: translateY(100%);
  transition: transform var(--duration-enter) var(--ease-emil);
  z-index: 101;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 auto;
  touch-action: pan-y;
  will-change: transform;
}

@media (min-width: 640px) {
  .bottom-sheet {
    bottom: auto;
    top: 50%;
    transform: translateY(-50%) scale(0.96);
    border-radius: var(--r-xl);
    border: 1px solid var(--border);
    padding: var(--sp-8);
    max-height: 88vh;
    max-width: 580px;
    overflow-y: auto;
    opacity: 0;
    transition: transform var(--duration-enter) var(--ease-emil), opacity var(--duration-enter) var(--ease-emil);
  }
}

.sheet-backdrop.active .bottom-sheet {
  transform: translateY(0);
}

@media (min-width: 640px) {
  .sheet-backdrop.active .bottom-sheet {
    transform: translateY(-50%) scale(1);
    opacity: 1;
  }
}

/* Faster exit on close (170ms) */
.sheet-backdrop.closing .bottom-sheet {
  transform: translateY(100%);
  transition: transform var(--duration-exit) var(--ease-exit);
}

@media (min-width: 640px) {
  .sheet-backdrop.closing .bottom-sheet {
    transform: translateY(-50%) scale(0.96);
    opacity: 0;
    transition: transform var(--duration-exit) var(--ease-exit), opacity var(--duration-exit) var(--ease-exit);
  }
}

.sheet-drag-handle {
  width: 36px;
  height: 4px;
  border-radius: var(--r-full);
  background-color: var(--border);
  margin: 0 auto var(--sp-4);
  cursor: grab;
}

@media (min-width: 640px) {
  .sheet-drag-handle {
    display: none;
  }
}

/* =============================================================
   AUTH 2-PANEL LAYOUT (Desktop split / Mobile single)
   ============================================================= */
.auth-split-wrapper {
  min-height: 100vh;
  display: flex;
  width: 100%;
}

.auth-brand-panel {
  display: none;
  flex: 1;
  background-color: #0E131F;
  border-right: 1px solid #1E2738;
  padding: var(--sp-12);
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

@media (min-width: 1024px) {
  .auth-brand-panel {
    display: flex;
  }
}

.auth-form-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6) var(--sp-4);
  position: relative;
  width: 100%;
}

.auth-card-inner {
  width: 100%;
  max-width: 400px;
}

/* =============================================================
   NOTIFICATIONS / FLASH ALERTS, FORM MOTION & SPINNER
   - Error appears with fade + translateY, shakes ±3px once
   - Loading button displays small spinner without altering width
   ============================================================= */
.alert {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  margin-bottom: var(--sp-5);
  font-size: 0.88rem;
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  border: 1px solid transparent;
  animation: alertEnter 220ms var(--ease-emil) both;
}

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

.alert-success {
  background-color: var(--success-subtle);
  color: var(--success-text);
  border-color: var(--success-border);
}

.alert-error {
  background-color: var(--danger-subtle);
  color: var(--danger);
  border-color: var(--danger-border);
  animation: alertEnterShake 240ms var(--ease-emil) both;
}

@keyframes alertEnterShake {
  0% { opacity: 0; transform: translateY(-6px); }
  35% { opacity: 1; transform: translateY(0) translateX(-3px); }
  60% { transform: translateX(3px); }
  80% { transform: translateX(-2px); }
  100% { transform: translateX(0); }
}

.alert-info {
  background-color: var(--accent-subtle);
  color: var(--accent-text);
  border-color: var(--accent-border);
}

/* Invalid field shake: ±3px, 180ms once */
.form-input.is-invalid, .form-select.is-invalid {
  border-color: var(--danger) !important;
  animation: fieldShake 180ms cubic-bezier(0.36, 0.07, 0.19, 0.97) 1 both;
}

@keyframes fieldShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  50% { transform: translateX(3px); }
  75% { transform: translateX(-2px); }
}

/* Loading button spinner (fixed button width maintained) */
.btn-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  vertical-align: middle;
}

.btn-secondary .btn-spinner, .btn-outline .btn-spinner {
  border-color: rgba(0, 0, 0, 0.15);
  border-top-color: var(--text-main);
}

[data-theme="dark"] .btn-secondary .btn-spinner,
[data-theme="dark"] .btn-outline .btn-spinner {
  border-color: rgba(255, 255, 255, 0.2);
  border-top-color: #FFFFFF;
}

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

.btn.is-loading {
  pointer-events: none;
}

.btn.is-loading .btn-text,
.btn.is-loading > svg:not(.btn-spinner) {
  display: none !important;
}

.btn.is-loading .btn-spinner {
  display: inline-block !important;
}

/* Modern App Toast (Emil Kowalski Motion & Progress Line) */
.app-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  max-width: calc(100vw - 40px);
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 12px 18px 14px;
  border-radius: var(--r-md);
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow-toast);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  opacity: 0;
  transform: translateY(-8px) scale(0.96);
  transition: opacity var(--duration-enter) var(--ease-emil), transform var(--duration-enter) var(--ease-emil);
  pointer-events: none;
  overflow: hidden;
}

.app-toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.app-toast.closing {
  opacity: 0;
  transform: translateY(-8px) scale(0.96);
  transition: opacity var(--duration-exit) var(--ease-exit), transform var(--duration-exit) var(--ease-exit);
}

.toast-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2.5px;
  background-color: var(--accent);
  width: 100%;
  transform-origin: left;
  transform: scaleX(1);
}

.app-toast.show .toast-progress-bar {
  animation: toastCountdown 2400ms linear forwards;
}

@keyframes toastCountdown {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

/* =============================================================
   ADMIN PANEL RESPONSIVE (Cards on mobile, Table on desktop)
   ============================================================= */
.admin-responsive-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-responsive-table th {
  background-color: var(--bg-surface-subtle);
  padding: 12px 16px;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.admin-responsive-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  vertical-align: middle;
}

/* Admin table cards transformation is managed uniformly in admin.css */

/* Empty State */
.empty-state-card {
  text-align: center;
  padding: var(--sp-12) var(--sp-6);
  background-color: var(--bg-surface);
  border: 1px dashed var(--border);
  border-radius: var(--r-xl);
}

.empty-state-card svg {
  width: 56px;
  height: 56px;
  color: var(--text-subtle);
  margin-bottom: var(--sp-4);
  stroke-width: 1.5;
}

/* =============================================================
   DASHBOARD STAGGER ENTRANCE (translateY 8px, 40ms stagger, initial load only)
   - Only transforms translateY and opacity
   - Easing: cubic-bezier(0.23, 1, 0.32, 1)
   ============================================================= */
@keyframes emilCardEnter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dashboard-stagger-item {
  animation: emilCardEnter 280ms var(--ease-emil) both;
}

.dashboard-stagger-1 { animation-delay: 0ms; }
.dashboard-stagger-2 { animation-delay: 40ms; }
.dashboard-stagger-3 { animation-delay: 80ms; }
.dashboard-stagger-4 { animation-delay: 120ms; }
.dashboard-stagger-5 { animation-delay: 160ms; }
.dashboard-stagger-6 { animation-delay: 200ms; }

/* Subtle Attention Card (Mulai di sini - 1x gentle pulse on initial load, then static) */
.onboarding-attention-card {
  animation: subtleAttention 380ms var(--ease-emil) 1 both;
  animation-delay: 180ms;
}

@keyframes subtleAttention {
  0% { transform: scale(0.98) translateY(4px); opacity: 0.85; }
  55% { transform: scale(1.008) translateY(-1px); opacity: 1; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

/* Announcement Single Pulse Dot (1x gentle pulse, not continuous) */
.badge-new-pulse {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.badge-new-pulse::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--accent);
  animation: singlePulseDot 400ms var(--ease-emil) 1 forwards;
  animation-delay: 100ms;
}

@keyframes singlePulseDot {
  0% { transform: scale(0.96); opacity: 0.4; }
  50% { transform: scale(1.4); opacity: 1; box-shadow: 0 0 6px var(--accent); }
  100% { transform: scale(1); opacity: 1; box-shadow: none; }
}

/* Skeleton Subtle Shimmer (transform translateX, stops when loaded) */
.skeleton {
  position: relative;
  background-color: var(--bg-surface-subtle);
  border-radius: var(--r-md);
  overflow: hidden;
}

.skeleton::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.12) 50%, transparent 100%);
  transform: translateX(-100%);
  animation: skeletonShimmer 1.4s infinite ease-out;
  pointer-events: none;
}

[data-theme="dark"] .skeleton::after {
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.05) 50%, transparent 100%);
}

@keyframes skeletonShimmer {
  100% { transform: translateX(100%); }
}

.skeleton-loaded .skeleton::after,
.skeleton.loaded::after {
  animation: none !important;
  display: none !important;
}

/* =============================================================
   REDUCED MOTION ACCESSIBILITY (prefers-reduced-motion: reduce)
   - Disables all non-essential motion
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal-on-scroll {
    opacity: 1 !important;
    transform: none !important;
  }
  .dashboard-stagger-item {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }
  .onboarding-attention-card {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }
  .whatsapp-fab-float {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }
  .skeleton::after {
    animation: none !important;
    display: none !important;
  }
  .app-toast.show .toast-progress-bar {
    animation: none !important;
  }
}
