/**
 * WINDSTORM LIVE — MASTER THEME
 * Comprehensive CSS custom properties and component library
 * Import this file in all UI HTML for consistent branding
 */

/* ============================================
   ROOT VARIABLES — Colors, Fonts, Spacing
   ============================================ */

:root {
  /* ===== WINDSTORM BRAND PALETTE ===== */
  --color-deep-navy: #0a0e1a;
  --color-electric-blue: #00d4ff;
  --color-storm-teal: #00f5c8;
  --color-lightning-gold: #ffd700;
  --color-alert-red: #ff3366;

  /* ===== EXTENDED PALETTE ===== */
  --color-midnight: #050810;
  --color-slate: #1a2332;
  --color-steel: #2d3e50;
  --color-silver: #8896a8;
  --color-cloud: #e8ecf0;
  --color-pure-white: #ffffff;

  /* ===== SEMANTIC COLORS ===== */
  --color-background: var(--color-deep-navy);
  --color-surface: var(--color-slate);
  --color-surface-elevated: var(--color-steel);
  --color-border: rgba(0, 212, 255, 0.2);
  --color-border-bright: var(--color-electric-blue);

  --color-text-primary: var(--color-pure-white);
  --color-text-secondary: var(--color-silver);
  --color-text-muted: rgba(255, 255, 255, 0.5);

  --color-primary: var(--color-electric-blue);
  --color-primary-hover: #33ddff;
  --color-primary-active: #00aad4;

  --color-accent: var(--color-storm-teal);
  --color-accent-hover: #33f7d1;
  --color-accent-active: #00c8a0;

  --color-highlight: var(--color-lightning-gold);
  --color-danger: var(--color-alert-red);
  --color-success: #00ff88;
  --color-warning: #ffaa00;
  --color-info: var(--color-electric-blue);

  /* ===== GRADIENTS ===== */
  --gradient-storm: linear-gradient(135deg, var(--color-electric-blue), var(--color-storm-teal));
  --gradient-lightning: linear-gradient(135deg, var(--color-lightning-gold), #ffee88);
  --gradient-dark: linear-gradient(180deg, var(--color-midnight), var(--color-deep-navy));
  --gradient-glow: radial-gradient(circle, rgba(0, 212, 255, 0.15), transparent);

  /* ===== TYPOGRAPHY ===== */
  --font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
  --font-family-mono: "SF Mono", "Monaco", "Inconsolata", "Fira Code", "Droid Sans Mono", "Source Code Pro", monospace;
  --font-family-display: "Helvetica Neue", "Arial Black", sans-serif;

  --font-size-xs: 0.75rem;    /* 12px */
  --font-size-sm: 0.875rem;   /* 14px */
  --font-size-base: 1rem;     /* 16px */
  --font-size-lg: 1.125rem;   /* 18px */
  --font-size-xl: 1.25rem;    /* 20px */
  --font-size-2xl: 1.5rem;    /* 24px */
  --font-size-3xl: 2rem;      /* 32px */
  --font-size-4xl: 2.5rem;    /* 40px */
  --font-size-5xl: 3rem;      /* 48px */

  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-black: 900;

  --line-height-tight: 1.2;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.75;

  /* ===== SPACING ===== */
  --space-1: 0.25rem;   /* 4px */
  --space-2: 0.5rem;    /* 8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-5: 1.25rem;   /* 20px */
  --space-6: 1.5rem;    /* 24px */
  --space-8: 2rem;      /* 32px */
  --space-10: 2.5rem;   /* 40px */
  --space-12: 3rem;     /* 48px */
  --space-16: 4rem;     /* 64px */

  /* ===== BORDER RADIUS ===== */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  /* ===== SHADOWS ===== */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 16px 32px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 20px rgba(0, 212, 255, 0.4);
  --shadow-glow-teal: 0 0 20px rgba(0, 245, 200, 0.4);
  --shadow-glow-gold: 0 0 20px rgba(255, 215, 0, 0.4);

  /* ===== ANIMATION TIMINGS ===== */
  --duration-instant: 0.1s;
  --duration-fast: 0.2s;
  --duration-normal: 0.3s;
  --duration-slow: 0.5s;
  --duration-slower: 0.8s;

  --easing-default: cubic-bezier(0.4, 0, 0.2, 1);
  --easing-in: cubic-bezier(0.4, 0, 1, 1);
  --easing-out: cubic-bezier(0, 0, 0.2, 1);
  --easing-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);

  /* ===== Z-INDEX LAYERS ===== */
  --z-base: 0;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-overlay: 300;
  --z-modal: 400;
  --z-tooltip: 500;
  --z-notification: 600;
}

