/* ==========================================
   Theme CSS - Dark/Light Theme Variables
   Default: Dark Theme
   ========================================== */

/* CSS Variables Base (Dark Theme - Default) */
:root {
  /* Background Colors */
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #1a1a24;
  --bg-hover: #252532;
  --bg-input: #1a1a24;
  
  /* Text Colors */
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #606070;
  
  /* Accent Colors */
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-light: rgba(99, 102, 241, 0.12);
  
  /* Status Colors */
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  
  /* Border & Shadow */
  --border: #2a2a3a;
  --border-light: #3a3a4a;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  
  /* UI Elements */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --transition: all 0.2s ease;
  
  /* Overlay */
  --overlay-bg: rgba(0, 0, 0, 0.7);
  --modal-bg: #1a1a24;
  
  /* Scrollbar */
  --scrollbar-bg: #1a1a24;
  --scrollbar-thumb: #3a3a4a;
  --scrollbar-thumb-hover: #4a4a5a;
}

/* Light Theme Variables */
.light-theme {
  /* Background Colors */
  --bg-primary: #f8f9fa;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-hover: #f1f3f5;
  --bg-input: #f1f3f5;
  
  /* Text Colors */
  --text-primary: #1a1a2e;
  --text-secondary: #495057;
  --text-muted: #868e96;
  
  /* Accent Colors */
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-light: rgba(99, 102, 241, 0.1);
  
  /* Border & Shadow */
  --border: #dee2e6;
  --border-light: #e9ecef;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
  
  /* Overlay */
  --overlay-bg: rgba(255, 255, 255, 0.9);
  --modal-bg: #ffffff;
  
  /* Scrollbar */
  --scrollbar-bg: #f1f3f5;
  --scrollbar-thumb: #ced4da;
  --scrollbar-thumb-hover: #adb5bd;
}

/* ==========================================
   Theme Switcher Button Styles
   ========================================== */

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  font-size: 1.1rem;
}

.theme-toggle:hover {
  background: var(--bg-hover);
  color: var(--accent);
  transform: scale(1.05);
}

.theme-toggle:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.theme-toggle:active {
  transform: scale(0.95);
}

/* Icon transitions */
.theme-toggle i {
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Sun icon (shown in dark mode) */
.theme-toggle .icon-sun {
  display: block;
}

.theme-toggle .icon-moon {
  display: none;
}

/* Moon icon (shown in light mode) */
.light-theme .theme-toggle .icon-sun {
  display: none;
}

.light-theme .theme-toggle .icon-moon {
  display: block;
}

/* Theme toggle positioning in header */
.header-nav .theme-toggle {
  margin-left: 0.5rem;
}

/* ==========================================
   Smooth Theme Transitions
   ========================================== */

body {
  transition: 
    background-color 0.3s ease,
    color 0.3s ease;
}

/* Smooth transition for all themed elements */
* {
  transition: 
    background-color 0.3s ease,
    border-color 0.3s ease,
    color 0.15s ease;
}

/* Disable transitions during page load */
body.preload * {
  transition: none !important;
}

/* ==========================================
   Scrollbar Theme Styling
   ========================================== */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--scrollbar-bg);
}

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

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

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

/* ==========================================
   Light Theme Specific Overrides
   ========================================== */

.light-theme {
  /* Force specific overrides for light mode */
  color-scheme: light;
}

.light-theme .header {
  background: var(--bg-secondary);
  box-shadow: var(--shadow);
}

.light-theme .footer {
  background: var(--bg-secondary);
  border-top-color: var(--border);
}

.light-theme .file-card {
  box-shadow: var(--shadow);
}

.light-theme .file-card:hover {
  box-shadow: var(--shadow-lg);
}

.light-theme .promo-ad {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(34, 197, 94, 0.08));
}

.light-theme .image-modal-backdrop {
  background: rgba(255, 255, 255, 0.8);
}

.light-theme .player-overlay {
  background: rgba(255, 255, 255, 0.3);
}

/* Light theme video player */
.light-theme .video-player.modern-player {
  --player-bg: #1a1a2e;
}

/* Light theme input focus glow */
.light-theme input:focus,
.light-theme select:focus,
.light-theme textarea:focus {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* ==========================================
   Utility Classes for Theme
   ========================================== */

.theme-invert {
  filter: invert(1) hue-rotate(180deg);
}

/* Image in light mode might need adjustment */
.light-theme img:not([src*="logo"]) {
  opacity: 0.95;
}

/* Video in light mode */
.light-theme video {
  background: #000;
}
