/* =============================================
   main.css — Golora Platform Core Styles
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,200..800;1,200..800&display=swap" rel="stylesheet');

/* =============================================
   1. CSS CUSTOM PROPERTIES
   ============================================= */
:root {
  /* Brand */
  --primary:          #316aff;
  --primary-dark:     #1a52e0;
  --primary-darker:   #0f3cbf;
  --primary-light:    #eef2ff;
  --primary-glow:     rgba(49, 106, 255, 0.18);
  --primary-glow-lg:  rgba(49, 106, 255, 0.32);

  /* Neutrals */
  --white:      #ffffff;
  --gray-50:    #f8fafc;
  --gray-100:   #f1f5f9;
  --gray-150:   #eaeff5;
  --gray-200:   #e2e8f0;
  --gray-300:   #cbd5e1;
  --gray-400:   #94a3b8;
  --gray-500:   #64748b;
  --gray-600:   #475569;
  --gray-700:   #334155;
  --gray-800:   #1e293b;
  --gray-900:   #0f172a;

  /* Semantic */
  --success:        #10b981;
  --success-light:  #ecfdf5;
  --success-dark:   #059669;
  --warning:        #f59e0b;
  --warning-light:  #fffbeb;
  --warning-dark:   #d97706;
  --danger:         #ef4444;
  --danger-light:   #fef2f2;
  --danger-dark:    #dc2626;
  --info:           #06b6d4;
  --info-light:     #ecfeff;
  --info-dark:      #0891b2;
  --purple:         #8b5cf6;
  --purple-light:   #f5f3ff;

  /* Backgrounds */
  --bg-app:    #f0f3fa;
  --bg-card:   #ffffff;
  --card-bg:   #ffffff;
  --bg-input:  #f8fafc;

  /* Sidebar */
  --sb-bg:           #0c1120;
  --sb-border:       rgba(255,255,255,0.055);
  --sb-text:         #8a9ab8;
  --sb-text-hover:   #c8d5ea;
  --sb-text-active:  #ffffff;
  --sb-hover:        rgba(49, 106, 255, 0.1);
  --sb-active:       rgba(49, 106, 255, 0.16);
  --sb-width:        262px;
  --sb-collapsed:    72px;

  /* Navbar */
  --nb-bg:       rgba(255,255,255,0.97);
  --nb-height:   66px;
  --nb-border:   rgba(0,0,0,0.07);

  /* Text */
  --tx-primary:   #111827;
  --tx-secondary: #64748b;
  --tx-muted:     #94a3b8;

  /* Borders */
  --border:       #e2e8f0;
  --border-light: #f1f5f9;

  /* Shadows */
  --sh-xs:  0 1px 2px rgba(0,0,0,0.05);
  --sh-sm:  0 2px 8px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
  --sh-md:  0 4px 20px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
  --sh-lg:  0 10px 40px rgba(0,0,0,0.10), 0 4px 12px rgba(0,0,0,0.04);
  --sh-xl:  0 20px 60px rgba(0,0,0,0.13), 0 8px 20px rgba(0,0,0,0.06);
  --sh-pri: 0 4px 24px rgba(49,106,255,0.38);
  --sh-pri-lg: 0 8px 36px rgba(49,106,255,0.45);

  /* Radius */
  --r-xs:   4px;
  --r-sm:   8px;
  --r-md:   12px;
  --r-lg:   16px;
  --r-xl:   20px;
  --r-2xl:  24px;
  --r-full: 9999px;

  /* Transitions */
  --t:        all 0.2s cubic-bezier(0.4,0,0.2,1);
  --t-slow:   all 0.35s cubic-bezier(0.4,0,0.2,1);
  --t-spring: all 0.4s cubic-bezier(0.34,1.56,0.64,1);

  /* Font */
  --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Z-layers */
  --z-dropdown: 50;
  --z-sidebar:  100;
  --z-navbar:   150;
  --z-modal:    1000;
  --z-toast:    1100;
}

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

html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--tx-primary);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a { color: var(--primary); text-decoration: none; transition: var(--t); }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea, select { font-family: inherit; }
h1, h2, h3, h4, h5, h6 { line-height: 1.25; letter-spacing: -0.02em; }

/* =============================================
   3. APP LAYOUT
   ============================================= */
.app { display: flex; min-height: 100vh; }

