/*
 * Design System Theme
 * Generated from: docs/design/theme.json
 * Source: Linear Design System
 */

/* ========================================
   CSS Variables - Light Theme (Default)
   ======================================== */
:root {
  /* Background Colors */
  --color-bg-primary: #ffffff;
  --color-bg-secondary: #f7f8f9;
  --color-bg-tertiary: #edeef3;
  --color-bg-elevated: #ffffff;
  --color-bg-surface: #f0f1f4;
  --color-bg-header: rgba(255, 255, 255, 0.8);

  /* Text Colors */
  --color-text-primary: #1d1f24;
  --color-text-secondary: #44494d;
  --color-text-muted: #6b7076;
  --color-text-inverse: #ffffff;

  /* Border Colors */
  --color-border-default: #e0e1e6;
  --color-border-subtle: rgba(0, 0, 0, 0.08);
  --color-border-strong: rgba(0, 0, 0, 0.15);

  /* Accent Colors */
  --color-accent: #5e6ad2;
  --color-accent-hover: #4f5bc4;
  --color-accent-secondary: #4650b0;
  --color-accent-text: #ffffff;

  /* Status Colors */
  --color-status-success: #4cb782;
  --color-status-warning: #e5a910;
  --color-status-error: #d94343;
  --color-status-info: #3b8fd9;

  /* Scrollbar */
  --color-scrollbar: rgba(0, 0, 0, 0.1);
  --color-scrollbar-hover: rgba(0, 0, 0, 0.2);
  --color-scrollbar-active: rgba(0, 0, 0, 0.4);

  /* Brand Colors */
  --color-brand-primary: #5e6ad2;
  --color-brand-blue: #4ea7fc;
  --color-brand-red: #eb5757;
  --color-brand-green: #4cb782;
  --color-brand-orange: #fc7840;
  --color-brand-yellow: #f2c94c;

  /* Typography */
  --font-sans: "Inter Variable", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  --font-mono: "Berkeley Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --font-serif: "Tiempos Headline", ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;

  --font-weight-light: 300;
  --font-weight-normal: 400;
  --font-weight-medium: 510;
  --font-weight-semibold: 590;
  --font-weight-bold: 680;

  --font-size-micro: 0.6875rem;
  --font-size-mini: 0.75rem;
  --font-size-small: 0.8125rem;
  --font-size-regular: 0.9375rem;
  --font-size-large: 1.125rem;

  /* Typography Scale - Headings */
  --typography-h1-size: 2.5rem;
  --typography-h1-weight: 680;
  --typography-h1-line-height: 1.1;
  --typography-h1-letter-spacing: -0.022em;

  --typography-h2-size: 2rem;
  --typography-h2-weight: 590;
  --typography-h2-line-height: 1.15;
  --typography-h2-letter-spacing: -0.02em;

  --typography-h3-size: 1.5rem;
  --typography-h3-weight: 590;
  --typography-h3-line-height: 1.25;
  --typography-h3-letter-spacing: -0.015em;

  --typography-h4-size: 1.25rem;
  --typography-h4-weight: 510;
  --typography-h4-line-height: 1.3;
  --typography-h4-letter-spacing: -0.01em;

  --typography-h5-size: 1.125rem;
  --typography-h5-weight: 510;
  --typography-h5-line-height: 1.4;
  --typography-h5-letter-spacing: -0.005em;

  --typography-h6-size: 1rem;
  --typography-h6-weight: 510;
  --typography-h6-line-height: 1.4;
  --typography-h6-letter-spacing: 0;

  /* Typography Scale - Body */
  --typography-body-size: 0.9375rem;
  --typography-body-line-height: 1.6;
  --typography-body-letter-spacing: -0.011em;

  --typography-small-size: 0.8125rem;
  --typography-small-line-height: 1.5;
  --typography-small-letter-spacing: -0.006em;

  --typography-caption-size: 0.75rem;
  --typography-caption-line-height: 1.4;
  --typography-caption-letter-spacing: 0;

  /* Spacing */
  --radius-4: 4px;
  --radius-6: 6px;
  --radius-8: 8px;
  --radius-12: 12px;
  --radius-16: 16px;
  --radius-24: 24px;
  --radius-32: 32px;
  --radius-rounded: 9999px;
  --radius-circle: 50%;

  --gap-1: 4px;
  --gap-2: 8px;
  --gap-3: 12px;
  --gap-4: 16px;
  --gap-5: 20px;
  --gap-6: 24px;
  --gap-8: 32px;
  --gap-10: 40px;
  --gap-12: 48px;
  --gap-16: 64px;

  /* Layout */
  --header-height: 64px;
  --header-blur: 20px;
  --page-padding-inline: 24px;
  --page-padding-block: 64px;
  --page-max-width: 1024px;
  --prose-max-width: 624px;
  --min-tap-size: 44px;

  /* Transitions */
  --transition-fast: 0.1s;
  --transition-normal: 0.25s;
  --transition-slow: 0.4s;

  --easing-default: cubic-bezier(0.215, 0.61, 0.355, 1);
  --easing-in-out: cubic-bezier(0.645, 0.045, 0.355, 1);
  --easing-out: cubic-bezier(0.23, 1, 0.32, 1);
  --easing-in: cubic-bezier(0.55, 0.055, 0.675, 0.19);

  /* Blur */
  --blur-sm: 4px;
  --blur-md: 8px;
  --blur-lg: 16px;
  --blur-xl: 24px;

  /* Z-Index */
  --z-base: 1;
  --z-dropdown: 600;
  --z-sticky: 100;
  --z-modal: 700;
  --z-popover: 600;
  --z-tooltip: 1100;
  --z-toast: 800;
  --z-max: 10000;

  /* Focus Ring */
  --focus-ring-color: #5e6ad2;
  --focus-ring-width: 2px;
  --focus-ring-offset: 2px;

  /* Shadows - Elevation System */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 16px 32px rgba(0, 0, 0, 0.16);
  --shadow-2xl: 0 24px 48px rgba(0, 0, 0, 0.2);

  /* Colored Shadows */
  --shadow-accent: 0 4px 14px rgba(94, 106, 210, 0.25);
  --shadow-success: 0 4px 14px rgba(76, 183, 130, 0.25);
  --shadow-error: 0 4px 14px rgba(217, 67, 67, 0.25);
  --shadow-warning: 0 4px 14px rgba(229, 169, 16, 0.25);

  /* Overlay */
  --overlay-light: rgba(0, 0, 0, 0.4);
  --overlay-dark: rgba(0, 0, 0, 0.6);
}

