/* KiroForge Theme System */

/* ============================================
   CSS Custom Properties - Light Theme (Default)
   ============================================ */
:root {
  /* Backgrounds */
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #f3f4f6;
  --bg-card: #ffffff;
  --bg-nav: #ffffff;
  
  /* Text Colors */
  --text-primary: #1a1a1a;
  --text-secondary: #4a5568;
  --text-muted: #718096;
  --text-inverse: #ffffff;
  
  /* Border Colors */
  --border-color: #e2e8f0;
  --border-hover: rgba(139, 92, 246, 0.3);
  --border-card: rgba(139, 92, 246, 0.1);
  
  /* Gradient Colors */
  --gradient-start: #667eea;
  --gradient-mid: #764ba2;
  --gradient-end: #f093fb;
  
  /* Interactive States */
  --hover-bg: #f7fafc;
  --active-bg: #edf2f7;
  --hover-text: #8b5cf6;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 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-card: 0 20px 40px rgba(139, 92, 246, 0.2);
  
  /* Brand Colors (unchanged across themes) */
  --primary: #8b5cf6;
  --secondary: #a78bfa;
  --accent: #ec4899;
}

/* ============================================
   Dark Theme Overrides
   ============================================ */
[data-theme="dark"] {
  /* Backgrounds - Much darker, richer blacks */
  --bg-primary: #0a0a0a;
  --bg-secondary: #111111;
  --bg-tertiary: #1a1a1a;
  --bg-card: #141414;
  --bg-nav: #0d0d0d;
  
  /* Text Colors */
  --text-primary: #ffffff;
  --text-secondary: #e0e0e0;
  --text-muted: #a0a0a0;
  --text-inverse: #0a0a0a;
  
  /* Border Colors */
  --border-color: #2a2a2a;
  --border-hover: rgba(139, 92, 246, 0.5);
  --border-card: rgba(139, 92, 246, 0.15);
  
  /* Gradient Colors - Adjusted for dark theme */
  --gradient-start: #4c51bf;
  --gradient-mid: #553c9a;
  --gradient-end: #9333ea;
  
  /* Interactive States */
  --hover-bg: #1f1f1f;
  --active-bg: #2a2a2a;
  --hover-text: #a78bfa;
  
  /* Shadows - Darker for dark theme */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.7);
  --shadow-card: 0 20px 40px rgba(139, 92, 246, 0.4);
}

/* ============================================
   System Preference Fallback
   ============================================ */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    /* Backgrounds - Much darker, richer blacks */
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-tertiary: #1a1a1a;
    --bg-card: #141414;
    --bg-nav: #0d0d0d;
    
    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #e0e0e0;
    --text-muted: #a0a0a0;
    --text-inverse: #0a0a0a;
    
    /* Border Colors */
    --border-color: #2a2a2a;
    --border-hover: rgba(139, 92, 246, 0.5);
    --border-card: rgba(139, 92, 246, 0.15);
    
    /* Gradient Colors */
    --gradient-start: #4c51bf;
    --gradient-mid: #553c9a;
    --gradient-end: #9333ea;
    
    /* Interactive States */
    --hover-bg: #1f1f1f;
    --active-bg: #2a2a2a;
    --hover-text: #a78bfa;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.7);
    --shadow-card: 0 20px 40px rgba(139, 92, 246, 0.4);
  }
}

/* ============================================
   Smooth Transitions for Theme Switching
   ============================================ */
body,
nav,
section,
div,
a,
button,
.feature-card,
.card {
  transition: background-color 300ms ease-in-out,
              color 300ms ease-in-out,
              border-color 300ms ease-in-out;
}

/* ============================================
   Base Theme Application
   ============================================ */
body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
}

/* Navigation */
nav {
  background-color: var(--bg-nav);
  box-shadow: var(--shadow-sm);
}

/* Sections */
section {
  background-color: var(--bg-primary);
}

section:nth-child(even) {
  background-color: var(--bg-secondary);
}

/* Cards */
.feature-card,
.card {
  background-color: var(--bg-card);
  border-color: var(--border-card);
  box-shadow: var(--shadow-md);
}

.feature-card:hover,
.card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-card);
}

/* Text - Higher specificity to override Tailwind */
html .text-gray-900,
html[data-theme] .text-gray-900 {
  color: var(--text-primary) !important;
}

html .text-gray-700,
html[data-theme] .text-gray-700 {
  color: var(--text-secondary) !important;
}

html .text-gray-600,
html[data-theme] .text-gray-600 {
  color: var(--text-muted) !important;
}

html .text-gray-500,
html[data-theme] .text-gray-500 {
  color: var(--text-muted) !important;
}

/* Borders */
.border-gray-300 {
  border-color: var(--border-color) !important;
}

/* Backgrounds - Higher specificity to override Tailwind */
html .bg-white,
html[data-theme] .bg-white {
  background-color: var(--bg-card) !important;
}

html .bg-gray-50,
html[data-theme] .bg-gray-50 {
  background-color: var(--bg-secondary) !important;
}

html .bg-gray-900,
html[data-theme] .bg-gray-900 {
  background-color: var(--bg-tertiary) !important;
}

/* Footer specific - Always dark for both themes */
footer {
  background-color: #1a202c !important;
  color: #cbd5e0 !important;
}

footer h3,
footer h4 {
  color: #ffffff !important;
}

footer a {
  color: #cbd5e0 !important;
}

footer a:hover {
  color: #ffffff !important;
}

/* Gradient backgrounds remain unchanged */
.gradient-bg {
  background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-mid) 50%, var(--gradient-end) 100%);
}

/* Interactive elements */
.nav-link:hover {
  color: var(--hover-text);
}

/* Hover states for links */
a:hover {
  color: var(--hover-text);
}

/* ============================================
   Form Inputs - Dark Mode Support
   ============================================ */
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] textarea,
[data-theme="dark"] select {
  background-color: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

[data-theme="dark"] input[type="text"]::placeholder,
[data-theme="dark"] input[type="email"]::placeholder,
[data-theme="dark"] input[type="password"]::placeholder,
[data-theme="dark"] input[type="number"]::placeholder,
[data-theme="dark"] textarea::placeholder {
  color: var(--text-muted) !important;
  opacity: 0.6;
}

[data-theme="dark"] input[type="text"]:focus,
[data-theme="dark"] input[type="email"]:focus,
[data-theme="dark"] input[type="password"]:focus,
[data-theme="dark"] input[type="number"]:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] select:focus {
  background-color: var(--bg-secondary) !important;
  border-color: var(--primary) !important;
}

/* System preference fallback for inputs */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) input[type="text"],
  :root:not([data-theme="light"]):not([data-theme="dark"]) input[type="email"],
  :root:not([data-theme="light"]):not([data-theme="dark"]) input[type="password"],
  :root:not([data-theme="light"]):not([data-theme="dark"]) input[type="number"],
  :root:not([data-theme="light"]):not([data-theme="dark"]) textarea,
  :root:not([data-theme="light"]):not([data-theme="dark"]) select {
    background-color: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
  }
  
  :root:not([data-theme="light"]):not([data-theme="dark"]) input[type="text"]::placeholder,
  :root:not([data-theme="light"]):not([data-theme="dark"]) input[type="email"]::placeholder,
  :root:not([data-theme="light"]):not([data-theme="dark"]) input[type="password"]::placeholder,
  :root:not([data-theme="light"]):not([data-theme="dark"]) input[type="number"]::placeholder,
  :root:not([data-theme="light"]):not([data-theme="dark"]) textarea::placeholder {
    color: var(--text-muted) !important;
    opacity: 0.6;
  }
}