/* =============================================
   4. SIDEBAR
   ============================================= */
.sidebar {
  width: var(--sb-width);
  height: 100vh;
  background: var(--sb-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: var(--z-sidebar);
  transition: var(--t-slow);
  overflow-x: hidden;
  overflow-y: hidden;
  border-right: 1px solid var(--sb-border);
  will-change: width;
}

.sidebar.collapsed { width: var(--sb-collapsed); }

/* Sidebar Logo */
.sb-logo {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--sb-border);
  min-height: var(--nb-height);
  text-decoration: none;
  flex-shrink: 0;
}

.sb-logo-img {
  width: 38px; height: 38px;
  object-fit: contain;
  flex-shrink: 0;
  filter: brightness(1.1);
}

.sb-logo-wordmark {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--white);
  letter-spacing: -0.04em;
  white-space: nowrap;
  overflow: hidden;
  transition: var(--t-slow);
  opacity: 1;
}

/* Collapsed state — hide text */
.sidebar.collapsed .sb-logo-wordmark,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .sb-user-info,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .sb-tag { opacity: 0; width: 0; overflow: hidden; }

/* Nav */
.sb-nav {
  flex: 1;
  padding: 14px 10px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
}
.sb-nav::-webkit-scrollbar { width: 3px; }
.sb-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 99px; }

.nav-section-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--sb-text);
  padding: 10px 12px 4px;
  margin-top: 6px;
  white-space: nowrap;
  overflow: hidden;
  transition: var(--t);
  opacity: 0.7;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  color: var(--sb-text);
  text-decoration: none;
  transition: var(--t);
  margin-bottom: 2px;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
}

.nav-item:hover {
  background: var(--sb-hover);
  color: var(--sb-text-hover);
}

.nav-item.active {
  background: var(--sb-active);
  color: var(--sb-text-active);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 55%;
  background: var(--primary);
  border-radius: 0 99px 99px 0;
}

.nav-item i {
  font-size: 1.0625rem;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
  transition: var(--t);
}

.nav-item.active i { color: var(--primary); }

.nav-label {
  font-size: 0.875rem;
  font-weight: 500;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: var(--t-slow);
}

.nav-badge {
  background: var(--primary);
  color: white;
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  flex-shrink: 0;
  line-height: 1.5;
  transition: var(--t-slow);
}

.sb-tag {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  flex-shrink: 0;
  white-space: nowrap;
  transition: var(--t-slow);
}

