/* HeyGen Video Creator - Modern Design System */

:root {
  /* Colors */
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --primary-500: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;
  --primary-900: #1e3a8a;
  
  --success-50: #ecfdf5;
  --success-100: #d1fae5;
  --success-500: #10b981;
  --success-600: #059669;
  
  --warning-50: #fffbeb;
  --warning-100: #fef3c7;
  --warning-500: #f59e0b;
  --warning-600: #d97706;
  
  --error-50: #fef2f2;
  --error-100: #fee2e2;
  --error-500: #ef4444;
  --error-600: #dc2626;
  
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  
  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  
  /* Spacing */
  --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;
  --space-16: 4rem;
  --space-20: 5rem;
  
  /* Border radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  
  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset and base styles */
* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  margin: 0;
  padding: 0;
  background: #ffffff;
  color: var(--gray-900);
  line-height: 1.6;
  min-height: 100vh;
}

/* Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-6);
  background: #f8fafc;
  min-height: calc(100vh - 80px);
}

/* Navigation */
.topnav {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  border: none;
  border-radius: 0;
  padding: var(--space-4) var(--space-8);
  margin: 0;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.topnav .nav-brand {
  color: #ffffff;
  font-size: 1.5rem;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, #3b82f6 0%, #10b981 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.topnav .nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.topnav a {
  color: #e2e8f0;
  text-decoration: none;
  font-weight: 600;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
  position: relative;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}

.topnav a:hover {
  color: #ffffff;
  background: rgba(59, 130, 246, 0.15);
  transform: translateY(-1px);
}

.topnav a.active {
  color: #ffffff;
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

/* Header */
.page-header {
  text-align: center;
  padding: var(--space-16) var(--space-6) var(--space-12);
  background: #000000;
  color: white;
  margin-bottom: 0;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.9);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.page-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    radial-gradient(circle, rgba(255, 255, 255, 0.8) 1.5px, transparent 1.5px),
    radial-gradient(circle, rgba(255, 255, 255, 0.6) 1px, transparent 1px),
    radial-gradient(circle, rgba(255, 255, 255, 0.4) 1.2px, transparent 1.2px);
  background-size: 
    50px 50px,
    80px 80px,
    120px 120px;
  background-position: 
    0 0,
    20px 20px,
    40px 40px;
  animation: dot-flow 20s linear infinite;
  pointer-events: none;
  opacity: 0.3;
}

.page-header::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    radial-gradient(circle, rgba(255, 255, 255, 0.9) 2px, transparent 2px),
    radial-gradient(circle, rgba(255, 255, 255, 0.5) 1.5px, transparent 1.5px);
  background-size: 
    100px 100px,
    150px 150px;
  background-position: 
    10px 10px,
    60px 60px;
  animation: dot-flow-reverse 25s linear infinite;
  pointer-events: none;
  opacity: 0.2;
}

@keyframes dot-flow {
  0% { 
    transform: translate(0, 0);
    opacity: 0.3;
  }
  50% { 
    transform: translate(-100px, -50px);
    opacity: 0.5;
  }
  100% { 
    transform: translate(0, 0);
    opacity: 0.3;
  }
}

@keyframes dot-flow-reverse {
  0% { 
    transform: translate(0, 0) scale(1);
    opacity: 0.2;
  }
  50% { 
    transform: translate(80px, 40px) scale(1.1);
    opacity: 0.4;
  }
  100% { 
    transform: translate(0, 0) scale(1);
    opacity: 0.2;
  }
}

/* Geometric shapes animation */
.page-header .geometric-shapes {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  overflow: hidden;
}

.page-header .shape {
  position: absolute;
  opacity: 0.4;
  animation: float-shapes 20s linear infinite;
  filter: drop-shadow(0 0 8px currentColor);
}

.page-header .triangle {
  width: 0;
  height: 0;
  border-left: 25px solid transparent;
  border-right: 25px solid transparent;
  border-bottom: 40px solid currentColor;
  position: relative;
}

