/* ===========================================
 * JarganApiDemo Theme System
 * 4 comprehensive themes with instant switching
 * Based on JarganWeb implementation
 * =========================================== */

/* ═══════════════════════════════════════════
   DEFAULT THEME (Light with glass morphism)
   ═══════════════════════════════════════════ */

:root {
  /* Color Palette - Glass Morphism */
  --ip-black: #000000;
  --ip-gray-900: #1a1a1a;
  --ip-gray-800: #2d2d2d;
  --ip-gray-700: #404040;
  --ip-gray-600: #595959;
  --ip-gray-500: #808080;
  --ip-gray-400: #999999;
  --ip-gray-300: #b3b3b3;
  --ip-gray-200: #d9d9d9;
  --ip-gray-100: #e6e6e6;
  --ip-gray-50: #f5f5f5;
  --ip-white: #ffffff;

  /* Signal Colors (Brand) */
  --ip-signal-alert: #cc0000;
  --ip-signal-warn: #ff6d07;
  --ip-signal-active: #9d4edd;
  --ip-signal-success: #646e3a;

  /* Applied Variables */
  --bg-primary: #ffffff;
  --bg-secondary: #f8f8f8;
  --bg-tertiary: #f0f0f0;
  --bg-input: #ffffff;
  --bg-hover: #f5f5f5;
  --bg-active: #efefef;
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --text-muted: #999999;
  --border-default: #cccccc;
  --border-heavy: #404040;
  --accent-primary: #9d4edd;
  --accent-secondary: #646e3a;
  --accent-jargan: #9d4edd;
  --success: #646e3a;
  --warning: #ff6d07;
  --error: #cc0000;
  --instagram: #e1306c;
  --facebook: #1877f2;
  --chart-1: #9d4edd;
  --chart-2: #646e3a;
  --chart-3: #ff6d07;
  --chart-4: #404040;

  /* Semantic Colors */
  --success-bg: rgba(100, 110, 58, 0.1);
  --success-border: rgba(100, 110, 58, 0.5);
  --success-color: #3d4620;
  --error-bg: rgba(204, 0, 0, 0.1);
  --error-border: rgba(204, 0, 0, 0.4);
  --error-color: #8b0000;
  --warning-bg: rgba(255, 109, 7, 0.1);
  --warning-border: rgba(255, 109, 7, 0.4);
  --warning-color: #b34600;

  /* Typography */
  --font-mono: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;

  /* Sizing */
  --text-xs: 9px;
  --text-sm: 11px;
  --text-base: 13px;
  --text-md: 15px;
  --text-lg: 18px;
  --text-xl: 24px;
  --weight-normal: 400;
  --weight-medium: 500;
  --weight-bold: 700;
  --weight-semibold: 600;

  /* Transitions */
  --transition-fast: 150ms ease-out;
  --transition-base: 250ms ease-out;
  --transition-slow: 350ms ease-out;
}

/* ═══════════════════════════════════════════
   DARK THEME
   High contrast, deep blues
   ═══════════════════════════════════════════ */

[data-theme="dark"] {
  --ip-black: #0a0e27;
  --ip-gray-900: #16213e;
  --ip-gray-800: #1f2e4a;
  --ip-gray-700: #2d3e52;
  --ip-gray-600: #3d4f66;
  --ip-gray-500: #5a7a99;
  --ip-gray-400: #7a99bb;
  --ip-gray-300: #a0b8d4;
  --ip-gray-200: #c5d9eb;
  --ip-gray-100: #dfe9f5;
  --ip-gray-50: #eef2f8;
  --ip-white: #ffffff;

  /* Signal Colors - Bright for contrast */
  --ip-signal-alert: #ff5555;
  --ip-signal-warn: #ffaa33;
  --ip-signal-active: #7bfff2;
  --ip-signal-success: #55dd99;

  /* Applied Variables */
  --bg-primary: #0a0e27;
  --bg-secondary: #16213e;
  --bg-tertiary: #1f2e4a;
  --bg-input: #1f2e4a;
  --bg-hover: #2d3e52;
  --bg-active: #3d4f66;
  --text-primary: #eaeaea;
  --text-secondary: #a0b8d4;
  --text-muted: #7a99bb;
  --border-default: #3d4f66;
  --border-heavy: #5a7a99;
  --accent-primary: #7bfff2;
  --accent-secondary: #55dd99;
  --accent-jargan: #7bfff2;
  --success: #55dd99;
  --warning: #ffaa33;
  --error: #ff5555;
  --instagram: #ff5555;
  --facebook: #7bfff2;
  --chart-1: #7bfff2;
  --chart-2: #55dd99;
  --chart-3: #ffaa33;
  --chart-4: #a0b8d4;

  /* Semantic Colors */
  --success-bg: rgba(85, 221, 153, 0.15);
  --success-border: rgba(85, 221, 153, 0.5);
  --success-color: #55dd99;
  --error-bg: rgba(255, 85, 85, 0.15);
  --error-border: rgba(255, 85, 85, 0.4);
  --error-color: #ff5555;
  --warning-bg: rgba(255, 170, 51, 0.15);
  --warning-border: rgba(255, 170, 51, 0.4);
  --warning-color: #ffaa33;
}