.sb-tag-new { background: rgba(16,185,129,0.2); color: #10b981; }
.sb-tag-pro { background: rgba(139,92,246,0.2); color: #a78bfa; }
.sb-tag-hot { background: rgba(239,68,68,0.2); color: #f87171; }

/* Sidebar Footer */
.sb-footer {
  padding: 10px;
  border-top: 1px solid var(--sb-border);
  flex-shrink: 0;
}

.sb-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: var(--t);
  overflow: hidden;
}

.sb-user:hover { background: var(--sb-hover); }

.sb-avatar {
  width: 36px; height: 36px;
  border-radius: 99px;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid rgba(49,106,255,0.4);
}

.sb-user-info {
  flex: 1; min-width: 0;
  overflow: hidden;
  transition: var(--t-slow);
}

.sb-user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--sb-text-active);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sb-user-role {
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 500;
  margin-top: 1px;
}

/* =============================================
   5. MAIN WRAPPER
   ============================================= */
.main-wrapper {
  flex: 1;
  min-width: 0;       /* prevent flex child from expanding beyond viewport */
  margin-left: var(--sb-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: var(--t-slow);
}

.main-wrapper.expanded { margin-left: var(--sb-collapsed); }

/* =============================================
   6. NAVBAR
   ============================================= */
.navbar {
  height: var(--nb-height);
  width: 100%;
  min-width: 0;
  background: var(--nb-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--nb-border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: var(--z-navbar);
  box-shadow: var(--sh-xs);
  overflow: visible;
}

.nb-toggle {
  width: 38px; height: 38px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--tx-secondary);
  cursor: pointer;
  transition: var(--t);
  flex-shrink: 0;
}
.nb-toggle:hover { background: var(--gray-100); color: var(--tx-primary); }

.nb-brand {
  display: none;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--tx-primary);
  letter-spacing: -0.04em;
}
.nb-brand img { height: 32px; }

.nb-search {
  flex: 1;
  max-width: 540px;
  display: flex;
  align-items: center;
  background: var(--gray-100);
  border: 1.5px solid transparent;
  border-radius: 99px;
  padding: 0 18px;
  gap: 10px;
  transition: var(--t);
}
.nb-search:focus-within {
  background: var(--white);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.nb-search i { color: var(--tx-muted); font-size: 0.9375rem; flex-shrink: 0; }
.nb-search input {
  flex: 1; border: none; background: none; outline: none;
  font-size: 0.9375rem; color: var(--tx-primary); padding: 10px 0;
}
.nb-search input::placeholder { color: var(--tx-muted); }

.nb-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.nb-btn {
  width: 40px; height: 40px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--tx-secondary);
  cursor: pointer;
  transition: var(--t);
  position: relative;
  background: none;
  border: none;
  font-size: 1.0625rem;
}
.nb-btn:hover { background: var(--gray-100); color: var(--primary); }

.nb-btn .dot {
  position: absolute;
  top: 7px; right: 7px;
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 99px;
  border: 2px solid white;
}

.nb-btn .count {
  position: absolute;
  top: 4px; right: 4px;
  background: var(--danger);
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 17px; height: 17px;
  padding: 0 4px;
  border-radius: 99px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid white;
}

.nb-divider { width: 1px; height: 22px; background: var(--border); margin: 0 2px; }

.nb-avatar-wrap {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; padding: 4px 8px;
  border-radius: var(--r-md);
  transition: var(--t);
  position: relative;
}
.nb-avatar-wrap:hover { background: var(--gray-100); }

.nb-avatar {
  width: 36px; height: 36px;
  border-radius: 99px;
  object-fit: cover;
  border: 2px solid var(--primary-light);
  transition: var(--t);
}

.nb-user-text { display: none; }
.nb-user-name { font-size: 0.875rem; font-weight: 600; color: var(--tx-primary); }
.nb-user-role { font-size: 0.75rem; color: var(--primary); font-weight: 500; }

/* =============================================
   7. MAIN CONTENT
   ============================================= */
.content {
  flex: 1;
  padding: 28px;
  max-width: 100%;
  overflow-x: hidden;
}

.content.no-pad { padding: 0; }

/* Page Header */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.625rem;
  font-weight: 800;
  color: var(--tx-primary);
  letter-spacing: -0.04em;
  line-height: 1.2;
}

.page-subtitle {
  font-size: 0.9375rem;
  color: var(--tx-secondary);
  margin-top: 5px;
  font-weight: 400;
}

.page-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* =============================================
   8. GRIDS & LAYOUT UTILITIES
   ============================================= */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-1 { flex: 1; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-24 { gap: 24px; }
.flex-wrap { flex-wrap: wrap; }
.min-w-0 { min-width: 0; }

/* Spacing */
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.ml-auto { margin-left: auto; }
.mr-auto { margin-right: auto; }
.p-20 { padding: 20px; }
.p-24 { padding: 24px; }
.px-16 { padding-left: 16px; padding-right: 16px; }

/* Typography utilities */
.text-xs   { font-size: 0.8125rem; }
.text-sm   { font-size: 0.875rem; }
.text-base { font-size: 0.9375rem; }
.text-lg   { font-size: 1.125rem; }
.text-xl   { font-size: 1.25rem; }
.text-2xl  { font-size: 1.5rem; }

.font-medium   { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }
.font-extrabold { font-weight: 800; }

.text-primary-c  { color: var(--primary); }
.text-secondary-c { color: var(--tx-secondary); }
.text-muted-c   { color: var(--tx-muted); }
.text-success-c { color: var(--success); }
.text-warning-c { color: var(--warning); }
.text-danger-c  { color: var(--danger); }
.text-white-c   { color: white; }
.text-purple-c  { color: var(--purple); }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-center { text-align: center; }
.w-full { width: 100%; }
.hidden { display: none; }

/* =============================================
   9. SCROLLBAR
   ============================================= */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* =============================================
   10. ANIMATIONS
   ============================================= */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.45; } }
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%); }
  to   { opacity: 1; transform: translateX(0); }
}

.animate-fade  { animation: fadeIn 0.3s ease forwards; }
.animate-scale { animation: scaleIn 0.25s ease forwards; }
.animate-slide { animation: slideDown 0.25s ease forwards; }