/* ===== LIGHT MODE OVERRIDES ===== */
:root[data-theme="light"] {
  --color-background: var(--color-cloud);
  --color-surface: var(--color-pure-white);
  --color-surface-elevated: #f5f7fa;
  --color-border: rgba(10, 14, 26, 0.15);

  --color-text-primary: var(--color-deep-navy);
  --color-text-secondary: var(--color-steel);
  --color-text-muted: rgba(10, 14, 26, 0.5);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.15);
  --shadow-xl: 0 16px 32px rgba(0, 0, 0, 0.18);
}

/* ============================================
   GLOBAL RESETS & BASE STYLES
   ============================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family-sans);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  color: var(--color-text-primary);
  background: var(--color-background);
  overflow-x: hidden;
}

/* ============================================
   TYPOGRAPHY UTILITIES
   ============================================ */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-display);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  margin-bottom: var(--space-4);
}

h1 { font-size: var(--font-size-5xl); }
h2 { font-size: var(--font-size-4xl); }
h3 { font-size: var(--font-size-3xl); }
h4 { font-size: var(--font-size-2xl); }
h5 { font-size: var(--font-size-xl); }
h6 { font-size: var(--font-size-lg); }

p {
  margin-bottom: var(--space-4);
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--duration-fast) var(--easing-default);
}

a:hover {
  color: var(--color-primary-hover);
  text-decoration: underline;
}

code {
  font-family: var(--font-family-mono);
  font-size: 0.9em;
  background: var(--color-surface);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

/* ============================================
   COMMON COMPONENT LIBRARY
   ============================================ */

/* ===== CARDS ===== */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-md);
  transition: all var(--duration-normal) var(--easing-default);
}

.card:hover {
  border-color: var(--color-border-bright);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.card-header {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
}

.card-body {
  color: var(--color-text-secondary);
}

.card-footer {
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: var(--space-3);
  align-items: center;
}

.card-elevated {
  background: var(--color-surface-elevated);
  box-shadow: var(--shadow-lg);
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-family-sans);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  padding: var(--space-3) var(--space-6);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-fast) var(--easing-default);
  text-decoration: none;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-deep-navy);
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-hover);
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  background: var(--color-primary-active);
  transform: translateY(0);
}

.btn-accent {
  background: var(--color-accent);
  color: var(--color-deep-navy);
}

.btn-accent:hover:not(:disabled) {
  background: var(--color-accent-hover);
  box-shadow: var(--shadow-glow-teal);
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--color-danger);
  color: var(--color-pure-white);
}

.btn-danger:hover:not(:disabled) {
  background: #ff5580;
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--color-primary);
  color: var(--color-primary);
}

.btn-outline:hover:not(:disabled) {
  background: var(--color-primary);
  color: var(--color-deep-navy);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-primary);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--color-surface);
}

.btn-sm {
  font-size: var(--font-size-sm);
  padding: var(--space-2) var(--space-4);
}

.btn-lg {
  font-size: var(--font-size-lg);
  padding: var(--space-4) var(--space-8);
}

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-primary {
  background: var(--color-primary);
  color: var(--color-deep-navy);
}

.badge-accent {
  background: var(--color-accent);
  color: var(--color-deep-navy);
}

.badge-success {
  background: var(--color-success);
  color: var(--color-deep-navy);
}

.badge-warning {
  background: var(--color-warning);
  color: var(--color-deep-navy);
}

.badge-danger {
  background: var(--color-danger);
  color: var(--color-pure-white);
}

.badge-outline {
  background: transparent;
  border: 1px solid currentColor;
}

/* ===== OVERLAYS ===== */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 14, 26, 0.85);
  backdrop-filter: blur(8px);
  z-index: var(--z-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
}

.overlay-content {
  background: var(--color-surface);
  border: 1px solid var(--color-border-bright);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl), var(--shadow-glow);
}

