/* AdVault - Google Stitch Inspired Dashboard */
/* Modern, minimal design with dark sidebar and glass panel effects */

/* ===== Typography ===== */
/* Fonts loaded via index.html: Plus Jakarta Sans (body), Sora (headings), JetBrains Mono (code) */

/* ===== Design Tokens ===== */
:root {
  /* Font Families */
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-heading: 'Sora', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;

  /* Typography Scale */
  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 16px;
  --text-lg: 20px;
  --text-xl: 28px;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;

  /* Spacing Scale - 4px base */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-2xl: 16px;
  --radius-full: 9999px;

  /* Transitions */
  --ease-out: cubic-bezier(0.33, 1, 0.68, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --duration-fast: 100ms;
  --duration-normal: 150ms;
  --duration-slow: 200ms;

  /* Sidebar - Always Dark */
  --sidebar-width: 256px;
  --sidebar-collapsed: 64px;
  --sidebar-bg: #0a0a0a;
  --sidebar-border: rgba(255, 255, 255, 0.05);
  --sidebar-text: #a3a3a3;
  --sidebar-text-active: #ffffff;

  /* Consumer Genius Brand - Crimson */
  --crimson: #E31837;
  --crimson-hover: #C41230;
  --crimson-light: #FF3D5A;
  --crimson-subtle: rgba(227, 24, 55, 0.1);
  --crimson-muted: rgba(227, 24, 55, 0.05);
  --crimson-glow: 0 0 20px rgba(227, 24, 55, 0.15);
  --crimson-glow-strong: 0 0 30px rgba(227, 24, 55, 0.3);
}

/* ===== LIGHT MODE ===== */
[data-theme='light'] {
  /* Surfaces */
  --bg-base: #ffffff;
  --bg-subtle: #f9fafb;
  --bg-muted: #f3f4f6;
  --bg-elevated: #ffffff;
  --bg-overlay: rgba(0, 0, 0, 0.5);
  --bg-content: #f9fafb;

  /* Legacy compatibility */
  --surface-secondary: #ffffff;
  --surface-elevated: #f9fafb;
  --border-color: #e5e7eb;

  /* Borders */
  --border-subtle: #e5e7eb;
  --border-default: #d1d5db;
  --border-strong: #9ca3af;

  /* Text */
  --text-primary: #171717;
  --text-secondary: #525252;
  --text-muted: #737373;
  --text-disabled: #a3a3a3;

  /* Primary - Dark for light mode */
  --primary: #171717;
  --primary-hover: #262626;
  --primary-subtle: rgba(23, 23, 23, 0.08);
  --primary-muted: rgba(23, 23, 23, 0.04);

  /* Semantic */
  --success: #16a34a;
  --success-subtle: rgba(22, 163, 74, 0.1);
  --warning: #d97706;
  --warning-subtle: rgba(217, 119, 6, 0.1);
  --error: #dc2626;
  --error-subtle: rgba(220, 38, 38, 0.1);
  --info: #2563eb;
  --info-subtle: rgba(37, 99, 235, 0.1);
  --info-50: #eff6ff;
  --info-600: #2563eb;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

  /* Card specific */
  --card-bg: #ffffff;
  --card-border: #e5e7eb;
  --card-hover-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* ===== DARK MODE ===== */
[data-theme='dark'] {
  /* Surfaces - Deep Dark with radial gradient */
  --bg-base: #0A0A0B;
  --bg-subtle: #111113;
  --bg-muted: #1a1a1c;
  --bg-elevated: #1f1f23;
  --bg-overlay: rgba(0, 0, 0, 0.75);
  --bg-content: #0A0A0B;

  /* Legacy compatibility */
  --surface-secondary: #1a1a1c;
  --surface-elevated: #1f1f23;
  --border-color: rgba(255, 255, 255, 0.1);

  /* Glass Panel Effect */
  --glass-bg: rgba(31, 31, 35, 0.6);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-blur: blur(16px);

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.05);
  --border-default: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.2);

  /* Text */
  --text-primary: #ffffff;
  --text-secondary: #d4d4d4;
  --text-muted: #a3a3a3;
  --text-disabled: #525252;

  /* Primary - Light for dark mode */
  --primary: #ffffff;
  --primary-hover: #e5e5e5;
  --primary-subtle: rgba(255, 255, 255, 0.1);
  --primary-muted: rgba(255, 255, 255, 0.05);

  /* Semantic */
  --success: #22c55e;
  --success-subtle: rgba(34, 197, 94, 0.15);
  --warning: #f59e0b;
  --warning-subtle: rgba(245, 158, 11, 0.15);
  --error: #ef4444;
  --error-subtle: rgba(239, 68, 68, 0.15);
  --info: #3b82f6;
  --info-subtle: rgba(59, 130, 246, 0.15);
  --info-50: rgba(59, 130, 246, 0.1);
  --info-600: #3b82f6;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);

  /* Card specific */
  --card-bg: var(--glass-bg);
  --card-border: var(--glass-border);
  --card-hover-shadow: 0 0 20px rgba(227, 24, 55, 0.1);
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-base);
  overflow-x: hidden;
}

/* Dark mode radial background */
[data-theme='dark'] body {
  background: radial-gradient(circle at 50% 0%, #1e1114 0%, #0A0A0B 100%);
  background-attachment: fixed;
}

/* Light mode clean white background */
[data-theme='light'] body {
  background: #ffffff;
  background-attachment: unset;
}

/* Light mode main content styling */
[data-theme='light'] .main-content {
  background: var(--bg-base);
}

/* Light mode tab content - no extra padding/margin to match dark mode positioning */

/* Headings use Sora */
h1, h2, h3, h4, h5, h6,
.heading,
.section-title,
.page-title,
.modal-title,
.sidebar-logo-text,
.card-title,
.ad-modal-brand,
.brand-name,
.stat-value {
  font-family: var(--font-heading);
}

/* Code/mono text */
code, pre, .mono, .code {
  font-family: var(--font-mono);
}

/* Material Icons */
.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  font-size: 20px;
  vertical-align: middle;
}