.page-header .triangle::before {
  content: '';
  position: absolute;
  top: 2px;
  left: -22px;
  width: 0;
  height: 0;
  border-left: 22px solid transparent;
  border-right: 22px solid transparent;
  border-bottom: 36px solid rgba(255, 255, 255, 0.2);
  z-index: 1;
}

.page-header .diamond {
  width: 30px;
  height: 30px;
  background: currentColor;
  transform: rotate(45deg);
  position: relative;
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.1);
}

.page-header .diamond::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  right: 2px;
  bottom: 2px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.page-header .circle {
  width: 24px;
  height: 24px;
  background: currentColor;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.3);
  box-shadow: inset 0 0 8px rgba(255, 255, 255, 0.1);
  position: relative;
}

.page-header .circle::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 8px;
  height: 8px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 50%;
}

.page-header .hexagon {
  width: 26px;
  height: 26px;
  background: currentColor;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  border: 2px solid rgba(255, 255, 255, 0.3);
  position: relative;
  filter: drop-shadow(0 0 6px currentColor);
}

.page-header .hexagon::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  right: 2px;
  bottom: 2px;
  background: linear-gradient(45deg, rgba(255, 255, 255, 0.2), transparent);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

.page-header .shape:nth-child(1) {
  color: #3b82f6;
  top: 20%;
  left: 10%;
  animation-delay: 0s;
  animation-duration: 20s;
}

.page-header .shape:nth-child(2) {
  color: #10b981;
  top: 60%;
  left: 80%;
  animation-delay: -5s;
  animation-duration: 25s;
}

.page-header .shape:nth-child(3) {
  color: #8b5cf6;
  top: 30%;
  left: 70%;
  animation-delay: -10s;
  animation-duration: 18s;
}

.page-header .shape:nth-child(4) {
  color: #f59e0b;
  top: 80%;
  left: 20%;
  animation-delay: -15s;
  animation-duration: 22s;
}

.page-header .shape:nth-child(5) {
  color: #ef4444;
  top: 10%;
  left: 60%;
  animation-delay: -8s;
  animation-duration: 28s;
}

.page-header .shape:nth-child(6) {
  color: #06b6d4;
  top: 70%;
  left: 50%;
  animation-delay: -12s;
  animation-duration: 24s;
}

@keyframes float-shapes {
  0% {
    transform: translateY(0px) translateX(0px) rotate(0deg) scale(1);
    opacity: 0.4;
    filter: drop-shadow(0 0 8px currentColor) hue-rotate(0deg);
  }
  25% {
    transform: translateY(-30px) translateX(-15px) rotate(90deg) scale(1.1);
    opacity: 0.6;
    filter: drop-shadow(0 0 12px currentColor) hue-rotate(90deg);
  }
  50% {
    transform: translateY(-60px) translateX(0px) rotate(180deg) scale(1.2);
    opacity: 0.8;
    filter: drop-shadow(0 0 16px currentColor) hue-rotate(180deg);
  }
  75% {
    transform: translateY(-30px) translateX(15px) rotate(270deg) scale(1.1);
    opacity: 0.6;
    filter: drop-shadow(0 0 12px currentColor) hue-rotate(270deg);
  }
  100% {
    transform: translateY(0px) translateX(0px) rotate(360deg) scale(1);
    opacity: 0.4;
    filter: drop-shadow(0 0 8px currentColor) hue-rotate(360deg);
  }
}

.page-header h1 {
  margin: 0 0 var(--space-4);
  font-size: 3.5rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  position: relative;
  z-index: 10;
  color: #ffffff;
  text-shadow: 
    0 0 30px rgba(255, 255, 255, 0.8),
    0 0 60px rgba(59, 130, 246, 0.6),
    0 4px 20px rgba(0, 0, 0, 0.9);
  filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.5));
}