/* Skeleton loader */
.skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--r-sm);
  display: block;
}

/* =============================================
   13. DARK MODE
   ============================================= */
:root { color-scheme: light dark; }

/* Smooth transition when toggling */
html.theme-transitioning,
html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.15s ease, box-shadow 0.3s ease !important;
}

[data-theme="dark"] {
  --primary-light:    #1a2a4a;
  --primary-glow:     rgba(49,106,255,0.22);

  --bg-app:    #0f172a;
  --bg-card:   #1e293b;
  --card-bg:   #1e293b;
  --bg-input:  #1e293b;

  --sb-bg:     #080e1a;
  --sb-border: rgba(255,255,255,0.06);

  --nb-bg:     rgba(15,23,42,0.97);
  --nb-border: rgba(255,255,255,0.07);

  --tx-primary:   #f1f5f9;
  --tx-secondary: #94a3b8;
  --tx-muted:     #64748b;

  --border:       #334155;
  --border-light: #1e293b;

  --gray-50:  #1e293b;
  --gray-100: #334155;
  --gray-150: #3d4f66;
  --gray-200: #475569;
  --gray-300: #64748b;

  --sh-xs:  0 1px 2px rgba(0,0,0,0.3);
  --sh-sm:  0 2px 8px rgba(0,0,0,0.4), 0 1px 3px rgba(0,0,0,0.3);
  --sh-md:  0 4px 20px rgba(0,0,0,0.45), 0 2px 6px rgba(0,0,0,0.3);
  --sh-lg:  0 10px 40px rgba(0,0,0,0.5), 0 4px 12px rgba(0,0,0,0.3);
  --sh-xl:  0 20px 60px rgba(0,0,0,0.6), 0 8px 20px rgba(0,0,0,0.4);
}

/* Dark mode card adjustments */
[data-theme="dark"] .card,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .chart-card,
[data-theme="dark"] .table-card {
  background: var(--bg-card);
  border-color: var(--border);
}