.material-symbols-outlined.filled {
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* ===== Glass Panel Effect (Dark Mode) ===== */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
}

[data-theme='light'] .glass-panel {
  background: var(--card-bg);
  backdrop-filter: none;
  border: 1px solid var(--card-border);
}

.crimson-glow {
  box-shadow: var(--crimson-glow);
}

.crimson-glow-strong {
  box-shadow: var(--crimson-glow-strong);
}

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

/* ===== Sidebar - Always Dark ===== */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  transition: width var(--duration-normal) var(--ease-out);
  backdrop-filter: blur(16px);
}

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

/* Expand sidebar on hover when collapsed */
.sidebar.collapsed:hover {
  width: var(--sidebar-width);
}

.sidebar.collapsed:hover .sidebar-logo-text,
.sidebar.collapsed:hover .nav-section-title,
.sidebar.collapsed:hover .nav-item-label,
.sidebar.collapsed:hover .sidebar-user-info,
.sidebar.collapsed:hover .sidebar-theme-toggle span:not(.material-symbols-outlined) {
  display: block;
}

.sidebar.collapsed:hover .nav-item,
.sidebar.collapsed:hover .sidebar-user,
.sidebar.collapsed:hover .sidebar-theme-toggle {
  justify-content: flex-start;
  padding: 0 var(--space-3);
}

/* Logo Area */
.sidebar-logo {
  height: 64px;
  padding: 0 var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.sidebar-logo-mark {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-lg);
  background: var(--crimson);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--crimson-glow-strong);
}

.sidebar-logo-mark svg,
.sidebar-logo-mark .material-symbols-outlined {
  width: 18px;
  height: 18px;
  color: #ffffff;
  font-size: 18px;
}

/* Consumer Genius Logo Image */
.sidebar-logo-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 0 8px rgba(227, 24, 55, 0.4));
}

.sidebar-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.sidebar-logo-name {
  font-size: var(--text-lg);
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.sidebar-logo-tagline {
  font-size: var(--text-xs);
  color: #a3a3a3;
  font-weight: 500;
}

.sidebar.collapsed .sidebar-logo-text {
  display: none;
}

/* Navigation */
.sidebar-nav {
  flex: 1;
  padding: var(--space-4);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.nav-section {
  margin-bottom: var(--space-4);
}

.nav-section-title {
  font-size: 11px;
  font-weight: 600;
  color: #525252;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-2);
}

.sidebar.collapsed .nav-section-title {
  display: none;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: 40px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-lg);
  color: var(--sidebar-text);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: all var(--duration-normal) var(--ease-out);
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--sidebar-text-active);
}

.nav-item:focus-visible {
  outline: 2px solid var(--crimson);
  outline-offset: -2px;
}

.nav-item.active {
  background: var(--crimson-subtle);
  color: var(--crimson);
  border-right: 2px solid var(--crimson);
}

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

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

.nav-item-icon svg {
  width: 20px;
  height: 20px;
}

.nav-item-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar.collapsed .nav-item-label {
  display: none;
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 0;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: var(--space-4);
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2);
  border-radius: var(--radius-lg);
  cursor: pointer;
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  transition: background var(--duration-fast);
}

.sidebar-user:hover {
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: #404040;
  color: #d4d4d4;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 600;
  flex-shrink: 0;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: var(--text-xs);
  color: #737373;
  text-transform: capitalize;
  font-weight: 500;
}

.sidebar.collapsed .sidebar-user-info {
  display: none;
}

.sidebar.collapsed .sidebar-user {
  justify-content: center;
  padding: var(--space-2);
}

/* Theme Toggle */
.sidebar-theme-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: 40px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-lg);
  color: var(--sidebar-text);
  font-size: var(--text-sm);
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  transition: all var(--duration-fast);
}

.sidebar-theme-toggle:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--sidebar-text-active);
}

.sidebar-theme-toggle svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.sidebar.collapsed .sidebar-theme-toggle span:not(.material-symbols-outlined) {
  display: none;
}

.sidebar.collapsed .sidebar-theme-toggle {
  justify-content: center;
  padding: 0;
}

/* User Dropdown */
.user-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  margin-bottom: var(--space-2);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-2);
  z-index: 50;
}

[data-theme='dark'] .user-dropdown {
  background: #1f1f23;
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme='light'] .user-dropdown {
  background: #ffffff;
  border-color: #e5e7eb;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  background: transparent;
  border: none;
  width: 100%;
  cursor: pointer;
  transition: all var(--duration-fast);
}

.user-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.user-dropdown-item.danger {
  color: var(--error);
}

.user-dropdown-item.danger:hover {
  background: var(--error-subtle);
}

.user-dropdown-email {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--space-2);
  max-width: 100%;
  overflow: hidden;
}

.user-dropdown-email > div {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

/* Sidebar Toggle - Hidden by default, shown on sidebar hover */
.sidebar-toggle {
  position: absolute;
  top: 20px;
  right: -14px;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--duration-fast), opacity 0.2s ease;
  z-index: 50;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
}

/* Show toggle button when hovering over sidebar */
.sidebar:hover .sidebar-toggle {
  opacity: 1;
  pointer-events: auto;
}

[data-theme='dark'] .sidebar-toggle {
  background: #1f1f23;
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme='light'] .sidebar-toggle {
  background: #ffffff;
  border-color: #e5e7eb;
}

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

.sidebar-toggle svg {
  width: 14px;
  height: 14px;
  transition: transform var(--duration-normal);
}

/* Arrow points right when collapsed (to expand) */
.sidebar.collapsed .sidebar-toggle svg,
.sidebar.collapsed .sidebar-toggle .material-symbols-outlined {
  transform: rotate(180deg);
}