/* ═══════════════════════════════════════════
   PASTEL MONDRIAN THEME
   Watercolor palette, rounded, warm
   ═══════════════════════════════════════════ */

[data-theme="pastel-mondrian"] {
  /* Pastel Mondrian Palette */
  --ip-black: #304c61;
  --ip-gray-900: #485d71;
  --ip-gray-800: #5d6f85;
  --ip-gray-700: #708299;
  --ip-gray-600: #8295ad;
  --ip-gray-500: #95a8bb;
  --ip-gray-400: #a8bbc9;
  --ip-gray-300: #bbcad7;
  --ip-gray-200: #d4dfe6;
  --ip-gray-100: #e6ecf1;
  --ip-gray-50: #f2f6f9;
  --ip-white: #ffffff;

  /* Signal Colors - Warm pastels */
  --ip-signal-alert: #da7a7c;
  --ip-signal-warn: #b9562b;
  --ip-signal-active: #a98268;
  --ip-signal-success: #95b4b6;

  /* Applied Variables */
  --bg-primary: #ffffff;
  --bg-secondary: #f9fafb;
  --bg-tertiary: #f2f6f9;
  --bg-input: #ffffff;
  --bg-hover: #f2f6f9;
  --bg-active: #e6ecf1;
  --text-primary: #304c61;
  --text-secondary: #708299;
  --text-muted: #95a8bb;
  --border-default: #d4dfe6;
  --border-heavy: #95a8bb;
  --accent-primary: #a98268;
  --accent-secondary: #95b4b6;
  --accent-jargan: #a98268;
  --success: #95b4b6;
  --warning: #b9562b;
  --error: #da7a7c;
  --instagram: #da7a7c;
  --facebook: #708299;
  --chart-1: #a98268;
  --chart-2: #95b4b6;
  --chart-3: #b9562b;
  --chart-4: #95a8bb;

  /* Semantic Colors */
  --success-bg: rgba(149, 180, 182, 0.12);
  --success-border: rgba(149, 180, 182, 0.5);
  --success-color: #6d8a8b;
  --error-bg: rgba(218, 122, 124, 0.12);
  --error-border: rgba(218, 122, 124, 0.4);
  --error-color: #a85b5d;
  --warning-bg: rgba(185, 86, 43, 0.12);
  --warning-border: rgba(185, 86, 43, 0.4);
  --warning-color: #8b4620;
}

/* ═══════════════════════════════════════════
   INSTRUMENT PAPER THEME
   Industrial monochrome, minimal, stark
   ═══════════════════════════════════════════ */

[data-theme="instrument-paper"] {
  /* Monochrome Palette */
  --ip-black: #000000;
  --ip-gray-900: #1a1a1a;
  --ip-gray-800: #262626;
  --ip-gray-700: #404040;
  --ip-gray-600: #595959;
  --ip-gray-500: #808080;
  --ip-gray-400: #999999;
  --ip-gray-300: #b3b3b3;
  --ip-gray-200: #d9d9d9;
  --ip-gray-100: #e6e6e6;
  --ip-gray-50: #f5f5f5;
  --ip-white: #ffffff;

  /* Signal Colors - Stark, minimal */
  --ip-signal-alert: #cc0000;
  --ip-signal-warn: #008800;
  --ip-signal-active: #0066cc;
  --ip-signal-success: #006600;

  /* Applied Variables */
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f5;
  --bg-tertiary: #e6e6e6;
  --bg-input: #ffffff;
  --bg-hover: #f5f5f5;
  --bg-active: #e6e6e6;
  --text-primary: #000000;
  --text-secondary: #404040;
  --text-muted: #808080;
  --border-default: #b3b3b3;
  --border-heavy: #404040;
  --accent-primary: #000000;
  --accent-secondary: #006600;
  --accent-jargan: #0066cc;
  --success: #006600;
  --warning: #008800;
  --error: #cc0000;
  --instagram: #404040;
  --facebook: #404040;
  --chart-1: #000000;
  --chart-2: #404040;
  --chart-3: #808080;
  --chart-4: #b3b3b3;

  /* Semantic Colors */
  --success-bg: transparent;
  --success-border: #006600;
  --success-color: #006600;
  --error-bg: transparent;
  --error-border: #cc0000;
  --error-color: #cc0000;
  --warning-bg: transparent;
  --warning-border: #008800;
  --warning-color: #008800;
}

