/* ============================================================
   MyDrive — Premium Dark Media Management System
   main.css  |  Inspired by FileRun & Linear
   ============================================================ */

/* ── Google Fonts ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── Design Tokens / CSS Custom Properties ────────────────── */
:root {
  /* Background layers */
  --bg-base:        #0D1117;
  --bg-card:        #161B22;
  --bg-surface:     #6366f1;
  --bg-elevated:    #2D333B;
  --bg-hover:       rgba(255,255,255,0.04);
  --bg-active:      rgba(79,142,247,0.12);

  /* Accent */
  --accent:         #4F8EF7;
  --accent-hover:   #3a7ae0;
  --accent-muted:   rgba(79,142,247,0.15);
  --accent-glow:    0 0 20px rgba(79,142,247,0.35);

  /* Semantic colours */
  --success:        #10B981;
  --success-muted:  rgba(16,185,129,0.15);
  --warning:        #F59E0B;
  --warning-muted:  rgba(245,158,11,0.15);
  --danger:         #EF4444;
  --danger-muted:   rgba(239,68,68,0.15);
  --info:           #38BDF8;
  --info-muted:     rgba(56,189,248,0.15);

  /* Text */
  --text-primary:   #E6EDF3;
  --text-secondary: #C9D1D9;
  --text-muted:     #8B949E;
  --text-faint:     #484F58;

  /* Borders */
  --border:         rgba(255,255,255,0.08);
  --border-strong:  rgba(255,255,255,0.14);
  --border-accent:  rgba(79,142,247,0.4);

  /* Sidebar */
  --sidebar-width:     260px;
  --sidebar-collapsed: 64px;

  /* Topbar */
  --topbar-height: 60px;

  /* Radius */
  --radius-xs:  4px;
  --radius-sm:  6px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-xl:  16px;
  --radius-2xl: 24px;
  --radius-pill: 9999px;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg:  0 8px 30px rgba(0,0,0,0.6);
  --shadow-xl:  0 20px 60px rgba(0,0,0,0.7);

  /* Transitions */
  --transition-fast:   0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow:   0.4s ease;

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-size-xs:   0.75rem;   /* 12px */
  --font-size-sm:   0.875rem;  /* 14px */
  --font-size-base: 1rem;      /* 16px */
  --font-size-lg:   1.125rem;  /* 18px */
  --font-size-xl:   1.25rem;   /* 20px */
  --font-size-2xl:  1.5rem;    /* 24px */
  --font-size-3xl:  1.875rem;  /* 30px */

  /* Z-index scale */
  --z-base:     1;
  --z-dropdown: 100;
  --z-sticky:   200;
  --z-overlay:  10000;
  --z-modal:    400;
  --z-toast:    500;
}

/* ── CSS 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-family);
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-base);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

ul, ol { list-style: none; }

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

::selection {
  background: var(--accent-muted);
  color: var(--text-primary);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* ── App Layout ───────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  
  padding-top: var(--topbar-height);
  min-width: 0;
  transition: margin-left var(--transition-normal);
}

.main-content.sidebar-collapsed {
  margin-left: var(--sidebar-collapsed);
}

.page-container {
  padding: 2rem;
  max-width: 1600px;
  margin: 0 auto;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-title {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.page-subtitle {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: var(--z-sticky);
  transition: width var(--transition-normal), transform var(--transition-normal);
  overflow: hidden;
}

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

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1.25rem 1.75rem;
  border-bottom: 1px solid var(--border);
  height: 80px;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), #7c5cfc);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #fff;
  flex-shrink: 0;
  box-shadow: var(--accent-glow);
}

.sidebar-logo-text {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  letter-spacing: -0.02em;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-section-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  padding: 0.75rem 0.5rem 0.25rem;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  overflow: hidden;
  text-decoration: none;
  position: relative;
}

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

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

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

.nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }

.nav-badge {
  background: var(--accent);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-pill);
  min-width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── Topbar / Navbar ──────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--topbar-height);
  background: rgba(13,17,23,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.5rem;
  z-index: var(--z-sticky);
  transition: left var(--transition-normal);
}

.topbar.sidebar-collapsed { left: var(--sidebar-collapsed); }

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-toggle-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.sidebar-toggle-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

/* ── Search Bar ───────────────────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.4rem 1rem;
  min-width: 280px;
  max-width: 480px;
  width: 100%;
  transition: all var(--transition-fast);
}

.search-bar:focus-within {
  border-color: var(--border-accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.search-bar-icon {
  color: var(--text-muted);
  font-size: 0.9rem;
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-primary);
  outline: none;
  font-size: var(--font-size-sm);
}

.search-input::placeholder { color: var(--text-faint); }

.search-kbd {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 0.1rem 0.35rem;
  font-size: 0.65rem;
  color: var(--text-faint);
  font-family: monospace;
}

/* ── Avatar / User Info ───────────────────────────────────── */
.user-menu {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  transition: all var(--transition-fast);
  background: var(--bg-surface);
}