/* Arrow points left when temporarily expanded on hover (to collapse/keep collapsed) */
.sidebar.collapsed:hover .sidebar-toggle svg,
.sidebar.collapsed:hover .sidebar-toggle .material-symbols-outlined {
  transform: rotate(0deg);
}

/* ===== Main Content ===== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  padding: var(--space-8);
  transition: margin-left var(--duration-normal) var(--ease-out);
  overflow-x: hidden;
  position: relative;
}

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

/* Tab Content */
.tab-content {
  min-height: calc(100vh - var(--space-8) * 2);
}

/* Ads Grid Container */
#ads-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

@media (min-width: 640px) {
  #ads-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 768px) {
  #ads-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  #ads-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

/* Background glow effects for dark mode only */
[data-theme='dark'] .main-content::before {
  content: '';
  position: fixed;
  top: -200px;
  left: -200px;
  width: 600px;
  height: 600px;
  background: rgba(227, 24, 55, 0.05);
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
}

/* ===== Page Header ===== */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  gap: var(--space-4);
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}

/* Light mode page header - same positioning as dark mode */

.page-title {
  font-size: 30px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.page-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: var(--space-1);
  font-weight: 500;
}

.page-subtitle span {
  font-weight: 600;
  color: var(--text-primary);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 40px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--duration-normal) var(--ease-out);
  white-space: nowrap;
}

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

.btn:focus-visible {
  outline: 2px solid var(--crimson);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--crimson);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(227, 24, 55, 0.3);
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--primary-subtle);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
}

/* Outline button - matches Stitch design */
.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-default);
}

[data-theme='light'] .btn-outline {
  background: #ffffff;
  border-color: #e5e7eb;
}

.btn-outline:hover {
  background: var(--bg-muted);
  border-color: var(--border-strong);
}

[data-theme='light'] .btn-outline:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}

[data-theme='dark'] .btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
  background: var(--primary-muted);
  border-color: var(--border-strong);
}

[data-theme='dark'] .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--primary-subtle);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--error);
  color: white;
}

.btn-danger:hover {
  filter: brightness(1.1);
}

.btn-crimson {
  background: var(--crimson);
  color: white;
  box-shadow: 0 4px 14px rgba(227, 24, 55, 0.3);
}

.btn-crimson:hover {
  filter: brightness(1.1);
}

.btn-sm {
  height: 36px;
  padding: 0 var(--space-3);
  font-size: var(--text-sm);
}

.btn-lg {
  height: 44px;
  padding: 0 var(--space-6);
  font-size: var(--text-base);
}

.btn-icon {
  width: 40px;
  padding: 0;
}

.btn-icon.btn-sm {
  width: 36px;
}

/* ===== Form Elements ===== */
.form-group {
  margin-bottom: var(--space-4);
}

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

.form-input {
  width: 100%;
  height: 40px;
  padding: 0 var(--space-3);
  background: var(--bg-muted);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--text-primary);
  transition: all var(--duration-normal);
}

[data-theme='dark'] .form-input {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

.form-input:focus {
  outline: none;
  border-color: var(--crimson);
  box-shadow: 0 0 0 3px var(--crimson-muted);
}

[data-theme='dark'] .form-input:focus {
  background: rgba(255, 255, 255, 0.08);
}

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

.form-textarea {
  min-height: 80px;
  padding: var(--space-3);
  resize: vertical;
}

/* ===== Cards ===== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

/* Light mode card - white with subtle shadow */
[data-theme='light'] .card {
  background: #ffffff;
  border-color: #e5e7eb;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

[data-theme='dark'] .card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-color: var(--glass-border);
}

.card-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}

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

/* ===== Ad Cards - 9:16 Vertical Cards ===== */
.ad-card {
  position: relative;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
  aspect-ratio: 9/16;
  min-height: 280px; /* Fallback for browsers without aspect-ratio support */
  background: var(--bg-muted);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
}

.ad-card-inner {
  aspect-ratio: 9/16;
  background: var(--bg-muted);
  border-radius: var(--radius-xl);
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border-subtle);
  transition: all var(--duration-normal) var(--ease-out);
}

[data-theme='dark'] .ad-card-inner {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.05);
}

[data-theme='light'] .ad-card-inner {
  background: #f3f4f6;
  border-color: #e5e7eb;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.ad-card:hover .ad-card-inner {
  border-color: var(--crimson);
  box-shadow: var(--card-hover-shadow);
  transform: translateY(-4px);
}

/* Backwards compatibility - old card structure without inner wrapper */
.ad-card:not(:has(.ad-card-inner)) {
  aspect-ratio: 9/16;
  background: var(--bg-muted);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
}

/* Light mode ad cards - match Stitch design */
[data-theme='light'] .ad-card:not(:has(.ad-card-inner)) {
  background: #f3f4f6;
  border-color: #e5e7eb;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

[data-theme='dark'] .ad-card:not(:has(.ad-card-inner)) {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.05);
}

.ad-card:not(:has(.ad-card-inner)):hover {
  border-color: var(--crimson);
  box-shadow: var(--card-hover-shadow);
  transform: translateY(-4px);
}

[data-theme='light'] .ad-card:not(:has(.ad-card-inner)):hover {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.ad-card-media {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: #0a0a0b;
}

.ad-card-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-4);
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, transparent 100%);
  color: white;
}

/* Brand Badge - Top Left */
.ad-card-brand {
  position: absolute;
  top: var(--space-3);
  left: var(--space-3);
  padding: var(--space-1) var(--space-3);
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Action Buttons - Top Right */
.ad-card-actions {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.ad-card-bookmark,
.ad-card-delete {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--duration-fast);
}

.ad-card-bookmark:hover,
.ad-card-delete:hover {
  transform: scale(1.1);
  background: white;
}

.ad-card-bookmark.active {
  background: var(--crimson);
  color: white;
}

.ad-card-delete:hover {
  background: var(--error);
  color: white;
}

.ad-card-bookmark svg,
.ad-card-delete svg {
  width: 16px;
  height: 16px;
}

/* Play Button Overlay */
.ad-card-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--duration-fast);
  box-shadow: var(--shadow-lg);
}