.page-header p {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 500;
  position: relative;
  z-index: 10;
  color: #ffffff;
  text-shadow: 
    0 0 20px rgba(255, 255, 255, 0.6),
    0 2px 8px rgba(0, 0, 0, 0.9), 
    0 1px 4px rgba(0, 0, 0, 0.7),
    1px 1px 0px rgba(0, 0, 0, 0.8);
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.2));
}

/* Cards */
.card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  margin: var(--space-6) 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  transform: translateY(-4px);
}

.card h2 {
  color: #1e293b;
  margin: 0 0 var(--space-6);
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.card h3 {
  color: #334155;
  margin: var(--space-6) 0 var(--space-4);
  font-size: 1.25rem;
  font-weight: 600;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border: none;
  border-radius: var(--radius-lg);
  font-weight: 500;
  font-size: 0.875rem;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.btn:before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left var(--transition-slow);
}

.btn:hover:before {
  left: 100%;
}

.btn-primary {
  background: #2563eb;
  color: white;
  border: 1px solid #2563eb;
}

.btn-primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(37, 99, 235, 0.3);
}

.btn-success {
  background: #059669;
  color: white;
  border: 1px solid #059669;
}

.btn-success:hover {
  background: #047857;
  border-color: #047857;
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(5, 150, 105, 0.3);
}

.btn-warning {
  background: var(--warning-500);
  color: white;
}

.btn-warning:hover {
  background: var(--warning-600);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-danger {
  background: #dc2626;
  color: white;
  border: 1px solid #dc2626;
}

.btn-danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(220, 38, 38, 0.3);
}

.btn-secondary {
  background: #f1f5f9;
  color: #374151;
  border: 1px solid #cbd5e1;
}

.btn-secondary:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Form elements */
input, select, textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 2px solid #cbd5e1;
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  transition: all var(--transition-fast);
  background: white;
  font-weight: 500;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
  transform: scale(1.01);
}

label {
  display: block;
  margin-bottom: var(--space-2);
  font-weight: 700;
  color: #1e293b;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}

/* Status indicators */
.status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.status.processing {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fbbf24;
}

.status.completed {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #10b981;
}

.status.failed {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #ef4444;
}

.status.queued {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #3b82f6;
}

.status.waiting {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #9ca3af;
}

/* Progress bars */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--gray-200);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin: var(--space-4) 0;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-500), var(--primary-600));
  border-radius: var(--radius-sm);
  transition: width var(--transition-normal);
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 2s infinite;
}

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

/* Grid layouts */
.grid {
  display: grid;
  gap: var(--space-6);
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

/* View modes */
.video-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.video-list .video-card {
  display: flex;
  align-items: center;
  padding: var(--space-4);
  gap: var(--space-4);
}

.video-list .video-title {
  flex: 1;
  margin-bottom: 0;
}

.video-list .video-script {
  flex: 2;
  margin: 0;
}

.video-list .video-actions {
  flex-shrink: 0;
}

.video-compact {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-3);
}

.video-compact .video-card {
  padding: var(--space-3);
}

.video-compact .video-title {
  font-size: 1rem;
  margin-bottom: var(--space-2);
}

.video-compact .video-script {
  font-size: 0.875rem;
  margin: var(--space-2) 0;
}

.video-compact .meta-info {
  font-size: 0.75rem;
  margin-top: var(--space-2);
}

/* View toggle buttons */
.view-toggle {
  min-width: 40px;
  padding: var(--space-2) var(--space-3);
  font-size: 1.1rem;
}

.view-toggle.active {
  background: var(--primary-600);
  color: white;
}

.video-title {
  font-weight: 700;
  font-size: 1.25rem;
  margin-bottom: var(--space-3);
  color: #1e293b;
}

.video-id {
  font-family: var(--font-mono);
  background: #f1f5f9;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  color: #475569;
  display: inline-block;
  margin-bottom: var(--space-4);
  border: 1px solid #e2e8f0;
}

.video-script {
  background: #f8fafc;
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  margin: var(--space-4) 0;
  font-style: italic;
  border-left: 4px solid var(--primary-500);
  color: #374151;
  border: 1px solid #e2e8f0;
}