.user-menu:hover {
  border-color: var(--border-strong);
  background: var(--bg-elevated);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--accent), #7c5cfc);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xs);
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}

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

.user-name {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.user-role {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

/* ── Notification Bell ────────────────────────────────────── */
.notification-btn {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.notification-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: var(--bg-elevated);
}

.notification-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: var(--radius-pill);
  border: 2px solid var(--bg-card);
}

.notification-count-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-card);
}

.notification-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  width: 360px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-dropdown);
  overflow: hidden;
  animation: dropdownFadeIn var(--transition-fast) ease forwards;
}

.notification-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.notification-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition-fast);
  cursor: pointer;
}

.notification-item:hover { background: var(--bg-hover); }
.notification-item.unread { background: var(--accent-muted); }

.notification-item-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.9rem;
}

.notification-item-body { flex: 1; min-width: 0; }
.notification-item-text {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  line-height: 1.4;
}
.notification-item-time {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-normal);
}

.card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.card-title {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--text-primary);
}

.card-body { padding: 1.5rem; }

.card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── Glassmorphism Cards ──────────────────────────────────── */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  transition: all var(--transition-normal);
}

.glass-card:hover {
  background: var(--bg-elevated);
  border-color: var(--border-elevated);
  transform: translateY(-3px);
  box-shadow: var(--shadow-xl);
}

/* ── Media Cards (Grid) ───────────────────────────────────── */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.media-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.media-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  display: flex;
  flex-direction: column;
}

.media-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(79,142,247,0.15);
}

.media-card:hover .media-card-overlay {
  opacity: 1;
}

.media-card-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--bg-surface);
  overflow: hidden;
}

.media-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.media-card:hover .media-card-thumb img {
  transform: scale(1.05);
}

.media-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.1) 60%, transparent 100%);
  opacity: 0;
  transition: opacity var(--transition-normal);
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-play-btn {
  width: 52px;
  height: 52px;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.25rem;
  transition: all var(--transition-fast);
}

.media-play-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(1.1);
}

.media-card-body {
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.media-card-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.media-card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: auto;
}

.media-card-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.6rem 1rem;
  border-top: 1px solid var(--border);
}

/* Media Card — List View */
.media-card.list-view {
  flex-direction: row;
  align-items: center;
  padding: 0.75rem 1rem;
  gap: 1rem;
}

.media-card.list-view .media-card-thumb {
  width: 120px;
  aspect-ratio: 16/9;
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.media-card.list-view .media-card-body {
  padding: 0;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
}

/* Favourite star */
.fav-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(0,0,0,0.5);
  border: none;
  border-radius: var(--radius-pill);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  z-index: 2;
}

.fav-btn:hover, .fav-btn.active { color: #FFD700; }
.fav-btn.active { background: rgba(255,215,0,0.2); }

/* ── Status Badges ────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-xs);
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge-pending {
  background: var(--warning-muted);
  color: var(--warning);
  border: 1px solid rgba(245,158,11,0.25);
}

.badge-approved {
  background: var(--success-muted);
  color: var(--success);
  border: 1px solid rgba(16,185,129,0.25);
}

.badge-rejected {
  background: var(--danger-muted);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,0.25);
}

.badge-draft {
  background: rgba(139,148,158,0.15);
  color: var(--text-muted);
  border: 1px solid rgba(139,148,158,0.2);
}

.badge-info {
  background: var(--info-muted);
  color: var(--info);
  border: 1px solid rgba(56,189,248,0.25);
}

/* ── Media Type Badges ────────────────────────────────────── */
.type-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-pill);
  font-size: var(--font-size-xs);
  font-weight: 600;
  white-space: nowrap;
}

