/**
 * AutoClipper - YouTube-Style Design System
 * Clean, modern interface matching YouTube's visual language
 */

/* ========================================
   FONTS
   ======================================== */
@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap");

/* ========================================
   CSS CUSTOM PROPERTIES - DARK THEME
   ======================================== */
:root {
  /* Typography */
  --font-primary: "Roboto", Arial, sans-serif;
  --font-mono: "Roboto Mono", monospace;

  /* Line Heights */
  --line-height-normal: 1.4;
  --line-height-relaxed: 1.6;

  /* Background Colors */
  --bg-primary: #0f0f0f;
  --bg-secondary: #272727;
  --bg-tertiary: #3f3f3f;
  --bg-hover: rgba(255, 255, 255, 0.1);
  --bg-active: rgba(255, 255, 255, 0.2);

  /* Text Colors */
  --text-primary: #ffffff;
  --text-secondary: #aaaaaa;
  --text-muted: #717171;

  /* Accent Colors */
  --accent: #ff0000;
  --accent-hover: #cc0000;

  /* Status Colors */
  --success: #2ba640;
  --error: #ff0000;
  --live: #ff0000;

  /* Borders & Dividers */
  --divider: #3f3f3f;
  --border-subtle: rgba(255, 255, 255, 0.1);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.4);

  /* Layout */
  --border-radius: 8px;
  --border-radius-sm: 4px;
  --border-radius-lg: 12px;
  --border-radius-xl: 18px;
  --card-gap: 16px;

  /* Transitions */
  --transition-fast: 0.1s ease;
  --transition-normal: 0.2s ease;

  /* Responsive spacing */
  --spacing-container-desktop: 24px;
  --spacing-container-tablet: 20px;
  --spacing-container-mobile: 16px;

  /* Spinner sizes */
  --spinner-size-sm: 20px;
  --spinner-size-md: 24px;
  --spinner-size-lg: 28px;
  --spinner-size-xl: 32px;

  /* Accent colors for focus/links */
  --focus-border: #1c62b9;
  --accent-blue: #3ea6ff;

  /* Forest Theme Colors */
  --accent-gold: #f6ad55;
  --accent-cyan: #4fd1c5;
}

/* ========================================
   LIGHT THEME
   ======================================== */
[data-theme="light"] {
  /* Background Colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f2f2f2;
  --bg-tertiary: #e5e5e5;
  --bg-hover: rgba(0, 0, 0, 0.05);
  --bg-active: rgba(0, 0, 0, 0.1);

  /* Text Colors */
  --text-primary: #0f0f0f;
  --text-secondary: #606060;
  --text-muted: #909090;

  /* Borders & Dividers */
  --divider: #e5e5e5;
  --border-subtle: rgba(0, 0, 0, 0.1);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.15);

  /* Accent colors for focus/links (light theme) */
  --focus-border: #1a73e8;
  --accent-blue: #065fd4;
}

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

html {
  height: 100%;
  width: 100%;
  background-color: var(--bg-primary);
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  font-family: var(--font-primary);
  font-size: 14px;
  line-height: var(--line-height-normal);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

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

/* ========================================
   LAYOUT
   ======================================== */
.main-content {
  position: relative;
  flex: 1;
  padding: 24px;
}

/* ========================================
   HEADER
   ======================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  height: 56px;
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--divider);
  transition: transform 0.3s ease;
}

.site-header.header-hidden {
  transform: translateY(-100%);
}

.header-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.header-avatar-link {
  display: flex;
}

.header-avatar-link:hover .header-avatar {
  opacity: 0.8;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.site-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-primary);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap;
}

.site-title:hover {
  color: var(--text-primary);
}

.title-subtitle {
  font-weight: 400;
  color: var(--text-secondary);
}

/* ========================================
   NAVIGATION LINKS
   ======================================== */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: var(--border-radius-xl);
  transition: all var(--transition-fast);
}

.back-link:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

/* ========================================
   TOGGLE BUTTONS
   ======================================== */
.toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  background-color: transparent;
  border: none;
  border-radius: var(--border-radius-xl);
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.toggle-btn:active {
  background-color: var(--bg-active);
}

.toggle-btn svg,
.toggle-btn .icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* ========================================
   ICON UTILITIES
   ======================================== */
.icon-img {
  display: inline-block;
  vertical-align: middle;
  filter: invert(1); /* Dark mode: black SVGs → white */
}

[data-theme="light"] .icon-img {
  filter: none; /* Light mode: keep black SVGs black */
}

/* ========================================
   SKELETON LOADER
   ======================================== */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-secondary) 25%,
    var(--bg-tertiary) 50%,
    var(--bg-secondary) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--border-radius-sm);
}

/* ========================================
   SPINNER
   ======================================== */
.spinner {
  display: inline-block;
  width: var(--spinner-size-sm);
  height: var(--spinner-size-sm);
  border: 2px solid var(--bg-tertiary);
  border-top-color: var(--text-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 10px;
  vertical-align: middle;
}

.spinner-md {
  width: var(--spinner-size-md);
  height: var(--spinner-size-md);
}

.spinner-lg {
  width: var(--spinner-size-lg);
  height: var(--spinner-size-lg);
  border-width: 3px;
}

.spinner-xl {
  width: var(--spinner-size-xl);
  height: var(--spinner-size-xl);
  border-width: 3px;
}

/* ========================================
   SITE FOOTER
   ======================================== */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px;
  height: 34px;
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--divider);
  color: var(--text-secondary);
  font-size: 12px;
}

.footer-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: opacity var(--transition-fast);
}

.footer-link:hover {
  opacity: 0.8;
  color: var(--text-primary);
}

/* ========================================
   CUSTOM SCROLLBAR
   ======================================== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background-color: var(--bg-tertiary);
  border-radius: 4px;
}

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

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--bg-tertiary) transparent;
}

/* ========================================
   SHARED RESPONSIVE
   ======================================== */

/* Large desktop (>1440px) */
@media (min-width: 1440px) {
  .site-header {
    padding: 0 32px;
    gap: 24px;
  }

  .site-title {
    font-size: 20px;
  }
}

/* Tablet (768px-1024px) */
@media (max-width: 1024px) and (min-width: 769px) {
  .site-header {
    gap: 12px;
    padding: 0 20px;
  }

  .site-title {
    font-size: 16px;
  }
}

/* Mobile (<768px) */
@media (max-width: 768px) {
  .container,
  .main-content {
    padding: 12px;
  }

  .site-header {
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 12px;
    height: 48px;
  }

  .site-title {
    position: static;
    transform: none;
    font-size: 16px;
  }

  .title-subtitle {
    display: none;
  }

  .header-avatar-link {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }

  .header-controls {
    margin-left: auto;
  }

  .toggle-btn {
    padding: 8px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