.video-actions {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-5);
  flex-wrap: wrap;
}

.meta-info {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-top: var(--space-4);
  padding-top: var(--space-4);
}

/* Statistics */
.stats {
  background: linear-gradient(135deg, #0a0f1c 0%, #1a1a2e 50%, #16213e 100%);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  margin: var(--space-6) 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  display: flex;
  justify-content: space-around;
  align-items: center;
  gap: var(--space-6);
  flex-wrap: wrap;
}

.stat-item {
  text-align: center;
  min-width: 120px;
  transition: all var(--transition-normal);
  color: white;
}

.clickable-stat {
  cursor: pointer;
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}

.clickable-stat:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.clickable-stat::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.1), transparent);
  transition: left var(--transition-slow);
}

.clickable-stat:hover::before {
  left: 100%;
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary-600);
  line-height: 1;
  margin-bottom: var(--space-2);
  transition: all var(--transition-normal);
}

.clickable-stat:hover .stat-number {
  transform: scale(1.1);
  text-shadow: 0 0 20px currentColor;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--gray-600);
  font-weight: 500;
  margin-bottom: var(--space-1);
}

.stat-description {
  font-size: 0.75rem;
  color: var(--gray-400);
  font-weight: 400;
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.clickable-stat:hover .stat-description {
  opacity: 1;
}

/* Alerts */
.alert {
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-lg);
  margin: var(--space-4) 0;
  border: 1px solid;
  border-left: 4px solid;
  font-weight: 500;
}

.alert-success {
  background: #ecfdf5;
  border-color: #10b981;
  color: #065f46;
  border-right-color: #a7f3d0;
  border-top-color: #a7f3d0;
  border-bottom-color: #a7f3d0;
}

.alert-warning {
  background: #fffbeb;
  border-color: #f59e0b;
  color: #92400e;
  border-right-color: #fde68a;
  border-top-color: #fde68a;
  border-bottom-color: #fde68a;
}

.alert-error {
  background: #fef2f2;
  border-color: #ef4444;
  color: #991b1b;
  border-right-color: #fecaca;
  border-top-color: #fecaca;
  border-bottom-color: #fecaca;
}

.alert-info {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1e40af;
  border-right-color: #bfdbfe;
  border-top-color: #bfdbfe;
  border-bottom-color: #bfdbfe;
}

/* Empty states */
.empty-state {
  text-align: center;
  padding: var(--space-16) var(--space-8);
  color: #6b7280;
  background: white;
  border-radius: var(--radius-xl);
  border: 2px dashed #d1d5db;
  margin: var(--space-8) 0;
}

.empty-state h3 {
  color: #374151;
  margin-bottom: var(--space-4);
  font-size: 1.5rem;
  font-weight: 700;
}

.empty-state p {
  margin-bottom: var(--space-6);
  font-size: 1.1rem;
  color: #6b7280;
}

/* Loading states */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray-300);
  border-radius: 50%;
  border-top-color: var(--primary-500);
  animation: spin 1s ease-in-out infinite;
}

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

/* Responsive design */
@media (max-width: 768px) {
  .container {
    padding: 0 var(--space-4);
  }
  
  .topnav {
    padding: var(--space-3) var(--space-4);
    flex-direction: column;
    gap: var(--space-3);
    align-items: flex-start;
  }
  
  .topnav .nav-brand {
    font-size: 1.25rem;
  }
  
  .topnav .nav-links {
    gap: var(--space-2);
    flex-wrap: wrap;
  }
  
  .topnav a {
    font-size: 0.9rem;
    padding: var(--space-2) var(--space-4);
  }
  
  .page-header {
    padding: var(--space-12) var(--space-4) var(--space-8);
  }
  
  .page-header h1 {
    font-size: 2rem;
  }
  
  .card {
    padding: var(--space-6);
  }
  
  .stats {
    gap: var(--space-6);
  }
  
  .video-actions {
    flex-direction: column;
  }
}