.type-badge-video   { background: rgba(239,68,68,0.12); color: #FC8181; }
.type-badge-image   { background: rgba(79,142,247,0.12); color: #90BAF9; }
.type-badge-audio   { background: rgba(139,92,246,0.12); color: #C4B5FD; }
.type-badge-document{ background: rgba(245,158,11,0.12); color: #FCD34D; }
.type-badge-other   { background: rgba(139,148,158,0.12); color: var(--text-muted); }

/* ── Tag Pills ────────────────────────────────────────────── */
.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.6rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.tag-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-muted);
}

.tag-pill .remove-tag {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1;
}

.tag-pill .remove-tag:hover { color: var(--danger); }

.tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* ── View / Download Chips ────────────────────────────────── */
.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0.15rem 0.55rem;
}

.stat-chip svg, .stat-chip i { font-size: 0.75rem; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
  position: relative;
  overflow: hidden;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background var(--transition-fast);
}

.btn:hover::after { background: rgba(255,255,255,0.05); }
.btn:active::after { background: rgba(0,0,0,0.1); }

/* Primary */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: var(--accent-glow);
  transform: translateY(-1px);
  color: #fff;
}

/* Secondary / Ghost */
.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

/* Danger */
.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover {
  background: #dc2626;
  border-color: #dc2626;
  transform: translateY(-1px);
  color: #fff;
}

/* Success */
.btn-success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}
.btn-success:hover {
  background: #059669;
  border-color: #059669;
  transform: translateY(-1px);
  color: #fff;
}

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Icon-only */
.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
}

/* Sizes */
.btn-sm { padding: 0.3rem 0.7rem; font-size: var(--font-size-xs); }
.btn-lg { padding: 0.75rem 1.5rem; font-size: var(--font-size-base); }
.btn-xl { padding: 1rem 2rem; font-size: var(--font-size-lg); border-radius: var(--radius-md); }

/* ── Forms ────────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
}

.form-label {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-secondary);
}

.form-required { color: var(--danger); margin-left: 0.2rem; }

.form-control {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 0.55rem 0.875rem;
  font-size: var(--font-size-sm);
  width: 100%;
  transition: all var(--transition-fast);
  line-height: 1.5;
}

.form-control::placeholder { color: var(--text-faint); }

.form-control:hover { border-color: var(--border-strong); }

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
  background: var(--bg-elevated);
}

.form-control.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-muted);
}

.form-control.is-valid {
  border-color: var(--success);
  box-shadow: 0 0 0 3px var(--success-muted);
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

select.form-control {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238B949E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 2.5rem;
}

.form-hint {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.form-error {
  font-size: var(--font-size-xs);
  color: var(--danger);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.input-group {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all var(--transition-fast);
}

.input-group:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.input-group .form-control {
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.input-group-prefix, .input-group-suffix {
  background: var(--bg-elevated);
  padding: 0 0.75rem;
  display: flex;
  align-items: center;
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  border-left: 1px solid var(--border);
  flex-shrink: 0;
}

.input-group-prefix { border-left: none; border-right: 1px solid var(--border); }

/* ── Upload Drop Zone ─────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-normal);
  background: var(--bg-surface);
  position: relative;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-muted);
}

.drop-zone.drag-over {
  box-shadow: 0 0 0 4px rgba(79,142,247,0.15);
  transform: scale(1.01);
}

.drop-zone-icon {
  font-size: 3rem;
  color: var(--text-faint);
  margin-bottom: 1rem;
  transition: color var(--transition-fast);
}

.drop-zone:hover .drop-zone-icon,
.drop-zone.drag-over .drop-zone-icon {
  color: var(--accent);
}

.drop-zone-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.drop-zone-subtitle {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}

.drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* ── Modal / Overlay ──────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: var(--z-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn var(--transition-fast) ease;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 560px;
  max-height: 40vh;
  overflow-y: auto;
  animation: modalSlideUp var(--transition-normal) ease;
  position: relative;
}

.modal-lg { max-width: 780px; }
.modal-xl { max-width: 1100px; }
.modal-fullscreen { max-width: 98vw; width: 98vw; max-height: 96vh; }

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

.modal-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.modal-body { padding: 1.5rem; }

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* ── Media Preview iframe (16:9) ──────────────────────────── */
.media-preview-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 */
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.media-preview-container iframe,
.media-preview-container video,
.media-preview-container img.preview-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  object-fit: contain;
}