/* ===== PANELS ===== */
.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.panel-header {
  padding: var(--space-4) var(--space-6);
  background: var(--color-surface-elevated);
  border-bottom: 1px solid var(--color-border);
  font-weight: var(--font-weight-bold);
}

.panel-body {
  padding: var(--space-6);
}

.panel-footer {
  padding: var(--space-4) var(--space-6);
  background: var(--color-surface-elevated);
  border-top: 1px solid var(--color-border);
}

/* ===== INPUTS ===== */
.input {
  width: 100%;
  font-family: var(--font-family-sans);
  font-size: var(--font-size-base);
  padding: var(--space-3) var(--space-4);
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  transition: all var(--duration-fast) var(--easing-default);
}

.input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.2);
}

.input::placeholder {
  color: var(--color-text-muted);
}

textarea.input {
  resize: vertical;
  min-height: 100px;
}

/* ===== GRID & LAYOUT ===== */
.container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.grid {
  display: grid;
  gap: var(--space-6);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.flex {
  display: flex;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

/* ============================================
   ANIMATION LIBRARY
   ============================================ */

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

.animate-fadeIn {
  animation: fadeIn var(--duration-normal) var(--easing-default);
}

/* ===== SLIDE UP ===== */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-slideUp {
  animation: slideUp var(--duration-normal) var(--easing-out);
}

/* ===== SLIDE LEFT ===== */
@keyframes slideLeft {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.animate-slideLeft {
  animation: slideLeft var(--duration-normal) var(--easing-out);
}

/* ===== PULSE GLOW ===== */
@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
  }
  50% {
    box-shadow: 0 0 25px rgba(0, 212, 255, 0.7);
  }
}

.animate-pulseGlow {
  animation: pulseGlow 2s var(--easing-default) infinite;
}

/* ===== LIGHTNING FLASH ===== */
@keyframes lightningFlash {
  0%, 100% {
    opacity: 1;
    filter: brightness(1);
  }
  10%, 30%, 50% {
    opacity: 1;
    filter: brightness(2) saturate(1.5);
  }
  20%, 40%, 60% {
    opacity: 0.9;
    filter: brightness(0.8);
  }
}

.animate-lightningFlash {
  animation: lightningFlash 0.6s var(--easing-default);
}

/* ===== STORM WIPE ===== */
@keyframes stormWipe {
  from {
    clip-path: polygon(0 0, 0 0, 0 100%, 0% 100%);
  }
  to {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  }
}

.animate-stormWipe {
  animation: stormWipe var(--duration-slower) var(--easing-out);
}

/* ===== SPIN ===== */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.animate-spin {
  animation: spin 1s linear infinite;
}

/* ===== BOUNCE ===== */
@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.animate-bounce {
  animation: bounce 1s var(--easing-bounce) infinite;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-xs { font-size: var(--font-size-xs); }
.text-sm { font-size: var(--font-size-sm); }
.text-base { font-size: var(--font-size-base); }
.text-lg { font-size: var(--font-size-lg); }
.text-xl { font-size: var(--font-size-xl); }
.text-2xl { font-size: var(--font-size-2xl); }
.text-3xl { font-size: var(--font-size-3xl); }

.font-normal { font-weight: var(--font-weight-normal); }
.font-medium { font-weight: var(--font-weight-medium); }
.font-semibold { font-weight: var(--font-weight-semibold); }
.font-bold { font-weight: var(--font-weight-bold); }
.font-black { font-weight: var(--font-weight-black); }

.text-primary { color: var(--color-text-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-muted { color: var(--color-text-muted); }
.text-blue { color: var(--color-electric-blue); }
.text-teal { color: var(--color-storm-teal); }
.text-gold { color: var(--color-lightning-gold); }
.text-red { color: var(--color-alert-red); }

.bg-surface { background: var(--color-surface); }
.bg-elevated { background: var(--color-surface-elevated); }

.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-glow { box-shadow: var(--shadow-glow); }

.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }

.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }

.select-none { user-select: none; }

.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================
   RESPONSIVE UTILITIES
   ============================================ */

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }

  h1 { font-size: var(--font-size-4xl); }
  h2 { font-size: var(--font-size-3xl); }
  h3 { font-size: var(--font-size-2xl); }
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */

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

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

::-webkit-scrollbar-thumb {
  background: var(--color-steel);
  border-radius: var(--radius-full);
}

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