/* base.css — CSS custom properties (:root), resets, typography, body styles, theme overrides */

/* ============================================
   RESET & VARIABLES
   ============================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Corporate Color Palette - Claude-inspired sophistication */
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --accent: #e07850; /* Coral accent like Claude */

  /* Neutrals - Richer dark theme */
  --gray-50: #faf9f7;
  --gray-100: #f5f4f1;
  --gray-200: #e8e6e1;
  --gray-300: #d4d1ca;
  --gray-400: #a8a29e;
  --gray-500: #78716c;
  --gray-600: #57534e;
  --gray-700: #44403c;
  --gray-800: #292524;
  --gray-900: #1c1917;

  /* Backgrounds - Warmer dark theme */
  --bg-primary: #1a1a1a;
  --bg-secondary: #242424;
  --bg-tertiary: #2e2e2e;
  --bg-surface: #333333;

  /* Glass Effects */
  --glass-bg: rgba(46, 46, 46, 0.8);
  --glass-border: rgba(255, 255, 255, 0.08);

  /* Text - Cream tones for warmth */
  --text-primary: #f5f4f1;
  --text-secondary: #a8a29e;
  --text-tertiary: #78716c;
  --text-disabled: #57534e;

  /* Disabled States - Professional styling */
  --disabled-bg: rgba(75, 85, 99, 0.3);
  --disabled-border: rgba(75, 85, 99, 0.4);
  --disabled-text: #78716c;
  --disabled-opacity: 0.6;

  /* Button Design System */
  --btn-radius: 10px;
  --btn-padding-y: 10px;
  --btn-padding-x: 18px;
  --btn-font-size: 14px;
  --btn-font-weight: 500;
  --btn-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);

  /* Focus ring for accessibility */
  --focus-ring: 0 0 0 3px rgba(224, 120, 80, 0.4);
  --focus-ring-offset: 2px;

  /* Shadows - Softer, more sophisticated */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 10px 24px rgba(0, 0, 0, 0.2);
  --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.25);
  --shadow-glow: 0 0 24px rgba(224, 120, 80, 0.25);
  --shadow-input: 0 2px 8px rgba(0, 0, 0, 0.12);

  /* Transitions */
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);

  /* Typography - Elegant serif for content, clean sans for UI */
  --font-sans: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', 'Segoe UI', sans-serif;
  --font-serif: 'Charter', 'Georgia', 'Cambria', 'Times New Roman', serif;
  --font-mono: 'SF Mono', 'JetBrains Mono', 'Consolas', monospace;

  /* Logo filter (overridable per theme) */
  --logo-filter: none;

  /* Spacing system */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
}

/* Light Theme */
[data-theme="light"] {
  /* Backgrounds */
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #e9ecef;
  --bg-surface: #ffffff;

  /* Glass Effects */
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(0, 0, 0, 0.12);

  /* Text */
  --text-primary: #1a1a1a;
  --text-secondary: #495057;
  --text-tertiary: #6c757d;
  --text-disabled: #9ca3af;

  /* Disabled States - Professional styling for light mode */
  --disabled-bg: rgba(156, 163, 175, 0.2);
  --disabled-border: rgba(156, 163, 175, 0.3);
  --disabled-text: #9ca3af;
  --disabled-opacity: 0.6;

  /* Focus ring for accessibility */
  --focus-ring: 0 0 0 3px rgba(99, 102, 241, 0.3);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.2);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.25);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.2);
  --logo-filter: none;
}

[data-theme="dark"] {
  --logo-filter: invert(1) brightness(1.25);
}

html {
  height: 100vh;
  overflow: hidden;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Ensure halo logo contrasts in dark mode */
img[src*="logo-halo.svg"] {
  filter: var(--logo-filter);
  transition: filter 0.3s ease;
}

/* Animated gradient background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 50% 20%, rgba(16, 185, 129, 0.06) 0%, transparent 50%);
  animation: gradientShift 20s ease infinite;
  pointer-events: none;
  z-index: 0;
}

/* Form elements disabled state */
input:disabled,
textarea:disabled,
select:disabled {
  background: var(--disabled-bg);
  border-color: var(--disabled-border);
  color: var(--disabled-text);
  cursor: not-allowed;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

.icon-xs {
  width: 12px;
  height: 12px;
}

.icon-sm {
  width: 14px;
  height: 14px;
}

.icon-md {
  width: 18px;
  height: 18px;
}

.icon-lg {
  width: 24px;
  height: 24px;
}

.icon-xl {
  width: 48px;
  height: 48px;
}

.spinning {
  animation: spin 1s linear infinite;
}

[data-tooltip] {
  position: relative;
}

[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 8px;
  padding: 6px 10px;
  background: rgba(20, 20, 30, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 6px;
  font-size: 12px;
  color: #ffffff;
  font-weight: 500;
  white-space: nowrap;
  z-index: 10000;
  pointer-events: none;
  opacity: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  animation: fadeIn 0.2s ease-out 0.5s forwards;
}

/* Header tooltips: show below so they don't clip off the top of the viewport */
.header-btn[data-tooltip]:hover::after,
.header-actions [data-tooltip]:hover::after {
  bottom: auto;
  top: 100%;
  margin-bottom: 0;
  margin-top: 8px;
}

select.input-field {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