.ad-card:hover .ad-card-play {
  opacity: 1;
}

.ad-card-play svg {
  width: 24px;
  height: 24px;
  color: var(--crimson);
  margin-left: 2px;
}

/* Media Type Badge */
.ad-card-media-type {
  position: absolute;
  top: 44px;
  left: var(--space-3);
  padding: var(--space-1) var(--space-2);
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 600;
  color: white;
  display: flex;
  align-items: center;
  gap: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ad-card-media-type svg {
  width: 10px;
  height: 10px;
}

.ad-card-media-type .material-symbols-outlined {
  font-size: 12px;
}

/* Variants Badge (shows when hide duplicates is on) */
.ad-card-variants {
  position: absolute;
  top: 44px;
  right: var(--space-3);
  padding: var(--space-1) var(--space-2);
  background: rgba(227, 24, 55, 0.9);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 600;
  color: white;
  display: flex;
  align-items: center;
  gap: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ad-card-variants .material-symbols-outlined {
  font-size: 11px;
}

/* Active/Inactive Badge */
.ad-card-status {
  position: absolute;
  top: var(--space-3);
  left: var(--space-3);
  padding: var(--space-1) var(--space-3);
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.ad-card-status.active {
  color: white;
}

.ad-card-status.active::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--crimson);
  animation: pulse-dot 2s infinite;
}

.ad-card-status.inactive {
  color: #a3a3a3;
}

.ad-card-status.inactive::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #525252;
}

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

/* Score Ring */
.ad-card-score-ring {
  position: absolute;
  top: var(--space-3);
  right: 48px;
  width: 32px;
  height: 32px;
}

.ad-card-score-ring svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.ad-card-score-ring .ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.2);
  stroke-width: 3;
}

.ad-card-score-ring .ring-progress {
  fill: none;
  stroke: var(--crimson);
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dashoffset var(--duration-slow);
}

.ad-card-score-ring .score-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.ad-card-headline {
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ad-card-tags {
  display: flex;
  gap: 4px;
  margin-top: var(--space-2);
  flex-wrap: wrap;
}

.ad-card-tag {
  font-size: 10px;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

/* Card Info Below */
.ad-card-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-1);
  margin-top: var(--space-2);
}

.ad-card-info-left {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.ad-card-brand-logo {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  background: var(--bg-muted);
  object-fit: cover;
}

.ad-card-brand-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.ad-card-date {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.ad-card-type-badge {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-muted);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

/* ===== Ad Card Selection Mode ===== */
.ad-card-select {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: 15;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--duration-fast);
}

.ad-card.selection-mode .ad-card-select,
.ad-card:hover .ad-card-select {
  opacity: 1;
}

.ad-card-checkbox {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.ad-card-checkmark {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast);
}

.ad-card-checkmark svg {
  width: 14px;
  height: 14px;
  color: white;
  opacity: 0;
  transform: scale(0.5);
  transition: all var(--duration-fast);
}

.ad-card-checkbox:checked + .ad-card-checkmark {
  background: var(--crimson);
  border-color: var(--crimson);
}

.ad-card-checkbox:checked + .ad-card-checkmark svg {
  opacity: 1;
  transform: scale(1);
}

.ad-card.selected {
  border-color: var(--crimson);
  box-shadow: 0 0 0 2px var(--crimson-subtle);
}

.ad-card.selection-mode {
  cursor: pointer;
}

/* ===== Bulk Actions Bar ===== */
.bulk-actions-bar {
  position: fixed;
  bottom: var(--space-6);
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-2xl);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  box-shadow: var(--shadow-xl);
  z-index: 100;
  opacity: 0;
  transition: all var(--duration-normal) var(--ease-out);
}

[data-theme='dark'] .bulk-actions-bar {
  background: #1f1f23;
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme='light'] .bulk-actions-bar {
  background: #ffffff;
  border-color: #e5e7eb;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.bulk-actions-bar.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.bulk-actions-count {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  padding-right: var(--space-4);
  border-right: 1px solid var(--border-default);
}

.bulk-actions-buttons {
  display: flex;
  gap: var(--space-2);
}

.bulk-actions-bar .btn {
  height: 36px;
  padding: 0 var(--space-3);
}

.bulk-actions-close {
  width: 28px;
  height: 28px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--duration-fast);
}

.bulk-actions-close:hover {
  background: var(--primary-subtle);
  color: var(--text-primary);
}

/* ===== Tables ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-default);
  background: var(--bg-subtle);
}

[data-theme='dark'] .data-table th {
  background: rgba(255, 255, 255, 0.02);
}

[data-theme='light'] .data-table th {
  background: #f9fafb;
}

.data-table td {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
}

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

.data-table tbody tr:hover {
  background: var(--primary-subtle);
}

[data-theme='light'] .data-table tbody tr:hover {
  background: #f9fafb;
}

[data-theme='dark'] .data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.data-table tbody tr:hover td {
  color: var(--text-primary);
}

/* Table Action Buttons */
.table-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--duration-fast);
}

.table-action-btn.action-scrape {
  background: var(--primary-subtle);
  color: var(--text-primary);
}

[data-theme='dark'] .table-action-btn.action-scrape {
  background: rgba(255, 255, 255, 0.05);
}

.table-action-btn.action-scrape:hover {
  background: var(--primary-muted);
}

[data-theme='dark'] .table-action-btn.action-scrape:hover {
  background: rgba(255, 255, 255, 0.1);
}