/* ========================================
   Base Styles
   ======================================== */
html {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--color-bg-primary);
  color: var(--color-text-primary);
  transition: background-color var(--transition-normal) var(--easing-default),
              color var(--transition-normal) var(--easing-default);
}

/* Focus Ring - Only for non-input elements */
:focus-visible:not(input):not(textarea):not(select) {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

/* Input focus styles - subtle border change instead of thick ring */
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: none;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

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

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

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

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

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

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

@keyframes slideDown {
  from { transform: translateY(-10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

@keyframes slideOutRight {
  from { transform: translateX(0); }
  to { transform: translateX(100%); }
}

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

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

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

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

@keyframes progress-indeterminate {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(250%); }
}

/* ========================================
   Animation Utilities
   ======================================== */
.animate-fade-in {
  animation: fadeIn var(--transition-normal) var(--easing-out);
}

.animate-slide-up {
  animation: slideUp var(--transition-normal) var(--easing-out);
}

.animate-slide-down {
  animation: slideDown var(--transition-normal) var(--easing-out);
}

.animate-scale-in {
  animation: scaleIn var(--transition-normal) var(--easing-out);
}

.animate-pulse {
  animation: pulse 2s var(--easing-in-out) infinite;
}

.animate-shimmer {
  animation: shimmer 2s infinite;
  background: linear-gradient(
    90deg,
    var(--color-bg-secondary) 0%,
    var(--color-bg-tertiary) 50%,
    var(--color-bg-secondary) 100%
  );
  background-size: 200% 100%;
}

.animate-fade-out {
  animation: fadeOut var(--transition-fast) var(--easing-out) forwards;
}

.animate-scale-out {
  animation: scaleOut var(--transition-fast) var(--easing-out) forwards;
}

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

/* ========================================
   Form Components - Checkbox, Radio, Toggle
   ======================================== */

/* Checkbox */
.checkbox-wrapper input:checked + .checkbox-box {
  background-color: #5e6ad2;
  border-color: #5e6ad2;
}

.checkbox-wrapper input:checked + .checkbox-box .checkbox-icon {
  opacity: 1;
}

.checkbox-wrapper input:focus-visible + .checkbox-box {
  outline: 2px solid #5e6ad2;
  outline-offset: 2px;
}

/* Radio */
.radio-wrapper input:checked + .radio-box {
  border-color: #5e6ad2;
}

.radio-wrapper input:checked + .radio-box .radio-dot {
  transform: scale(1);
}

.radio-wrapper input:focus-visible + .radio-box {
  outline: 2px solid #5e6ad2;
  outline-offset: 2px;
}

/* Toggle - Checked state background */
.toggle-wrapper input:checked + .toggle-track {
  background-color: #5e6ad2;
}

/* Toggle thumb uses left positioning instead of transform to avoid conflict with Tailwind's translateY */
.toggle-wrapper .toggle-thumb {
  transition: left 0.2s ease;
}

/* Toggle - Small: track w-8 (32px), thumb w-3.5 (14px), move from left-0.5 to right */
.toggle-wrapper.toggle-sm input:checked + .toggle-track .toggle-thumb {
  left: calc(100% - 14px - 2px);
}

/* Toggle - Medium: track w-11 (44px), thumb w-4 (16px), move from left-1 to right */
.toggle-wrapper input:checked + .toggle-track .toggle-thumb {
  left: calc(100% - 16px - 4px);
}

/* Toggle - Large: track w-14 (56px), thumb w-6 (24px), move from left-1 to right */
.toggle-wrapper.toggle-lg input:checked + .toggle-track .toggle-thumb {
  left: calc(100% - 24px - 4px);
}

.toggle-wrapper input:focus-visible + .toggle-track {
  outline: 2px solid #5e6ad2;
  outline-offset: 2px;
}

/* ========================================
   Button Styles
   ======================================== */
.btn-primary {
  background-color: var(--color-accent);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--color-accent-hover);
}

.btn-danger {
  background-color: var(--color-status-error);
  color: #ffffff;
}

.btn-danger:hover {
  opacity: 0.9;
}

/* ========================================
   Safe Area for Mobile Bottom Nav
   ======================================== */
.safe-area-bottom {
  padding-bottom: env(safe-area-inset-bottom, 0);
}

/* ========================================
   Reduced Motion Support
   ======================================== */
@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;
  }
}
