/* whatTheAPP - Design Tokens */
/* Custom CSS variables for whatTheAPP design system */

:root {
  /* ============================================
     BRAND COLORS
     ============================================ */
  --brand-primary: #2b63c0;
  --brand-primary-hover: #1e4a8f;
  --brand-primary-light: #4a7ed4;
  --brand-secondary: #475569;
  --brand-accent: #3b82f6;
  
  /* ============================================
     BACKGROUND COLORS
     ============================================ */
  --bg-light: #f5f6fa;
  --bg-gradient-start: #e4e9fb;
  --bg-gradient-end: #f5f6fa;
  --bg-card: #ffffff;
  
  /* Shadows */
  --card-shadow: 0 25px 60px rgba(35, 50, 105, 0.12);
  --card-shadow-hover: 0 30px 70px rgba(35, 50, 105, 0.15);
  --card-shadow-sm: 0 4px 12px rgba(35, 50, 105, 0.08);
  --modal-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  
  /* ============================================
     RISK COLORS - LIGHT MODE
     ============================================ */
  --risk-safe: #16a34a;
  --risk-safe-bg: #f0fdf4;
  --risk-safe-border: #2fa46f;
  --risk-safe-text: #1d7c52;
  
  --risk-review: #ca8a04;
  --risk-review-bg: #fffbeb;
  --risk-review-border: #f9a825;
  --risk-review-text: #7a4100;
  
  --risk-dangerous: #dc2626;
  --risk-dangerous-bg: #fef2f2;
  --risk-dangerous-border: #e74545;
  --risk-dangerous-text: #7a1414;
  
  /* ============================================
     SPACING SYSTEM
     ============================================ */
  --space-xs: 0.25rem;   /* 4px */
  --space-sm: 0.5rem;    /* 8px */
  --space-md: 1rem;      /* 16px */
  --space-lg: 1.5rem;   /* 24px */
  --space-xl: 2rem;      /* 32px */
  --space-2xl: 3rem;     /* 48px */
  --space-3xl: 4rem;     /* 64px */
  
  /* ============================================
     BORDER RADIUS
     ============================================ */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 26px;
  --radius-full: 999px;
  
  /* ============================================
     TRANSITIONS
     ============================================ */
  --transition-fast: 0.15s ease;
  --transition-base: 0.2s ease;
  --transition-slow: 0.3s ease;
  
  /* ============================================
     TYPOGRAPHY
     ============================================ */
  --font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-size-base: 1rem;
  --font-size-sm: 0.875rem;
  --font-size-xs: 0.75rem;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --line-height-base: 1.5;
  --line-height-tight: 1.25;
  --line-height-relaxed: 1.625;
  
  /* ============================================
     Z-INDEX LAYERS
     ============================================ */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-modal-backdrop: 400;
  --z-modal: 500;
  --z-popover: 600;
  --z-tooltip: 700;
  
  /* ============================================
     FORM ELEMENTS
     ============================================ */
  --input-border: #d7def0;
  --input-border-focus: #2b63c0;
  --input-bg: #fdfdfd;
  --input-height: 48px;
  --input-padding: 0.85rem 1rem;
  
  /* ============================================
     BUTTONS
     ============================================ */
  --btn-height: 48px;
  --btn-padding: 0.95rem 1.5rem;
  --btn-font-weight: 600;
  
  /* ============================================
     NAVBAR
     ============================================ */
  --navbar-padding: 1rem 0;
  --nav-link-padding: 0.5rem 1rem;
  
  /* ============================================
     CARDS
     ============================================ */
  --card-padding: 1.5rem 2rem;
  --card-padding-mobile: 1.25rem 1.5rem;
  
  /* ============================================
     SECTION CARD (inner content)
     ============================================ */
  --section-padding: 1.25rem 1.5rem;
  --section-icon-size: 48px;
  --section-icon-size-sm: 40px;
  
  /* ============================================
     LOADING STATES
     ============================================ */
  --spinner-size: 24px;
  --spinner-size-lg: 48px;
  --spinner-border: 3px;
  
  /* ============================================
     OVERLAY
     ============================================ */
  --overlay-bg: rgba(15, 23, 42, 0.55);
}