[data-theme="dark"] .plan-card  { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .feed-card  { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .modal      { background: #1e293b; }
[data-theme="dark"] .modal-footer { background: #172033; }
[data-theme="dark"] .dropdown-menu { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .dropdown-item:hover { background: #334155; }

[data-theme="dark"] .nb-search  { background: #1e293b; }
[data-theme="dark"] .nb-search:focus-within { background: #1e293b; }
[data-theme="dark"] .nb-btn:hover { background: #334155; }
[data-theme="dark"] .nb-avatar-wrap:hover { background: #334155; }

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select { background: #1e293b; border-color: #334155; color: var(--tx-primary); }
[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus { border-color: var(--primary); background: #1e293b; }

[data-theme="dark"] .table th   { background: #172033; color: var(--tx-muted); }
[data-theme="dark"] .table tbody tr:hover { background: #263348; }
[data-theme="dark"] .table td   { border-color: #263348; }

[data-theme="dark"] .tabs-wrapper { background: #172033; }
[data-theme="dark"] .tab-btn.active { background: #1e293b; }

[data-theme="dark"] .filter-chip       { background: #1e293b; color: var(--tx-secondary); }
[data-theme="dark"] .filter-chip:hover { background: #334155; }
[data-theme="dark"] .filter-chip.active { background: var(--primary-light); color: #7aadff; }

[data-theme="dark"] .category-chip.light       { background: #334155; color: var(--tx-primary); }
[data-theme="dark"] .category-chip.light:hover { background: #475569; }
[data-theme="dark"] .category-chip.light.active { background: var(--tx-primary); color: var(--sb-bg); }

[data-theme="dark"] .page-btn        { border-color: #334155; color: var(--tx-secondary); }
[data-theme="dark"] .page-btn:hover  { background: #334155; }

[data-theme="dark"] .search-input { background: #1e293b; }
[data-theme="dark"] .skeleton {
  background: linear-gradient(90deg, #1e293b 25%, #263348 50%, #1e293b 75%);
  background-size: 200% 100%;
}

[data-theme="dark"] .upload-zone {
  background: #172033; border-color: #334155;
}
[data-theme="dark"] .upload-zone:hover { background: var(--primary-light); border-color: var(--primary); }

/* Dark sidebar is already dark — keep as-is but adjust text */
[data-theme="dark"] .sidebar { background: #060c18; }

/* =============================================
   14. BACK-TO-TOP BUTTON
   ============================================= */
.back-to-top {
  position: fixed; bottom: 88px; right: 24px;
  width: 44px; height: 44px;
  border-radius: 99px;
  background: var(--primary);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  box-shadow: var(--sh-pri);
  cursor: pointer; border: none;
  opacity: 0; transform: translateY(16px) scale(0.85);
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
  z-index: 200;
  pointer-events: none;
}
.back-to-top.visible {
  opacity: 1; transform: translateY(0) scale(1);
  pointer-events: all;
}
.back-to-top:hover { background: var(--primary-dark); transform: translateY(-3px) scale(1.05); }

@media (max-width: 768px) { .back-to-top { bottom: 76px; right: 16px; } }

/* =============================================
   15. MOBILE BOTTOM NAV
   ============================================= */
.mobile-bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 60px;
  background: var(--white);
  border-top: 1px solid var(--border);
  z-index: 200;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
}
.mob-nav { display: flex; height: 100%; }
.mob-nav-btn {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 4px; cursor: pointer;
  color: var(--tx-muted); font-size: 0.6875rem; font-weight: 600;
  border: none; background: none; transition: var(--t);
  position: relative;
}
.mob-nav-btn i  { font-size: 1.125rem; transition: var(--t); }
.mob-nav-btn.active { color: var(--primary); }
.mob-nav-btn.active i { transform: scale(1.1); }
.mob-nav-btn::before {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 0; height: 3px; background: var(--primary);
  border-radius: 0 0 4px 4px; transition: width 0.2s ease;
}
.mob-nav-btn.active::before { width: 32px; }
.mob-nav-dot {
  position: absolute; top: 6px; right: calc(50% - 14px);
  width: 7px; height: 7px;
  background: var(--danger); border-radius: 99px; border: 2px solid white;
}

[data-theme="dark"] .mobile-bottom-nav { background: #0f172a; border-color: #1e293b; }
[data-theme="dark"] .mob-nav-btn { color: var(--tx-muted); }
[data-theme="dark"] .mob-nav-dot { border-color: #0f172a; }

@media (max-width: 768px) {
  .mobile-bottom-nav { display: block; }
  .content { padding-bottom: 76px !important; }
}

/* =============================================
   16. SEARCH OVERLAY (Mobile)
   ============================================= */
.search-overlay {
  position: fixed; inset: 0;
  background: var(--white);
  z-index: 500;
  transform: translateY(-100%);
  transition: transform 0.32s cubic-bezier(0.4,0,0.2,1);
  display: flex; flex-direction: column;
}
.search-overlay.active { transform: translateY(0); }

[data-theme="dark"] .search-overlay { background: #0f172a; }

.so-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
}
.so-input {
  flex: 1; display: flex; align-items: center; gap: 10px;
  background: var(--gray-100); border-radius: 99px; padding: 0 16px;
}
[data-theme="dark"] .so-input { background: #1e293b; }
.so-input i { color: var(--tx-muted); }
.so-input input {
  flex: 1; border: none; background: none; outline: none;
  font-size: 1rem; font-family: var(--font); color: var(--tx-primary); padding: 12px 0;
}
.so-close {
  font-size: 0.9375rem; font-weight: 700; color: var(--primary);
  cursor: pointer; border: none; background: none; white-space: nowrap; padding: 0;
}
.so-body { flex: 1; overflow-y: auto; padding: 20px 16px; }
.so-label { font-size: 0.8125rem; font-weight: 700; color: var(--tx-muted); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 12px; }
.so-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 99px;
  background: var(--gray-100); color: var(--tx-primary);
  font-size: 0.875rem; font-weight: 500; margin: 4px;
  cursor: pointer; transition: var(--t); border: none;
}
[data-theme="dark"] .so-chip { background: #1e293b; }
.so-chip:hover { background: var(--primary-light); color: var(--primary); }
.so-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border-light); cursor: pointer;
}
.so-row:hover .so-row-text { color: var(--primary); }
.so-row i { color: var(--tx-muted); width: 18px; text-align: center; }
.so-row-text { font-size: 0.9375rem; color: var(--tx-secondary); }

/* =============================================
   17. STICKY CATEGORY BAR
   ============================================= */
.cats-sticky-wrap {
  position: sticky;
  top: var(--nb-height);
  z-index: 90;
  background: var(--bg-app);
  padding: 10px 0 8px;
  margin: -8px -28px 16px;
  padding-left: 28px;
  padding-right: 28px;
  transition: box-shadow 0.2s ease;
}
.cats-sticky-wrap.scrolled {
  box-shadow: 0 4px 20px rgba(0,0,0,0.07);
}
[data-theme="dark"] .cats-sticky-wrap { background: #0f172a; }
[data-theme="dark"] .cats-sticky-wrap.scrolled { box-shadow: 0 4px 20px rgba(0,0,0,0.4); }

.cats-inner { position: relative; }
.cat-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px;
  background: var(--white); border: 1px solid var(--border);
  border-radius: 99px; box-shadow: var(--sh-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 2; color: var(--tx-primary); font-size: 0.875rem;
  transition: var(--t); opacity: 0; pointer-events: none;
}
[data-theme="dark"] .cat-arrow { background: #1e293b; border-color: #334155; }
.cat-arrow.left  { left: -8px; }
.cat-arrow.right { right: -8px; }
.cat-arrow.visible { opacity: 1; pointer-events: all; }
.cat-arrow:hover { background: var(--primary); color: white; border-color: var(--primary); box-shadow: var(--sh-pri); }

/* =============================================
   18. FEATURED BANNER
   ============================================= */
.featured-banner {
  border-radius: var(--r-xl); overflow: hidden;
  position: relative; margin-bottom: 28px;
  aspect-ratio: 21/7; min-height: 180px;
  cursor: pointer;
}
.featured-banner img {
  width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease;
}
.featured-banner:hover img { transform: scale(1.03); }
.featured-banner-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.3) 50%, transparent 100%);
  display: flex; align-items: flex-end; padding: 28px 32px;
}
.featured-badge { display: inline-flex; align-items: center; gap: 6px; background: var(--primary); color: white; font-size: 0.75rem; font-weight: 700; padding: 4px 12px; border-radius: 99px; margin-bottom: 10px; }
.featured-title { font-size: 1.5rem; font-weight: 800; color: white; line-height: 1.2; margin-bottom: 8px; letter-spacing: -0.03em; text-shadow: 0 2px 8px rgba(0,0,0,0.4); }
.featured-meta  { font-size: 0.875rem; color: rgba(255,255,255,0.8); display: flex; align-items: center; gap: 12px; }
.featured-play  {
  position: absolute; top: 50%; right: 32px; transform: translateY(-50%);
  width: 56px; height: 56px; border-radius: 99px;
  background: rgba(255,255,255,0.15); border: 2px solid rgba(255,255,255,0.5);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 1.375rem;
  backdrop-filter: blur(4px); transition: var(--t);
}
.featured-banner:hover .featured-play {
  background: var(--primary); border-color: var(--primary);
  transform: translateY(-50%) scale(1.1);
}
@media (max-width: 600px) {
  .featured-banner { aspect-ratio: 16/9; }
  .featured-title  { font-size: 1.125rem; }
  .featured-banner-overlay { padding: 16px 20px; }
  .featured-play   { display: none; }
}

/* =============================================
   19. CONTINUE WATCHING ROW
   ============================================= */
.cw-section { margin-bottom: 28px; }
.cw-header  { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cw-title   { font-size: 1.0625rem; font-weight: 700; color: var(--tx-primary); letter-spacing: -0.02em; }
.cw-scroll  { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.cw-scroll::-webkit-scrollbar { display: none; }
.cw-card    { flex-shrink: 0; width: 200px; cursor: pointer; }
.cw-thumb   {
  position: relative; border-radius: var(--r-md); overflow: hidden;
  aspect-ratio: 16/9; background: var(--gray-200); margin-bottom: 8px;
}
.cw-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s ease; }
.cw-card:hover .cw-thumb img { transform: scale(1.06); }
.cw-progress { position: absolute; bottom: 0; left: 0; right: 0; height: 4px; background: rgba(255,255,255,0.3); }
.cw-progress-fill { height: 100%; background: var(--primary); border-radius: 0 2px 2px 0; }
.cw-play-btn {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: var(--t);
  background: rgba(0,0,0,0.25);
}
.cw-play-btn i { font-size: 2.5rem; color: white; filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5)); }
.cw-card:hover .cw-play-btn { opacity: 1; }
.cw-dur { position: absolute; bottom: 14px; right: 8px; background: rgba(0,0,0,0.8); color: white; font-size: 0.75rem; font-weight: 600; padding: 2px 6px; border-radius: 4px; }
.cw-card-title { font-size: 0.875rem; font-weight: 600; color: var(--tx-primary); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; transition: var(--t); }
.cw-card:hover .cw-card-title { color: var(--primary); }
.cw-card-meta  { font-size: 0.8125rem; color: var(--tx-muted); margin-top: 3px; }
@media(max-width:768px) { .cw-card { width: 170px; } }

/* =============================================
   20. VIDEO GRID — HOVER PLAY BUTTON
   ============================================= */
.video-play-btn {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.2s ease;
  background: rgba(0,0,0,0.18);
}
.video-play-btn span {
  width: 48px; height: 48px; border-radius: 99px;
  background: rgba(255,255,255,0.92);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  transform: scale(0.8);
  transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1);
  color: var(--primary); font-size: 1.125rem;
  padding-left: 3px; /* optical centering for play icon */
}
.video-card:hover .video-play-btn { opacity: 1; }
.video-card:hover .video-play-btn span { transform: scale(1); }

/* =============================================
   21. DARK MODE TOGGLE BUTTON
   ============================================= */
.dark-toggle {
  width: 40px; height: 40px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; border: none; background: none;
  color: var(--tx-secondary); font-size: 1.0625rem;
  transition: var(--t); position: relative; overflow: hidden;
}
.dark-toggle:hover { background: var(--gray-100); color: var(--primary); }
[data-theme="dark"] .dark-toggle:hover { background: #334155; }
.dark-toggle .icon-sun,
.dark-toggle .icon-moon { position: absolute; transition: var(--t-spring); }
.dark-toggle .icon-sun  { opacity: 1;  transform: rotate(0) scale(1); }
.dark-toggle .icon-moon { opacity: 0;  transform: rotate(90deg) scale(0.5); }
[data-theme="dark"] .dark-toggle .icon-sun  { opacity: 0;  transform: rotate(-90deg) scale(0.5); }
[data-theme="dark"] .dark-toggle .icon-moon { opacity: 1;  transform: rotate(0) scale(1); }

/* =============================================
   11. OVERLAY & DROPDOWN
   ============================================= */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.52);
  z-index: calc(var(--z-sidebar) - 1);
  backdrop-filter: blur(3px);
}
.sidebar-overlay.active { display: block; }

.dropdown { position: relative; }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px); right: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xl);
  min-width: 220px;
  padding: 8px;
  z-index: 9999;
  display: none;
  transform-origin: top right;
}
.dropdown-menu.active { display: block; animation: scaleIn 0.18s ease; }

.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  color: var(--tx-primary);
  font-size: 0.875rem; font-weight: 500;
  cursor: pointer; transition: var(--t);
}
.dropdown-item:hover { background: var(--gray-100); color: var(--primary); }
.dropdown-item i { width: 18px; text-align: center; color: var(--tx-muted); }
.dropdown-divider { height: 1px; background: var(--border-light); margin: 6px 0; }
.dropdown-item.danger:hover { background: var(--danger-light); color: var(--danger); }

/* =============================================
   12. RESPONSIVE
   ============================================= */
@media (max-width: 1280px) {
  .grid-5 { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 1140px) {
  .grid-4 { grid-template-columns: repeat(3, 1fr); }
  .grid-5 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1024px) {
  .content { padding: 20px; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .nb-user-text { display: none !important; }
  .cats-sticky-wrap { margin-left: -20px; margin-right: -20px; padding-left: 20px; padding-right: 20px; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: calc(var(--z-sidebar) + 10);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-wrapper { margin-left: 0 !important; }
  .nb-brand { display: flex; }
  .nb-search { display: none; }
  .content { padding: 16px; }
  .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .page-title { font-size: 1.375rem; }
  .cats-sticky-wrap { margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; }
}

@media (max-width: 480px) {
  .content { padding: 12px; }
  .navbar { padding: 0 12px; gap: 8px; }
  .nb-actions .nb-btn { display: none; }
  .nb-actions .nb-btn:last-child { display: flex; }
  .cats-sticky-wrap { margin-left: -12px; margin-right: -12px; padding-left: 12px; padding-right: 12px; }
}

@media (min-width: 769px) {
  .nb-user-text { display: block; }
}