/* Advanced Animations */
@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 5px rgba(59, 130, 246, 0.3); }
  50% { box-shadow: 0 0 20px rgba(59, 130, 246, 0.6), 0 0 30px rgba(59, 130, 246, 0.4); }
}

@keyframes slide-in-up {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes bounce-in {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Enhanced page header */
.page-header {
  animation: slide-in-up 0.8s ease-out;
  position: relative;
  overflow: hidden;
}

.page-header::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  animation: shimmer-header 3s infinite;
}

@keyframes shimmer-header {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* Enhanced cards */
.card {
  animation: fade-in 0.6s ease-out;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-500), var(--success-500), var(--warning-500));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-slow);
}

.card:hover::before {
  transform: scaleX(1);
}

/* Enhanced video cards */
.video-card {
  animation: bounce-in 0.6s ease-out;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.video-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.1) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform var(--transition-slow);
}

.video-card:hover::after {
  transform: translateX(100%);
}

.video-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--shadow-xl);
}

/* Enhanced buttons */
.btn {
  position: relative;
  overflow: hidden;
  transition: all var(--transition-normal);
}

.btn:hover {
  transform: translateY(-2px);
  animation: pulse-glow 2s infinite;
}

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

/* Enhanced navigation */
.topnav {
  backdrop-filter: blur(20px);
  animation: slide-in-up 0.5s ease-out;
}

.topnav a {
  position: relative;
  overflow: visible;
}

.topnav a::before {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 3px;
  background: #3b82f6;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform var(--transition-normal);
  border-radius: 2px;
}

.topnav a:hover::before,
.topnav a.active::before {
  transform: scaleX(1);
  transform-origin: left;
}

/* Enhanced statistics */
.stat-number {
  animation: float 3s ease-in-out infinite;
  transition: all var(--transition-normal);
}

.stat-item:hover .stat-number {
  transform: scale(1.1);
  text-shadow: 0 0 20px currentColor;
}

/* Enhanced progress bars */
.progress-fill {
  position: relative;
  background: linear-gradient(90deg, var(--primary-500), var(--primary-600), var(--success-500));
  background-size: 200% 100%;
  animation: gradient-shift 2s ease-in-out infinite;
}

@keyframes gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* Enhanced status indicators */
.status {
  position: relative;
  animation: bounce-in 0.4s ease-out;
}

.status.processing {
  animation: pulse-glow 2s infinite;
}

.status.completed {
  animation: bounce-in 0.6s ease-out;
}

/* Enhanced loading states */
.loading {
  position: relative;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border: 3px solid var(--gray-200);
  border-top: 3px solid var(--primary-500);
  border-radius: 50%;
  animation: spin 1s linear infinite, pulse-glow 2s infinite;
}

/* Enhanced alerts */
.alert {
  animation: slide-in-up 0.5s ease-out;
  position: relative;
  overflow: hidden;
}

.alert::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: currentColor;
  opacity: 0.3;
}

/* Enhanced form elements */
input:focus, select:focus, textarea:focus {
  animation: pulse-glow 1s ease-out;
  transform: scale(1.02);
}

/* Staggered animations for grids */
.grid > * {
  animation: fade-in 0.6s ease-out;
}

.grid > *:nth-child(1) { animation-delay: 0.1s; }
.grid > *:nth-child(2) { animation-delay: 0.2s; }
.grid > *:nth-child(3) { animation-delay: 0.3s; }
.grid > *:nth-child(4) { animation-delay: 0.4s; }
.grid > *:nth-child(5) { animation-delay: 0.5s; }
.grid > *:nth-child(6) { animation-delay: 0.6s; }

/* Enhanced empty states */
.empty-state {
  animation: fade-in 1s ease-out;
}

.empty-state h3 {
  animation: bounce-in 0.8s ease-out 0.2s both;
}

.empty-state p {
  animation: slide-in-up 0.6s ease-out 0.4s both;
}

.empty-state .btn {
  animation: bounce-in 0.6s ease-out 0.6s both;
}