/* ── Alert / Flash Messages ───────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  margin-bottom: 1rem;
  border: 1px solid transparent;
  animation: slideInTop 0.3s ease;
  position: relative;
}

.alert-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 0.05rem; }

.alert-body { flex: 1; }
.alert-title { font-weight: 600; margin-bottom: 0.15rem; }

.alert-dismiss {
  background: none;
  border: none;
  color: inherit;
  opacity: 0.6;
  cursor: pointer;
  padding: 0.1rem 0.3rem;
  border-radius: var(--radius-xs);
  transition: opacity var(--transition-fast);
  font-size: 1rem;
  margin-left: auto;
  flex-shrink: 0;
}
.alert-dismiss:hover { opacity: 1; }

.alert-success {
  background: var(--success-muted);
  border-color: rgba(16,185,129,0.3);
  color: #6ee7b7;
}

.alert-danger, .alert-error {
  background: var(--danger-muted);
  border-color: rgba(239,68,68,0.3);
  color: #fca5a5;
}

.alert-warning {
  background: var(--warning-muted);
  border-color: rgba(245,158,11,0.3);
  color: #fcd34d;
}

.alert-info {
  background: var(--info-muted);
  border-color: rgba(56,189,248,0.3);
  color: #7dd3fc;
}

/* ── Toast Notifications ──────────────────────────────────── */
.toast-container {
  position: fixed;
  top: calc(var(--topbar-height) + 0.75rem);
  right: 1.25rem;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  pointer-events: all;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.1rem;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  min-width: 280px;
  max-width: 400px;
  animation: toastSlideIn var(--transition-normal) ease;
  position: relative;
  overflow: hidden;
}

.toast.exiting { animation: toastSlideOut var(--transition-normal) ease forwards; }

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--accent);
  animation: toastProgress 5s linear forwards;
  border-radius: 0 0 0 var(--radius-xs);
}

.toast-success .toast-progress { background: var(--success); }
.toast-danger .toast-progress, .toast-error .toast-progress { background: var(--danger); }
.toast-warning .toast-progress { background: var(--warning); }

.toast-icon { font-size: 1.1rem; flex-shrink: 0; }
.toast-success { border-left: 3px solid var(--success); }
.toast-success .toast-icon { color: var(--success); }
.toast-danger, .toast-error { border-left: 3px solid var(--danger); }
.toast-danger .toast-icon, .toast-error .toast-icon { color: var(--danger); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info { border-left: 3px solid var(--info); }
.toast-info .toast-icon { color: var(--info); }

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.1rem 0.3rem;
  margin-left: auto;
  font-size: 1rem;
  transition: color var(--transition-fast);
}
.toast-close:hover { color: var(--text-primary); }

/* ── Progress Bar ─────────────────────────────────────────── */
.progress {
  background: var(--bg-surface);
  border-radius: var(--radius-pill);
  height: 6px;
  overflow: hidden;
  width: 100%;
}

.progress-bar {
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--accent), #7c5cfc);
  transition: width 0.4s ease;
  position: relative;
}

.progress-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 1.5s infinite;
}

.progress-bar.success { background: var(--success); }
.progress-bar.danger  { background: var(--danger); }
.progress-bar.warning { background: var(--warning); }

/* ── Table ────────────────────────────────────────────────── */
.table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

.data-table thead tr {
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}

.data-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
}

.data-table th.sortable { cursor: pointer; user-select: none; }
.data-table th.sortable:hover { color: var(--text-primary); }