/* ============================================
   DARK MODE OVERRIDES
   ============================================ */
[data-theme="dark"] {
  /* Background */
  --bg-light: rgb(19, 22.5, 30.5);
  --bg-gradient-start: rgb(19, 22.5, 30.5);
  --bg-gradient-end: rgb(19, 22.5, 30.5);
  --bg-card: #181c25;
  
  /* Form Elements - Override Pico */
  --pico-background-color: rgb(19, 22.5, 30.5);
  --pico-form-element-background-color: rgb(28, 33, 43.5);
  --pico-form-element-border-color: #2a3140;
  --pico-card-background-color: #181c25;
  --pico-card-sectioning-background-color: rgb(26, 30.5, 40.25);
  --pico-muted-border-color: #2a3140;
  
  /* Input specific */
  --input-bg: rgb(28, 33, 43.5);
  --input-border: #2a3140;
  
  /* Shadows */
  --card-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
  --card-shadow-hover: 0 30px 70px rgba(0, 0, 0, 0.35);
  --card-shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.2);
  --modal-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  
  /* Risk Colors - Dark Mode */
  --risk-safe: #22c55e;
  --risk-safe-bg: rgba(34, 197, 94, 0.1);
  --risk-safe-border: #22c55e;
  --risk-safe-text: #4ade80;
  
  --risk-review: #facc15;
  --risk-review-bg: rgba(250, 204, 21, 0.1);
  --risk-review-border: #facc15;
  --risk-review-text: #fde047;
  
  --risk-dangerous: #ef4444;
  --risk-dangerous-bg: rgba(239, 68, 68, 0.1);
  --risk-dangerous-border: #ef4444;
  --risk-dangerous-text: #f87171;
  
  /* Form Elements */
  --input-border: #2a3140;
  --input-bg: rgb(28, 33, 43.5);
  
  /* Section Card */
  --section-bg: rgb(26, 30.5, 40.25);
  
  /* Overlay */
  --overlay-bg: rgba(0, 0, 0, 0.7);
}

/* ============================================
   AUTO DARK MODE (system preference)
   ============================================ */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    /* Background */
    --bg-light: rgb(19, 22.5, 30.5);
    --bg-gradient-start: rgb(19, 22.5, 30.5);
    --bg-gradient-end: rgb(19, 22.5, 30.5);
    --bg-card: #181c25;
    
    /* Shadows */
    --card-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
    --card-shadow-hover: 0 30px 70px rgba(0, 0, 0, 0.35);
    --card-shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.2);
    --modal-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    
    /* Risk Colors */
    --risk-safe: #22c55e;
    --risk-safe-bg: rgba(34, 197, 94, 0.1);
    --risk-safe-border: #22c55e;
    --risk-safe-text: #4ade80;
    
    --risk-review: #facc15;
    --risk-review-bg: rgba(250, 204, 21, 0.1);
    --risk-review-border: #facc15;
    --risk-review-text: #fde047;
    
    --risk-dangerous: #ef4444;
    --risk-dangerous-bg: rgba(239, 68, 68, 0.1);
    --risk-dangerous-border: #ef4444;
    --risk-dangerous-text: #f87171;
    
    /* Form Elements */
    --input-border: #2a3140;
    --input-bg: rgb(28, 33, 43.5);
    
    /* Section Card */
    --section-bg: rgb(26, 30.5, 40.25);
    
    /* Overlay */
    --overlay-bg: rgba(0, 0, 0, 0.7);
  }
}

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

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

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

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

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

/* Animation utility classes */
.animate-fade-in {
  animation: fadeIn 0.3s ease forwards;
}

.animate-slide-up {
  animation: slideUp 0.3s ease forwards;
}

.animate-scale-in {
  animation: scaleIn 0.2s ease forwards;
}

/* Skeleton loader */
.skeleton {
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: skeletonLoading 1.5s infinite;
  border-radius: var(--radius-sm);
}

[data-theme="dark"] .skeleton {
  background: linear-gradient(90deg, #2a3140 25%, #3a4150 50%, #2a3140 75%);
  background-size: 200% 100%;
}

/* ============================================
   FOCUS STATES (Accessibility)
   ============================================ */
*:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}

/* ============================================
   REDUCE MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