/* Enhanced video script display */
.video-script {
  position: relative;
  transition: all var(--transition-normal);
  cursor: pointer;
}

.video-script:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-md);
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

/* Filter tabs */
.filter-tab {
  position: relative;
  transition: all var(--transition-normal);
}

.filter-tab.active {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Enhanced navigation active states */
.topnav a.active {
  position: relative;
}

.topnav a.active::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  background: #3b82f6;
  border-radius: 50%;
  animation: pulse-glow 2s infinite;
}

/* Enhanced form interactions */
input:focus, select:focus, textarea:focus {
  position: relative;
  z-index: 1;
}

input:focus::after, select:focus::after, textarea:focus::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, #3b82f6, #10b981, #f59e0b);
  border-radius: inherit;
  z-index: -1;
  animation: gradient-shift 2s ease-in-out infinite;
}

/* Tooltip-like hover effects */
.btn[title]:hover::before {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gray-900);
  color: white;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  white-space: nowrap;
  z-index: 100;
  margin-bottom: var(--space-2);
  opacity: 0;
  animation: fade-in 0.3s ease-out forwards;
}

/* Enhanced empty states */
.empty-state {
  position: relative;
  overflow: hidden;
}

.empty-state::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.05), transparent);
  animation: shimmer 3s infinite;
}

/* Enhanced loading states */
.loading {
  position: relative;
}

.loading::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  border: 2px solid transparent;
  border-top: 2px solid var(--primary-500);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Micro-interactions for better UX */
.video-id {
  transition: all var(--transition-fast);
  cursor: pointer;
}

.video-id:hover {
  background: var(--primary-50);
  border-color: var(--primary-300);
  transform: scale(1.05);
}

.meta-info div {
  transition: color var(--transition-fast);
}

.meta-info div:hover {
  color: var(--primary-600);
}

/* Enhanced progress bars with better animations */
.progress-fill {
  position: relative;
  overflow: hidden;
}

.progress-fill::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: shimmer 2s infinite;
}

/* Status badge enhancements */
.status {
  position: relative;
  overflow: hidden;
}

.status::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  transition: left var(--transition-slow);
}

.status:hover::before {
  left: 100%;
}

/* Stats Page Styles */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-6);
  margin: var(--space-8) 0;
}

.stat-card {
  background: linear-gradient(135deg, #0a0f1c 0%, #1a1a2e 50%, #16213e 100%);
  color: white;
  padding: var(--space-6);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(59, 130, 246, 0.2);
  transition: all var(--transition-normal);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.stat-icon {
  font-size: 2.5rem;
  opacity: 0.8;
}

.stat-content {
  flex: 1;
}

.stat-card .stat-number {
  font-size: 2rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: var(--space-1);
}

.stat-card .stat-label {
  font-size: 0.875rem;
  color: #cbd5e1;
  margin-bottom: var(--space-1);
}

.stat-trend {
  font-size: 0.75rem;
  color: #10b981;
  font-weight: 500;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-6);
  margin-top: var(--space-6);
}

.analytics-item {
  background: #f8fafc;
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  border: 1px solid #e2e8f0;
}

.analytics-item h3 {
  margin: 0 0 var(--space-4);
  color: #1e293b;
  font-size: 1.125rem;
}

.time-stats {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.time-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) 0;
  border-bottom: 1px solid #e2e8f0;
}

.time-label {
  font-weight: 600;
  color: #64748b;
}

.time-value {
  font-weight: 700;
  color: #1e293b;
}

.recent-time-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) 0;
  border-bottom: 1px solid #e2e8f0;
}

.time-date {
  font-size: 0.875rem;
  color: #64748b;
}

.usage-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) 0;
  border-bottom: 1px solid #e2e8f0;
}

.usage-name {
  font-weight: 500;
  color: #1e293b;
}

.usage-count {
  font-size: 0.875rem;
  color: #64748b;
  font-weight: 600;
}

.status-breakdown {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-top: var(--space-6);
}