.data-table td {
  padding: 0.85rem 1rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr {
  transition: background var(--transition-fast);
}

.data-table tbody tr:hover td { background: var(--bg-hover); }

.data-table .col-actions {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

/* ── Pagination ───────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 1.5rem 0;
  flex-wrap: wrap;
}

.pagination-info {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}

.page-btn {
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  padding: 0 0.5rem;
  text-decoration: none;
}

.page-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-muted);
}

.page-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: var(--accent-glow);
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.page-ellipsis {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  padding: 0 0.25rem;
}

/* ── Skeleton Loaders ─────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg,
    var(--bg-surface) 25%,
    var(--bg-elevated) 50%,
    var(--bg-surface) 75%
  );
  background-size: 200% 100%;
  animation: skeletonWave 1.5s ease infinite;
  border-radius: var(--radius-xs);
}

.skeleton-text { height: 0.8em; width: 100%; margin-bottom: 0.5rem; }
.skeleton-text.short { width: 60%; }
.skeleton-text.shorter { width: 40%; }
.skeleton-circle { border-radius: var(--radius-pill); }
.skeleton-card {
  height: 240px;
  border-radius: var(--radius-lg);
}
.skeleton-thumb {
  aspect-ratio: 16/9;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

/* ── Analytics Chart Container ────────────────────────────── */
.chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  position: relative;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.chart-canvas-wrapper {
  position: relative;
  width: 100%;
  min-height: 200px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: all var(--transition-normal);
}

.stat-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.stat-card-icon.blue { background: var(--accent-muted); color: var(--accent); }
.stat-card-icon.green { background: var(--success-muted); color: var(--success); }
.stat-card-icon.amber { background: var(--warning-muted); color: var(--warning); }
.stat-card-icon.red { background: var(--danger-muted); color: var(--danger); }
.stat-card-icon.purple { background: rgba(124,92,252,0.15); color: #a78bfa; }

.stat-card-label {
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.stat-card-value {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.stat-card-change {
  font-size: var(--font-size-xs);
  font-weight: 500;
  margin-top: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.stat-card-change.positive { color: var(--success); }
.stat-card-change.negative { color: var(--danger); }

/* ── Grid / List View Toggle ──────────────────────────────── */
.view-toggle {
  display: flex;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}

.view-toggle-btn {
  background: none;
  border: none;
  padding: 0.35rem 0.6rem;
  border-radius: calc(var(--radius-md) - 2px);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.view-toggle-btn:hover { color: var(--text-primary); }

.view-toggle-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* ── Tag Autocomplete Dropdown ────────────────────────────── */
.autocomplete-wrapper { position: relative; }

.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
  max-height: 240px;
  overflow-y: auto;
  animation: dropdownFadeIn var(--transition-fast) ease;
}

.autocomplete-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.875rem;
  cursor: pointer;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  border-bottom: 1px solid var(--border);
}

.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover, .autocomplete-item.focused {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* ── Thumbnail Preview ────────────────────────────────────── */
.thumb-preview-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  animation: fadeIn var(--transition-normal) ease;
}

.thumb-preview-img {
  width: 140px;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.thumb-preview-info { flex: 1; min-width: 0; }

.thumb-preview-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
}

.thumb-preview-meta {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

/* ── Bulk Upload Lines Counter ────────────────────────────── */
.bulk-counter-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.7rem;
  background: var(--accent-muted);
  color: var(--accent);
  border-radius: var(--radius-pill);
  font-size: var(--font-size-xs);
  font-weight: 600;
  border: 1px solid var(--border-accent);
}

/* ── Divider ──────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

/* ── Empty State ──────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5rem 2rem;
  text-align: center;
}

.empty-state-icon {
  font-size: 4rem;
  color: var(--text-faint);
  margin-bottom: 1.5rem;
}

.empty-state-title {
  font-size: var(--font-size-xl);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.empty-state-desc {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  max-width: 380px;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

/* ── Breadcrumbs ──────────────────────────────────────────── */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  flex-wrap: wrap;
}

.breadcrumb-item { color: var(--text-muted); }
.breadcrumb-item.active { color: var(--text-primary); }
.breadcrumb-sep { color: var(--text-faint); }

/* ── Dropdown ─────────────────────────────────────────────── */
.dropdown { position: relative; display: inline-flex; }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  min-width: 180px;
  overflow: hidden;
  z-index: var(--z-dropdown);
  animation: dropdownFadeIn var(--transition-fast) ease;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.875rem;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  text-decoration: none;
}

.dropdown-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: var(--danger-muted); }

.dropdown-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.25rem 0;
}

/* ── Tabs ─────────────────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.75rem 1.25rem;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
  margin-bottom: -1px;
}

.tab-btn:hover { color: var(--text-primary); }

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-content { display: none; padding: 1.5rem 0; }
.tab-content.active { display: block; animation: fadeIn var(--transition-normal) ease; }

/* ── Copy to Clipboard ────────────────────────────────────── */
.copy-group {
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--transition-fast);
}

.copy-group:focus-within { border-color: var(--accent); }

.copy-url-input {
  flex: 1;
  padding: 0.55rem 0.875rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  outline: none;
  min-width: 0;
}