.table-action-btn.action-edit {
  background: transparent;
  color: var(--text-secondary);
}

.table-action-btn.action-edit:hover {
  color: var(--text-primary);
  background: var(--primary-subtle);
}

.table-action-btn.action-delete {
  background: var(--error-subtle);
  color: var(--error);
}

.table-action-btn.action-delete:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  animation: fadeIn var(--duration-fast) var(--ease-out);
}

.modal-container {
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: slideUp var(--duration-normal) var(--ease-out);
  box-shadow: var(--shadow-xl);
}

[data-theme='dark'] .modal-container {
  background: #1a1a1c;
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme='light'] .modal-container {
  background: #ffffff;
  border-color: #e5e7eb;
}

.modal-content {
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: slideUp var(--duration-normal) var(--ease-out);
  box-shadow: var(--shadow-xl);
}

[data-theme='dark'] .modal-content {
  background: #1a1a1c;
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme='light'] .modal-content {
  background: #ffffff;
  border-color: #e5e7eb;
}

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

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

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

.modal-close:hover,
.modal-close-btn:hover {
  background: var(--primary-subtle);
  color: var(--text-primary);
}

.modal-body {
  padding: var(--space-5);
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
}

/* ===== Ad Modal ===== */
.ad-modal-container {
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: scaleIn var(--duration-normal) var(--ease-out);
  box-shadow: var(--shadow-xl);
}

[data-theme='dark'] .ad-modal-container {
  background: #1a1a1c;
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme='light'] .ad-modal-container {
  background: #ffffff;
  border-color: #e5e7eb;
}

.ad-modal-close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  cursor: pointer;
  color: white;
  transition: all var(--duration-fast);
  z-index: 10;
}

.ad-modal-close:hover {
  background: rgba(0, 0, 0, 0.7);
}

.ad-modal-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 90vh;
  overflow: hidden;
}

@media (min-width: 768px) {
  .ad-modal-content {
    flex-direction: row;
  }
}

.ad-modal-media {
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .ad-modal-media {
    width: 45%;
    min-height: unset;
  }
}

.ad-modal-media-inner {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.ad-modal-video,
.ad-modal-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.ad-modal-details {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

@media (min-width: 768px) {
  .ad-modal-details {
    width: 55%;
  }
}

.ad-modal-section {
  max-width: 100%;
  overflow-x: hidden;
  word-wrap: break-word;
  overflow-wrap: break-word;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}

.ad-modal-section:last-child {
  border-bottom: none;
}

.ad-modal-body,
.ai-section-content,
.ai-section-list {
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

.ad-modal-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  background: var(--bg-subtle);
  z-index: 5;
}

[data-theme='dark'] .ad-modal-header {
  background: #1a1a1c;
}

[data-theme='light'] .ad-modal-header {
  background: #ffffff;
}

.ad-modal-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--crimson);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: var(--text-base);
  flex-shrink: 0;
}

.ad-modal-avatar-img {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  object-fit: cover;
  flex-shrink: 0;
}

.ad-modal-section-title {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-3);
}

.ad-modal-headline {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

.ad-modal-body {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.7;
  max-height: 200px;
  overflow-y: auto;
}

.ad-modal-body p {
  margin: 0;
}

.ad-modal-body p + p {
  margin-top: var(--space-3);
}

/* AI Analysis Section */
.ad-modal-dimensions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--primary-subtle);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

[data-theme='dark'] .ad-modal-dimensions {
  background: rgba(255, 255, 255, 0.03);
}

.ad-modal-dimension {
  font-size: var(--text-xs);
}

.ad-modal-dimension-label {
  color: var(--text-muted);
}

.ad-modal-dimension-value {
  font-weight: 600;
  color: var(--text-primary);
  margin-left: var(--space-1);
}

.ai-section-label {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-2);
}

.ai-section-content {
  font-size: var(--text-sm);
  color: var(--text-primary);
  line-height: 1.6;
}

.ai-section-list {
  font-size: var(--text-sm);
  color: var(--text-primary);
  list-style: disc;
  padding-left: var(--space-5);
  line-height: 1.6;
}

.ai-section-list li {
  margin-bottom: var(--space-1);
}

/* Tags in AI Analysis */
.ad-modal-tag {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  background: var(--primary-subtle);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: 500;
  border: 1px solid var(--border-subtle);
}

[data-theme='dark'] .ad-modal-tag {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

/* Score Badge */
.ad-modal-score {
  display: flex;
  align-items: baseline;
  gap: 2px;
  background: var(--crimson);
  color: white;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
}

.ad-modal-score-value {
  font-size: var(--text-xl);
  font-weight: 700;
}

.ad-modal-score-label {
  font-size: var(--text-sm);
  opacity: 0.8;
}

/* CTA Section */
.ad-modal-cta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--primary-subtle);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
}

[data-theme='dark'] .ad-modal-cta {
  background: rgba(255, 255, 255, 0.05);
}

.ad-modal-cta-label {
  color: var(--text-muted);
  font-weight: 500;
}

/* Action Buttons Row */
.ad-modal-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.ad-modal-meta-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: #1877f2;
  color: white;
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: background var(--duration-fast);
}

.ad-modal-meta-link:hover {
  background: #166fe5;
}

.ad-modal-bookmark-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--primary-subtle);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--duration-fast);
}

[data-theme='dark'] .ad-modal-bookmark-link {
  background: rgba(255, 255, 255, 0.05);
}

.ad-modal-bookmark-link:hover {
  background: var(--primary-muted);
  color: var(--text-primary);
}

[data-theme='dark'] .ad-modal-bookmark-link:hover {
  background: rgba(255, 255, 255, 0.1);
}

.ad-modal-bookmark-link.active {
  background: var(--crimson);
  color: white;
}

.ad-modal-share-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--primary-subtle);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--duration-fast);
}