.status-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.status-bar {
  flex: 1;
  height: 20px;
  background: #e2e8f0;
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.status-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

.status-fill.completed {
  background: linear-gradient(90deg, #10b981, #059669);
}

.status-fill.processing {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}

.status-fill.failed {
  background: linear-gradient(90deg, #ef4444, #dc2626);
}

.status-info {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 120px;
}

.status-label {
  font-weight: 600;
  color: #1e293b;
}

.status-count {
  font-weight: 700;
  color: #64748b;
}

.loading-small {
  text-align: center;
  color: #64748b;
  font-style: italic;
  padding: var(--space-4);
}

.no-data {
  text-align: center;
  color: #64748b;
  font-style: italic;
  padding: var(--space-4);
}

/* Responsive enhancements */
@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .analytics-grid {
    grid-template-columns: 1fr;
  }
  
  .stat-card {
    flex-direction: column;
    text-align: center;
  }
  
  .status-item {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-2);
  }
  
  .video-card:hover {
    transform: translateY(-4px) scale(1.01);
  }
  
  .btn:hover {
    transform: translateY(-1px);
  }
}

/* Enhanced Video Card Styles */
.video-card.enhanced {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transition: all var(--transition-normal);
}

.video-card.enhanced:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  border-color: #3b82f6;
}

.video-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-4);
  gap: var(--space-4);
}

.video-header .video-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
  flex: 1;
}

.status-badge {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  color: #64748b;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid #cbd5e1;
  white-space: nowrap;
}

.status-badge.processing {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
  border-color: #f59e0b;
}

.status-badge.completed {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  color: #065f46;
  border-color: #10b981;
}

.status-badge.failed {
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  color: #991b1b;
  border-color: #ef4444;
}

.video-details {
  background: #f8fafc;
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  border: 1px solid #e2e8f0;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-2);
  gap: var(--space-3);
}

.detail-row:last-child {
  margin-bottom: 0;
}

.detail-label {
  font-weight: 600;
  color: #475569;
  font-size: 0.875rem;
  white-space: nowrap;
}

.detail-value {
  color: #1e293b;
  font-weight: 500;
  font-size: 0.875rem;
  text-align: right;
  flex: 1;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.detail-value:hover {
  color: var(--primary-600);
}

.script-preview {
  text-align: left;
  font-style: italic;
  line-height: 1.4;
}

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

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2);
}

.progress-header span:first-child {
  font-weight: 600;
  color: #374151;
  font-size: 0.875rem;
}

.progress-percent {
  font-weight: 700;
  color: var(--primary-600);
  font-size: 0.875rem;
}

.progress-bar.enhanced {
  height: 12px;
  background: #e5e7eb;
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.progress-bar.enhanced .progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #1d4ed8);
  border-radius: var(--radius-full);
  position: relative;
  transition: width var(--transition-slow);
}

.progress-bar.enhanced .progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 2s infinite;
}

.time-estimate-card {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}

.estimate-row {
  display: flex;
  gap: var(--space-4);
  margin-bottom: var(--space-3);
}

.estimate-row:last-child {
  margin-bottom: 0;
}

.estimate-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.estimate-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #1e40af;
  margin-bottom: var(--space-1);
}

.estimate-value {
  font-size: 0.875rem;
  font-weight: 700;
  color: #1e293b;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --gray-50: #111827;
    --gray-100: #1f2937;
    --gray-200: #374151;
    --gray-300: #4b5563;
    --gray-400: #6b7280;
    --gray-500: #9ca3af;
    --gray-600: #d1d5db;
    --gray-700: #e5e7eb;
    --gray-800: #f3f4f6;
    --gray-900: #f9fafb;
  }
  
  body {
    background: linear-gradient(135deg, var(--gray-900) 0%, var(--gray-800) 100%);
    color: var(--gray-100);
  }
  
  .page-header {
    background: linear-gradient(135deg, var(--gray-800) 0%, var(--gray-900) 100%);
  }
}