/* ═══════════════════════════════════════════
   TEXTURED GEOMETRIC THEME
   Modernist print aesthetic, warm off-white,
   constrained palette, hard shadows, no radius
   ═══════════════════════════════════════════ */

[data-theme="textured-geometric"] {
  --ip-black: #111111;
  --ip-gray-900: #1a1a1a;
  --ip-gray-800: #2d2d2d;
  --ip-gray-700: #404040;
  --ip-gray-600: #595959;
  --ip-gray-500: #808080;
  --ip-gray-400: #999999;
  --ip-gray-300: #b3b3b3;
  --ip-gray-200: #d4d0c8;
  --ip-gray-100: #e8e4dc;
  --ip-gray-50: #F2F1EC;
  --ip-white: #F2F1EC;

  --ip-signal-alert: #9B2D30;
  --ip-signal-warn: #8B6F3A;
  --ip-signal-active: #1D3557;
  --ip-signal-success: #4A6741;

  --bg-primary: #F2F1EC;
  --bg-secondary: #E8E4DC;
  --bg-tertiary: #DDD9D0;
  --bg-input: #FAFAF7;
  --bg-hover: #E8E4DC;
  --bg-active: #DDD9D0;
  --text-primary: #111111;
  --text-secondary: #404040;
  --text-muted: #808080;
  --border-default: #111111;
  --border-heavy: #111111;
  --accent-primary: #1D3557;
  --accent-secondary: #9B2D30;
  --accent-jargan: #1D3557;
  --success: #4A6741;
  --warning: #8B6F3A;
  --error: #9B2D30;
  --instagram: #9B2D30;
  --facebook: #1D3557;
  --chart-1: #1D3557;
  --chart-2: #9B2D30;
  --chart-3: #8B6F3A;
  --chart-4: #4A6741;

  --success-bg: rgba(74, 103, 65, 0.10);
  --success-border: rgba(74, 103, 65, 0.5);
  --success-color: #4A6741;
  --error-bg: rgba(155, 45, 48, 0.10);
  --error-border: rgba(155, 45, 48, 0.4);
  --error-color: #9B2D30;
  --warning-bg: rgba(139, 111, 58, 0.10);
  --warning-border: rgba(139, 111, 58, 0.4);
  --warning-color: #8B6F3A;

  --shadow-paper: 6px 8px 4px rgba(0,0,0,0.18);
  --shadow-sharp: 4px 6px 0px rgba(0,0,0,0.20);
}

[data-theme="textured-geometric"] * {
  border-radius: 0 !important;
}

[data-theme="textured-geometric"] body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 99999;
  opacity: 0.05;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
}

/* ═══════════════════════════════════════════
   THEME-SPECIFIC OVERRIDES
   Fine-tuned adjustments per theme
   ═══════════════════════════════════════════ */

/* Instrument Paper: No rounded corners */
[data-theme="instrument-paper"] * {
  border-radius: 0 !important;
}

/* Pastel Mondrian: Rounded corners */
[data-theme="pastel-mondrian"] {
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

/* Dark: Enhanced contrast text */
[data-theme="dark"] {
  --text-primary: #ffffff;
}

/* ═══════════════════════════════════════════
   THEME PICKER UI STYLES
   For DevTools component
   ═══════════════════════════════════════════ */

.theme-picker-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 8px 0;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: 4px;
  cursor: pointer;
  transition: all 150ms ease-out;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.theme-option:hover {
  background-color: var(--bg-tertiary);
  border-color: var(--border-heavy);
}

.theme-option.active {
  background-color: var(--bg-active);
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px var(--accent-primary);
}

.theme-swatches {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.theme-swatch {
  width: 24px;
  height: 24px;
  border-radius: 3px;
  border: 1px solid;
}

.theme-info {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-width: 0;
}

.theme-name {
  font-weight: 500;
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.wcag-badge {
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 9px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 2px;
  white-space: nowrap;
  font-family: var(--font-mono);
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .theme-picker-grid {
    grid-template-columns: 1fr;
  }

  .theme-option {
    padding: 8px 10px;
    font-size: var(--text-xs);
  }

  .theme-swatch {
    width: 20px;
    height: 20px;
  }
}

/* ═══════════════════════════════════════════
   UTILITY CLASSES FOR TESTING
   Use in browser console to verify themes
   ═══════════════════════════════════════════ */

.theme-test-box {
  padding: 20px;
  margin: 10px;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
}

.theme-swatch {
  display: inline-block;
  width: 40px;
  height: 40px;
  margin: 5px;
  border: 1px solid var(--border-heavy);
}

.theme-swatch.primary { background-color: var(--accent-primary); }
.theme-swatch.secondary { background-color: var(--accent-secondary); }
.theme-swatch.success { background-color: var(--success); }
.theme-swatch.warning { background-color: var(--warning); }
.theme-swatch.error { background-color: var(--error); }