[data-theme='dark'] .ad-modal-share-btn {
  background: rgba(255, 255, 255, 0.05);
}

.ad-modal-share-btn:hover {
  background: var(--primary-muted);
  color: var(--text-primary);
}

.ad-modal-share-dropdown {
  position: relative;
}

.ad-modal-share-menu {
  position: fixed;
  min-width: 180px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  z-index: 1000;
  overflow: hidden;
}

[data-theme='dark'] .ad-modal-share-menu {
  background: #1f1f23;
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme='light'] .ad-modal-share-menu {
  background: #ffffff;
  border-color: #e5e7eb;
}

.ad-modal-share-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  text-align: left;
  cursor: pointer;
  transition: all var(--duration-fast);
}

.ad-modal-share-item:hover {
  background: var(--primary-subtle);
  color: var(--text-primary);
}

[data-theme='dark'] .ad-modal-share-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.ad-modal-share-item:first-child {
  border-bottom: 1px solid var(--border-subtle);
}

.ad-modal-share-item svg {
  flex-shrink: 0;
}

.ad-modal-share-item:last-child:hover {
  color: #4A154B;
}

.ad-modal-analyze-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 44px;
  padding: 0 var(--space-4);
  background: var(--crimson);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration-fast);
  box-shadow: 0 4px 14px rgba(227, 24, 55, 0.3);
}

.ad-modal-analyze-btn:hover {
  filter: brightness(1.1);
}

.ad-modal-analyze-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.ad-modal-script-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 44px;
  padding: 0 var(--space-4);
  background: var(--primary-subtle);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  cursor: pointer;
  transition: all var(--duration-fast);
  white-space: nowrap;
}

[data-theme='dark'] .ad-modal-script-btn {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

.ad-modal-script-btn:hover {
  background: var(--primary-muted);
  border-color: var(--border-strong);
}

/* ===== Toast Notifications ===== */
.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  max-width: 400px;
  animation: slideInRight var(--duration-normal) var(--ease-out);
}

[data-theme='dark'] .toast {
  background: #1f1f23;
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme='light'] .toast {
  background: #ffffff;
  border-color: #e5e7eb;
}

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

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

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

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

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon { color: var(--error); }
.toast-info .toast-icon { color: var(--info); }
.toast-warning .toast-icon { color: var(--warning); }

.toast-content {
  flex: 1;
  min-width: 0;
}

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

.toast-message {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin-top: 2px;
}

.toast-close {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--duration-fast);
}

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

/* ===== Filter Bar ===== */
.filter-bar {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  position: relative;
  z-index: 10;
}

.filter-bar-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.filter-dropdown {
  position: relative;
}

.filter-dropdown-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: 40px;
  padding: 0 var(--space-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--duration-fast);
  min-width: 120px;
}

[data-theme='light'] .filter-dropdown-btn {
  background: #ffffff;
  border-color: #e5e7eb;
}

[data-theme='dark'] .filter-dropdown-btn {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

.filter-dropdown-btn:hover {
  border-color: var(--border-strong);
  background: var(--bg-muted);
}

[data-theme='light'] .filter-dropdown-btn:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}

[data-theme='dark'] .filter-dropdown-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.filter-dropdown-btn.active {
  border-color: var(--crimson);
  background: var(--crimson-subtle);
}

.filter-dropdown-menu {
  position: absolute;
  top: calc(100% + var(--space-1));
  left: 0;
  min-width: 200px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  padding: var(--space-2);
  animation: scaleIn var(--duration-fast) var(--ease-out);
}

[data-theme='dark'] .filter-dropdown-menu {
  background: #1f1f23;
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme='light'] .filter-dropdown-menu {
  background: #ffffff;
  border-color: #e5e7eb;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--duration-fast);
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.filter-option:hover {
  background: var(--primary-subtle);
  color: var(--text-primary);
}

[data-theme='dark'] .filter-option:hover {
  background: rgba(255, 255, 255, 0.05);
}

.filter-option.selected {
  background: var(--crimson-subtle);
  color: var(--crimson);
}

/* ===== Hide Duplicates Toggle ===== */
.filter-toggle-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: 40px;
  padding: 0 var(--space-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast);
  white-space: nowrap;
}

.filter-toggle-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.filter-toggle-btn.active {
  background: var(--crimson-subtle);
  border-color: var(--crimson);
  color: var(--crimson);
}

[data-theme='light'] .filter-toggle-btn {
  background: #ffffff;
  border-color: #e5e7eb;
}

[data-theme='light'] .filter-toggle-btn.active {
  background: rgba(227, 24, 55, 0.1);
  border-color: var(--crimson);
}

[data-theme='dark'] .filter-toggle-btn {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme='dark'] .filter-toggle-btn.active {
  background: rgba(227, 24, 55, 0.15);
  border-color: var(--crimson);
}

/* ===== Filter Presets ===== */
.preset-btn {
  border: 1px dashed var(--border-default);
  background: transparent;
}

.preset-btn:hover {
  border-style: solid;
  background: var(--primary-subtle);
}

.preset-count {
  background: var(--crimson);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  margin-left: var(--space-1);
}

.preset-menu {
  min-width: 240px;
}

.preset-save-section {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-1);
}

.preset-name-input {
  flex: 1;
  height: 32px;
  padding: 0 var(--space-3);
  background: var(--bg-base);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.preset-name-input:focus {
  outline: none;
  border-color: var(--crimson);
}

.preset-save-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--crimson);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: filter var(--duration-fast);
}

.preset-save-btn:hover {
  filter: brightness(1.1);
}

.preset-divider {
  height: 1px;
  background: var(--border-default);
  margin: var(--space-2) 0;
}

.preset-list {
  max-height: 200px;
  overflow-y: auto;
}

.preset-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--duration-fast);
}

.preset-item:hover {
  background: var(--primary-subtle);
}

[data-theme='dark'] .preset-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

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