.copy-btn {
  padding: 0.55rem 0.875rem;
  background: var(--bg-elevated);
  border: none;
  border-left: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  font-size: var(--font-size-sm);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.copy-btn:hover {
  background: var(--accent-muted);
  color: var(--accent);
}

.copy-btn.copied { color: var(--success); }

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

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

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

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

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

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

@keyframes toastProgress {
  from { width: 100%; }
  to   { width: 0%; }
}

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

@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

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

@keyframes bellShake {
  0%, 100% { transform: rotate(0deg); }
  20%       { transform: rotate(-15deg); }
  40%       { transform: rotate(15deg); }
  60%       { transform: rotate(-10deg); }
  80%       { transform: rotate(10deg); }
}

/* Loading spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: var(--radius-pill);
  animation: spin 0.7s linear infinite;
}

.spinner-lg { width: 40px; height: 40px; border-width: 3px; }

/* Bell shake on new notification */
.notification-btn.has-new { animation: bellShake 0.6s ease; }

/* ── Page Transition ──────────────────────────────────────── */
.page-fade-in { animation: fadeIn 0.3s ease; }

/* ── Utility Classes ──────────────────────────────────────── */
.hidden { display: none !important; }
.invisible { visibility: hidden !important; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }

.text-sm { font-size: var(--font-size-sm); }
.text-xs { font-size: var(--font-size-xs); }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-accent { color: var(--accent); }

.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rounded { border-radius: var(--radius-md); }

/* ── Responsive Breakpoints ───────────────────────────────── */

/* Tablet: ≤ 1024px */
@media (max-width: 1024px) {
  .page-container { padding: 1.5rem; }

  .media-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }

  .search-bar { min-width: 200px; }
}

/* Mobile-ish: ≤ 768px */
@media (max-width: 768px) {
  :root {
    --topbar-height: 56px;
  }

  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width) !important;
    z-index: var(--z-modal);
  }

  .sidebar.open { transform: translateX(0); }

  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: calc(var(--z-modal) - 1);
    backdrop-filter: blur(2px);
  }

  .main-content {
    margin-left: 0 !important;
  }

  .topbar { left: 0 !important; padding: 0 1rem; }

  .page-container { padding: 1rem; }

  .page-header { flex-direction: column; align-items: flex-start; }

  .media-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
  }

  .search-bar { min-width: unset; }
  .search-kbd { display: none; }

  .user-name, .user-role { display: none; }

.modal-overlay {
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal {
  margin-top: 0; 
  border-radius: var(--radius-xl);
  max-height: 40vh;
}


  .notification-dropdown { width: calc(100vw - 2rem); right: -0.5rem; }

  .data-table th, .data-table td { padding: 0.6rem 0.75rem; }
}

/* Small mobile: ≤ 480px */
@media (max-width: 480px) {
  .media-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .page-title { font-size: var(--font-size-xl); }

  .btn-lg { padding: 0.6rem 1.1rem; }
  .btn-xl { padding: 0.75rem 1.5rem; }

  .drop-zone { padding: 2rem 1rem; }

  .toast { min-width: unset; max-width: calc(100vw - 2.5rem); }
  .toast-container { right: 0.75rem; left: 0.75rem; }
}

/* ── DataTables Premium Custom Styling ────────────────────── */
.dt-container {
    padding: 1rem;
    font-family: var(--font-family);
    color: var(--text-primary);
}
.dt-layout-row { margin-bottom: 1rem; }
.dt-search input {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    outline: none;
    transition: all var(--transition-fast);
}
.dt-search input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-muted);
}
table.dataTable {
    border-collapse: collapse;
    width: 100%;
}
table.dataTable th {
    color: var(--bg-secondary);
    font-size: var(--font-size-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}
table.dataTable td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-strong);
    color: var(--text-primary);
    background: transparent;
}
table.dataTable tbody tr:hover {
    background: var(--bg-hover) !important;
}

/* ── CodeIgniter Pagination Custom Styling ────────────────── */
.pagination-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}
.pagination-wrapper .pagination {
    display: flex;
    gap: 0.5rem;
    list-style: none;
}
.pagination-wrapper .pagination li a,
.pagination-wrapper .pagination li span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 0.5rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    transition: all var(--transition-fast);
    text-decoration: none;
}
.pagination-wrapper .pagination li.active a,
.pagination-wrapper .pagination li.active span,
.pagination-wrapper .pagination li a:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    box-shadow: var(--shadow-sm);
}
.pagination-wrapper .pagination li.disabled a,
.pagination-wrapper .pagination li.disabled span {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-card);
}