.preset-item:hover .preset-name {
  color: var(--text-primary);
}

.preset-delete {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  transition: all var(--duration-fast);
}

.preset-item:hover .preset-delete {
  opacity: 1;
}

.preset-delete:hover {
  background: var(--error-subtle);
  color: var(--error);
}

.preset-empty {
  padding: var(--space-4);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.filter-bar-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2) var(--space-1) var(--space-3);
  background: var(--crimson-subtle);
  color: var(--crimson);
  border: 1px solid var(--crimson);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
}

.filter-chip-remove {
  width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  color: inherit;
  transition: background var(--duration-fast);
}

.filter-chip-remove:hover {
  background: rgba(227, 24, 55, 0.2);
}

.filter-clear-all {
  font-size: var(--text-xs);
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  transition: all var(--duration-fast);
}

.filter-clear-all:hover {
  color: var(--text-primary);
  background: var(--primary-subtle);
}

/* ===== Bookmark Folders ===== */
.bookmarks-layout {
  display: flex;
  gap: var(--space-6);
}

.folders-sidebar {
  width: 220px;
  flex-shrink: 0;
}

.bookmarks-content {
  flex: 1;
  min-width: 0;
}

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

.folder-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: transparent;
  border: none;
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--duration-fast);
  text-align: left;
  width: 100%;
}

.folder-item:hover {
  background: var(--primary-subtle);
  color: var(--text-primary);
}

[data-theme='dark'] .folder-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.folder-item.active {
  background: var(--crimson-subtle);
  color: var(--crimson);
}

.folder-item span:first-of-type {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-count {
  font-size: var(--text-xs);
  color: var(--text-muted);
  background: var(--bg-muted);
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

[data-theme='dark'] .folder-count {
  background: rgba(255, 255, 255, 0.1);
}

.folder-item.active .folder-count {
  background: var(--crimson);
  color: white;
}

.folders-divider {
  height: 1px;
  background: var(--border-default);
  margin: var(--space-2) 0;
}

.user-folder-item {
  position: relative;
}

.user-folder-item .folder-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.user-folder-item .folder-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

/* Drag and Drop */
.ad-card.dragging {
  opacity: 0.5;
  transform: scale(0.95);
}

.folder-item.drag-over {
  background: var(--crimson-subtle);
  border: 2px dashed var(--crimson);
  color: var(--crimson);
  transform: scale(1.02);
}

.folder-item.drag-over .folder-icon {
  animation: pulse 0.5s ease-in-out infinite alternate;
}

body.dragging-ads .folders-sidebar {
  background: var(--bg-elevated);
  border: 2px dashed var(--border-default);
  border-radius: var(--radius-lg);
}

[data-theme='dark'] body.dragging-ads .folders-sidebar {
  background: rgba(255, 255, 255, 0.02);
}

body.dragging-ads .folder-item:not(.drag-over) {
  opacity: 0.7;
}

/* Folder Color Picker */
.folder-color-picker {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.color-option {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--duration-fast);
}

.color-option:hover {
  transform: scale(1.1);
}

.color-option.active {
  border-color: var(--text-primary);
  box-shadow: 0 0 0 2px var(--bg-base);
}

/* Responsive: Hide sidebar on mobile */
@media (max-width: 768px) {
  .bookmarks-layout {
    flex-direction: column;
  }

  .folders-sidebar {
    width: 100%;
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border-default);
    margin-bottom: var(--space-4);
  }

  .folders-list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .folder-item {
    width: auto;
  }
}

/* ===== Search Input ===== */
.search-input-container {
  position: relative;
  flex: 1;
  max-width: 400px;
}

.search-input {
  width: 100%;
  height: 40px;
  padding: 0 var(--space-3) 0 var(--space-10);
  background: var(--bg-muted);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--text-primary);
  transition: all var(--duration-fast);
}

/* Light mode search - match Stitch design */
[data-theme='light'] .search-input {
  background: #f9fafb;
  border-color: #e5e7eb;
}

[data-theme='light'] .search-input:focus {
  background: #ffffff;
}

[data-theme='dark'] .search-input {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

.search-input:focus {
  outline: none;
  border-color: var(--crimson);
  box-shadow: 0 0 0 2px var(--crimson-muted);
}

[data-theme='dark'] .search-input:focus {
  background: rgba(255, 255, 255, 0.08);
}

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

.search-input-icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

/* ===== Status Badges ===== */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-md);
  font-size: 11px;
  font-weight: 600;
}

.status-badge-active,
.status-badge.fresh {
  background: var(--success-subtle);
  color: var(--success);
}

.status-badge-inactive {
  background: var(--error-subtle);
  color: var(--error);
}

.status-badge-pending,
.status-badge.stale {
  background: var(--warning-subtle);
  color: var(--warning);
}

.status-badge.outdated {
  background: var(--error-subtle);
  color: var(--error);
}

.status-badge.never {
  background: var(--primary-subtle);
  color: var(--text-muted);
}

[data-theme='dark'] .status-badge.never {
  background: rgba(255, 255, 255, 0.05);
}

.status-badge-running {
  background: var(--info-subtle);
  color: var(--info);
}

/* Ad Count Badge */
.ad-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 700;
  font-family: var(--font-heading);
  background: var(--primary-subtle);
  color: var(--text-muted);
}

[data-theme='dark'] .ad-count-badge {
  background: rgba(255, 255, 255, 0.05);
}

.ad-count-badge.has-ads {
  background: var(--crimson-subtle);
  color: var(--crimson);
}

/* Last Scraped Time */
.last-scraped-time {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* ===== Skeleton Loading ===== */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-muted) 25%,
    var(--bg-elevated) 50%,
    var(--bg-muted) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

[data-theme='dark'] .skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.03) 25%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.03) 75%
  );
  background-size: 200% 100%;
}

.skeleton-card {
  pointer-events: none;
  overflow: hidden;
}

.skeleton-card .skeleton {
  position: absolute;
}

/* ===== Spinner ===== */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-default);
  border-top-color: var(--crimson);
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
}

.spinner-sm {
  width: 16px;
  height: 16px;
}

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

/* ===== Script Modal ===== */
.script-modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
}

.script-modal-container {
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
}

[data-theme='dark'] .script-modal-container {
  background: #1a1a1c;
  border-color: rgba(255, 255, 255, 0.1);
}

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

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

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

.script-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-5);
}

.script-modal-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
}

.script-section {
  margin-bottom: var(--space-5);
}

.script-section:last-child {
  margin-bottom: 0;
}

.script-section-title {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-2);
}

.script-text {
  font-size: var(--text-sm);
  color: var(--text-primary);
  line-height: 1.7;
  white-space: pre-wrap;
  background: var(--primary-subtle);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  max-height: 200px;
  overflow-y: auto;
}

[data-theme='dark'] .script-text {
  background: rgba(255, 255, 255, 0.03);
}

.script-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--crimson);
  color: white;
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: filter var(--duration-fast);
}

.script-copy-btn:hover {
  filter: brightness(1.1);
}

.script-cached-badge {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  background: var(--success-subtle);
  color: var(--success);
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
  margin-bottom: var(--space-3);
}

/* ===== Scrape Panel ===== */
#scrape-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-xl);
  border-radius: var(--radius-lg);
}

[data-theme='dark'] #scrape-panel {
  background: #1f1f23;
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme='light'] #scrape-panel {
  background: #ffffff;
  border-color: #e5e7eb;
  color: #171717;
}

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

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

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

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

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

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

/* ===== Utility Classes ===== */
.hidden {
  display: none !important;
}

.animate-spin {
  animation: spin 0.8s linear infinite;
}

.animate-pulse {
  animation: pulse 2s infinite;
}

/* ===== Mobile Styles ===== */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width);
  }

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

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

  .main-content {
    margin-left: 0;
    padding: var(--space-4);
  }

  .sidebar.collapsed ~ .main-content {
    margin-left: 0;
  }

  .sidebar-toggle {
    display: none;
  }

  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    padding: 0 var(--space-4);
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--sidebar-border);
    position: sticky;
    top: 0;
    z-index: 30;
  }

  .mobile-menu-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    border: none;
    background: transparent;
    color: #ffffff;
    cursor: pointer;
  }

  .mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 35;
    display: none;
  }

  .mobile-overlay.open {
    display: block;
  }

  .ad-modal-container {
    max-height: 95vh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    margin-top: auto;
  }

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

  .page-title {
    font-size: 24px;
  }
}

@media (min-width: 769px) {
  .mobile-header,
  .mobile-overlay {
    display: none !important;
  }
}

/* ===== Scrollbar Styling ===== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}

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

/* ===== Ad Copy Styling ===== */
.ad-copy-hashtag {
  color: var(--info);
  font-weight: 500;
}

.ad-copy-mention {
  color: var(--info);
  font-weight: 500;
}

/* ===== Empty States ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12);
  text-align: center;
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  color: var(--text-disabled);
  margin-bottom: var(--space-4);
}

.empty-state-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.empty-state-description {
  font-size: var(--text-sm);
  color: var(--text-muted);
  max-width: 400px;
}

/* ===== Filter Count Badge ===== */
.filter-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--crimson);
  color: white;
  font-size: 10px;
  font-weight: 700;
  border-radius: var(--radius-full);
  margin-left: var(--space-2);
}

/* ===== Confirm Modal ===== */
.confirm-modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(4px);
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  animation: fadeIn var(--duration-fast) var(--ease-out);
}

.confirm-modal {
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  animation: scaleIn var(--duration-normal) var(--ease-out);
  overflow: hidden;
}

[data-theme='dark'] .confirm-modal {
  background: #1a1a1c;
  border-color: rgba(255, 255, 255, 0.1);
}

.confirm-modal-header {
  padding: var(--space-5) var(--space-5) var(--space-3);
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
}

.confirm-modal-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.confirm-modal-icon.danger {
  background: var(--error-subtle);
  color: var(--error);
}

.confirm-modal-icon.warning {
  background: var(--warning-subtle);
  color: var(--warning);
}

.confirm-modal-icon.info {
  background: var(--info-subtle);
  color: var(--info);
}

.confirm-modal-icon svg {
  width: 20px;
  height: 20px;
}

.confirm-modal-content {
  flex: 1;
}

.confirm-modal-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.confirm-modal-message {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.6;
}

.confirm-modal-footer {
  padding: var(--space-4) var(--space-5);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  border-top: 1px solid var(--border-subtle);
}

.confirm-modal-btn {
  height: 36px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--duration-fast) var(--ease-out);
}

.confirm-modal-btn.cancel {
  background: var(--primary-subtle);
  color: var(--text-primary);
}

[data-theme='dark'] .confirm-modal-btn.cancel {
  background: rgba(255, 255, 255, 0.05);
}

.confirm-modal-btn.cancel:hover {
  background: var(--primary-muted);
}

[data-theme='dark'] .confirm-modal-btn.cancel:hover {
  background: rgba(255, 255, 255, 0.1);
}

.confirm-modal-btn.confirm {
  background: var(--crimson);
  color: white;
}

.confirm-modal-btn.confirm:hover {
  filter: brightness(1.1);
}

.confirm-modal-btn.danger {
  background: var(--error);
  color: white;
}

.confirm-modal-btn.danger:hover {
  filter: brightness(1.1);
}

/* ===== Settings Page ===== */
[data-theme='dark'] #tab-settings .rounded-xl {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border-color: var(--glass-border);
}

/* Toggle Switch Styling */
#auto-scrape-toggle:checked + div {
  background: var(--crimson) !important;
}
