/* ============================================
   PercentagePro - Global Styles
   Modern, responsive design system
   ============================================ */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/inter-latin-400.woff2') format('woff2');
}

/* CSS Custom Properties (Design Tokens) */
:root {
  /* Colors - Primary Palette (Professional Blue from Logo) */
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-primary-light: #60a5fa;

  /* Colors - Accent (Vibrant Red from "free" Logo Text) */
  --color-accent: #dc2626;
  --color-accent-dark: #b91c1c;
  --color-accent-light: #ef4444;

  /* Colors - Action (Orange for Energy & Engagement) */
  --color-action: #f97316;
  --color-action-dark: #ea580c;
  --color-action-light: #fb923c;

  /* Colors - Semantic */
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-error: #ef4444;
  --color-info: #3b82f6;

  /* Colors - Neutrals (Warmer tones for friendlier feel) */
  --color-gray-50: #f8fafc;
  --color-gray-100: #f1f5f9;
  --color-gray-200: #e2e8f0;
  --color-gray-300: #cbd5e1;
  --color-gray-400: #94a3b8;
  --color-gray-500: #64748b;
  --color-gray-600: #475569;
  --color-gray-700: #334155;
  --color-gray-800: #1e293b;
  --color-gray-900: #0f172a;

  /* Gradients for Visual Interest */
  --gradient-primary: linear-gradient(135deg, #2563eb 0%, #dc2626 100%);
  --gradient-success: linear-gradient(135deg, #10b981 0%, #3b82f6 100%);
  --gradient-hero: linear-gradient(135deg, #1e40af 0%, #1e293b 100%);
  --gradient-warm: linear-gradient(135deg, #f97316 0%, #fb923c 100%);

  /* Typography (Inter WOFF2 loaded in dist bundles; falls back to system UI) */
  --font-heading: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-primary: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace;

  /* Font Sizes */
  --text-xs: 0.75rem;
  /* 12px */
  --text-sm: 0.875rem;
  /* 14px */
  --text-base: 1rem;
  /* 16px */
  --text-lg: 1.125rem;
  /* 18px */
  --text-xl: 1.25rem;
  /* 20px */
  --text-2xl: 1.5rem;
  /* 24px */
  --text-3xl: 1.875rem;
  /* 30px */
  --text-4xl: 2.25rem;
  /* 36px */
  --text-5xl: 3rem;
  /* 48px */

  /* Font Weights */
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;

  /* Spacing Scale */
  --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 */
  --space-20: 5rem;
  /* 80px */

  /* Border Radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.25rem;
  --radius-full: 9999px;

  /* Surfaces (homepage + cards) */
  --surface-base: #f8fafc;
  --surface-elevated: #ffffff;
  --surface-muted: #f1f5f9;
  --surface-glass: rgba(255, 255, 255, 0.88);
  --shadow-elevated: 0 4px 24px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-glow: 0 0 0 1px rgba(37, 99, 235, 0.08), 0 12px 40px rgba(37, 99, 235, 0.12);

  /* Shadows (Enhanced for depth) */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-base: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --shadow-colored: 0 10px 20px -5px rgba(139, 92, 246, 0.3);

  /* Transitions */
  --transition-fast: 150ms ease-in-out;
  --transition-base: 200ms ease-in-out;
  --transition-slow: 300ms ease-in-out;

  /* Z-index Scale */
  --z-base: 1;
  --z-dropdown: 1000;
  --z-sticky: 1100;
  --z-modal: 1200;
  --z-tooltip: 1300;

  /* Container */
  --container-max-width: 1280px;
  --container-padding: var(--space-4);
}

@media (max-width: 480px) {
  :root {
    --container-padding: 12px;
  }
}

/* ============================================
   Dark Mode Theme
   ============================================ */
[data-theme="dark"] {
  --color-gray-50: #020617;
  /* Ultra dark background */
  --color-gray-100: #0f172a;
  /* Default background */
  --color-gray-200: #1e293b;
  /* Card background / Borders */
  --color-gray-300: #334155;
  /* Subtle borders */
  --color-gray-400: #475569;
  /* Muted text */
  --color-gray-500: #94a3b8;
  /* Regular slate text */
  --color-gray-600: #cbd5e1;
  /* Bright text */
  --color-gray-700: #e2e8f0;
  /* Very bright text */
  --color-gray-800: #f8fafc;
  /* Near white (Bold text) */
  --color-gray-900: #ffffff;
  /* Pure white (Headings) */

  /* Adjusted primary for dark mode */
  --color-primary: #60a5fa;
  --color-primary-dark: #93c5fd;
  --color-primary-light: #93c5fd;

  /* Adjusted semantic colors */
  --color-success: #34d399;
  --color-warning: #fbbf24;
  --color-error: #f87171;
  --color-info: #60a5fa;

  /* Dark mode gradients */
  --gradient-hero: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  --gradient-primary: linear-gradient(135deg, #60a5fa 0%, #f87171 100%);

  /* Dark surfaces */
  --surface-base: #0b1220;
  --surface-elevated: #1e293b;
  --surface-muted: #0f172a;
  --surface-glass: rgba(15, 23, 42, 0.92);
  --shadow-elevated: 0 4px 24px rgba(0, 0, 0, 0.35), 0 1px 3px rgba(0, 0, 0, 0.25);
  --shadow-glow: 0 0 0 1px rgba(59, 130, 246, 0.18), 0 12px 40px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
}

/* Body and base */
[data-theme="dark"] body {
  background-color: #0f172a;
  color: #e2e8f0;
}

/* Headings */
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6 {
  color: #f8fafc;
}

/* Links */
[data-theme="dark"] a {
  color: #a78bfa;
}

[data-theme="dark"] a:hover {
  color: #c4b5fd;
}

/* Cards and containers */
[data-theme="dark"] .card,
[data-theme="dark"] .calculator-card,
[data-theme="dark"] .calculator-container,
[data-theme="dark"] .category-card,
[data-theme="dark"] .feature-card,
[data-theme="dark"] .info-card,
[data-theme="dark"] .formula-box,
[data-theme="dark"] .step-box,
[data-theme="dark"] .steps-container {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

[data-theme="dark"] .category-card .calculator-list a,
[data-theme="dark"] .related-tools-hub .calculator-list a {
  color: var(--color-primary-light, #93c5fd);
}

[data-theme="dark"] .category-card .calculator-list a:hover,
[data-theme="dark"] .related-tools-hub .calculator-list a:hover {
  color: #bfdbfe;
  background: #1e3a5f;
}

[data-theme="dark"] .category-card .calculator-list li,
[data-theme="dark"] .related-tools-hub .calculator-list li {
  border-bottom-color: #334155;
}

/* Form inputs */
[data-theme="dark"] .form-input,
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: #334155;
  border-color: #475569;
  color: #f8fafc;
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
  color: #94a3b8;
}

/* Labels */
[data-theme="dark"] label,
[data-theme="dark"] .form-label {
  color: #e2e8f0;
}

/* Result card dark mode — see calculator.css for full result-section theming */

/* Sidebar */
[data-theme="dark"] .calculator-sidebar,
[data-theme="dark"] .sidebar-widget {
  background: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .sidebar-title {
  color: #f8fafc;
}

[data-theme="dark"] .sidebar-links a {
  color: #cbd5e1;
}

[data-theme="dark"] .sidebar-links a:hover {
  color: #a78bfa;
  background: #334155;
}

/* Header */
[data-theme="dark"] .site-header {
  background: rgba(15, 23, 42, 0.9);
  border-color: rgba(255, 255, 255, 0.1);
  border-top: 3px solid var(--color-accent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

[data-theme="dark"] .nav-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--color-primary-light);
}

[data-theme="dark"] .nav-link,
[data-theme="dark"] .mobile-nav-link {
  color: #e2e8f0;
}

[data-theme="dark"] .nav-link:hover {
  color: #a78bfa;
}

/* Touch Targets for Mobile Nav */
.mobile-nav-link {
  min-height: 48px;
  display: flex;
  align-items: center;
  padding: 12px var(--container-padding);
}

/* Logo visibility by theme */
.logo-light {
  display: block !important;
}

.logo-dark {
  display: none !important;
}

[data-theme="dark"] .logo-light {
  display: none !important;
}

[data-theme="dark"] .logo-dark {
  display: block !important;
}

[data-theme="dark"] .logo-brand {
  color: #f8fafc;
}

/* Footer */
[data-theme="dark"] .site-footer {
  background: var(--color-gray-50);
  border-top: 1px solid var(--color-gray-200);
}

[data-theme="dark"] .footer-section h3 {
  color: #ffffff;
}

[data-theme="dark"] .footer-section p {
  color: #f1f5f9;
}

[data-theme="dark"] .footer-links a {
  color: #ffffff;
}

[data-theme="dark"] .footer-links a:hover {
  color: var(--color-primary);
}

[data-theme="dark"] .footer-bottom {
  border-top: 1px solid var(--color-gray-200);
  color: var(--color-gray-500);
}

[data-theme="dark"] .footer-bottom a {
  color: var(--color-gray-600);
}

/* Breadcrumbs */
[data-theme="dark"] .breadcrumb {
  color: #cbd5e1;
}

[data-theme="dark"] .breadcrumb a {
  color: #a78bfa;
}

/* Buttons */
[data-theme="dark"] .btn-reset,
[data-theme="dark"] .btn-secondary {
  background: #334155;
  color: #f8fafc;
  border-color: #475569;
}

[data-theme="dark"] .btn-primary,
[data-theme="dark"] .btn-action,
[data-theme="dark"] .btn-accent {
  color: #ffffff;
}

[data-theme="dark"] .btn-reset:hover,
[data-theme="dark"] .btn-secondary:hover {
  background: #475569;
  color: #f8fafc;
}

/* Copy button */
[data-theme="dark"] .copy-result-btn {
  background: #334155 !important;
  border-color: #475569 !important;
  color: #e2e8f0 !important;
}

[data-theme="dark"] .copy-result-btn:hover {
  background: #475569 !important;
}

/* Formula boxes */
[data-theme="dark"] .formula-box {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

[data-theme="dark"] .formula-title {
  color: #93c5fd;
}

[data-theme="dark"] .formula-expression {
  background: #0f172a;
  color: #bfdbfe;
  border: 1px solid #334155;
}

[data-theme="dark"] .formula-variables {
  border-top-color: #334155;
}

[data-theme="dark"] .formula-variables,
[data-theme="dark"] .formula-variable {
  color: #cbd5e1;
}

[data-theme="dark"] .variable-symbol {
  color: #93c5fd;
}

/* Muted text */
[data-theme="dark"] .text-muted {
  color: #cbd5e1;
}

/* Code */
[data-theme="dark"] code {
  background: #334155;
  color: #a78bfa;
}

/* Tables */
[data-theme="dark"] table,
[data-theme="dark"] th,
[data-theme="dark"] td {
  border-color: #334155;
}

[data-theme="dark"] th {
  background: #1e293b;
  color: #f8fafc;
}

[data-theme="dark"] td {
  color: #e2e8f0;
}

/* Alerts */
[data-theme="dark"] .alert-info {
  background: #1e3a5f;
  border-color: #3b82f6;
  color: #bfdbfe;
}

[data-theme="dark"] .alert-success {
  background: #14532d;
  border-color: #22c55e;
  color: #bbf7d0;
}

[data-theme="dark"] .alert-warning {
  background: #422006;
  border-color: #f59e0b;
  color: #fef08a;
}

[data-theme="dark"] .alert-error {
  background: #450a0a;
  border-color: #ef4444;
  color: #fecaca;
}

/* Calculator message */
[data-theme="dark"] .calculator-message {
  background: #1e293b !important;
  border-color: #475569 !important;
}

/* Trust bar */
[data-theme="dark"] .trust-bar {
  background: #1e293b;
}

[data-theme="dark"] .trust-item {
  color: #e2e8f0;
}

/* Stats section */
[data-theme="dark"] .stats-section {
  background: #0f172a;
}

[data-theme="dark"] .stat-card {
  background: #1e293b;
  color: #f8fafc;
  border-color: #334155;
}

/* Education section */
[data-theme="dark"] .education {
  background: #1e293b;
}

[data-theme="dark"] .education-content {
  color: #e2e8f0;
}

/* Hero section */
[data-theme="dark"] .hero {
  background: #0f172a;
  border-bottom-color: #334155;
}

[data-theme="dark"] .main-calculator {
  background: #1e293b;
  border-color: #334155;
}

/* Dark Mode Toggle Button */
.dark-mode-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--color-gray-800);
  color: var(--color-gray-100);
  font-size: 1.25rem;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: all 0.3s ease;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  justify-content: center;
}

.dark-mode-toggle:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-xl);
}

[data-theme="dark"] .dark-mode-toggle {
  background: #334155;
  color: #fbbf24;
  border: 1px solid #475569;
}

/* Dropdown menus */
[data-theme="dark"] .dropdown-menu {
  background: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .dropdown-item {
  color: #e2e8f0;
}

[data-theme="dark"] .dropdown-item:hover {
  background: #334155;
  color: #a78bfa;
}

/* Mobile nav */
[data-theme="dark"] .mobile-nav {
  background: #0f172a;
}

[data-theme="dark"] .mobile-dropdown-content {
  background: #1e293b;
}

/* ============================================
   Dark Mode - Calculator Specific Elements
   ============================================ */

/* Tips box */
[data-theme="dark"] .tips-box {
  background: linear-gradient(135deg, #422006 0%, #451a03 100%);
  border-color: #f59e0b;
  color: #fcd34d;
}

[data-theme="dark"] .tips-box h3 {
  color: #fbbf24;
}

[data-theme="dark"] .tips-box li,
[data-theme="dark"] .tips-box p {
  color: #fde68a;
}

/* Worked example */
[data-theme="dark"] .worked-example {
  background: linear-gradient(135deg, #1e3a5f 0%, #172554 100%);
  border-color: #3b82f6;
}

[data-theme="dark"] .worked-example h4 {
  color: #60a5fa;
}

[data-theme="dark"] .example-given {
  background: #0f172a;
  color: #e2e8f0;
  border-color: #334155;
}

[data-theme="dark"] .example-step {
  background: #1e293b;
  color: #e2e8f0;
  border-color: #3b82f6;
}

[data-theme="dark"] .example-answer {
  background: #3b82f6;
  color: #ffffff;
}

/* Step items */
[data-theme="dark"] .step-item {
  background: #1e293b;
  border-color: #a78bfa;
  color: #e2e8f0;
}

[data-theme="dark"] .step-content {
  color: #e2e8f0;
}

[data-theme="dark"] .steps-section {
  background: #0f172a;
}

/* Education blocks */
[data-theme="dark"] .education-block {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

[data-theme="dark"] .education-block h3 {
  color: #a78bfa;
}

[data-theme="dark"] .education-section {
  border-color: #334155;
}

/* Related calculators */
[data-theme="dark"] .related-calculators {
  background: #0f172a;
}

[data-theme="dark"] .related-card {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

[data-theme="dark"] .related-card:hover {
  border-color: #a78bfa;
}

[data-theme="dark"] .related-info h4 {
  color: #f8fafc;
}

[data-theme="dark"] .related-info p {
  color: #cbd5e1;
}

/* Calculator form */
[data-theme="dark"] .calculator-form {
  background: #0f172a;
}

[data-theme="dark"] .input-addon {
  background: #1e293b;
  border-color: #475569;
  color: #e2e8f0;
}

/* Use cases */
[data-theme="dark"] .use-cases {
  background: #1e293b;
  color: #e2e8f0;
}

[data-theme="dark"] .use-cases li {
  color: #cbd5e1;
}

/* Calculator description */
[data-theme="dark"] .calculator-description {
  color: #cbd5e1;
}

/* Paragraphs in cards */
[data-theme="dark"] .card p,
[data-theme="dark"] .calculator-container p {
  color: #cbd5e1;
}

/* Lists in dark mode */
[data-theme="dark"] li {
  color: #cbd5e1;
}

/* ============================================
   Reset & Base Styles
   ============================================ */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

body {
  font-family: var(--font-primary);
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--color-gray-700);
  background-color: var(--color-gray-50);
  overflow-x: hidden;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  font-weight: var(--font-bold);
  line-height: 1.2;
  color: var(--color-gray-900);
  margin-bottom: var(--space-4);
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  /* 32px - 48px */
  font-weight: 700;
}

h2 {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  /* 24px - 36px */
  font-weight: 600;
}

h3 {
  font-size: clamp(1.25rem, 3vw, 1.875rem);
  /* 20px - 30px */
  font-weight: 600;
}

h4 {
  font-size: var(--text-xl);
  font-weight: 600;
}

h5 {
  font-size: var(--text-lg);
  font-weight: 600;
}

h6 {
  font-size: var(--text-base);
  font-weight: 600;
}

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

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

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

ul,
ol {
  margin-left: var(--space-6);
  margin-bottom: var(--space-4);
}

li {
  margin-bottom: var(--space-2);
}

strong {
  font-weight: var(--font-semibold);
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background-color: var(--color-gray-100);
  padding: 0.125rem 0.25rem;
  border-radius: var(--radius-sm);
  color: var(--color-primary-dark);
}

/* ============================================
   Utility Classes
   ============================================ */

/* Container */
.container {
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

@media (max-width: 640px) {
  .container {
    padding: 0 var(--space-3);
    /* Reduced from space-4 (1rem) on mobile */
  }
}

/* Text Utilities */
.text-center {
  text-align: center;
}

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

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

.text-primary {
  color: var(--color-primary);
}

.text-accent {
  color: var(--color-accent);
}

.text-success {
  color: var(--color-success);
}

.text-warning {
  color: var(--color-warning);
}

.text-error {
  color: var(--color-error);
}

.text-muted {
  color: var(--color-gray-500);
}

.font-bold {
  font-weight: var(--font-bold);
}

.font-semibold {
  font-weight: var(--font-semibold);
}

.font-medium {
  font-weight: var(--font-medium);
}

/* Spacing Utilities */
.mt-1 {
  margin-top: var(--space-1);
}

.mt-2 {
  margin-top: var(--space-2);
}

.mt-4 {
  margin-top: var(--space-4);
}

.mt-6 {
  margin-top: var(--space-6);
}

.mt-8 {
  margin-top: var(--space-8);
}

.mb-1 {
  margin-bottom: var(--space-1);
}

.mb-2 {
  margin-bottom: var(--space-2);
}

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

.mb-6 {
  margin-bottom: var(--space-6);
}

.mb-8 {
  margin-bottom: var(--space-8);
}

.py-4 {
  padding-top: var(--space-4);
  padding-bottom: var(--space-4);
}

.py-6 {
  padding-top: var(--space-6);
  padding-bottom: var(--space-6);
}

.py-8 {
  padding-top: var(--space-8);
  padding-bottom: var(--space-8);
}

.px-4 {
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

.px-6 {
  padding-left: var(--space-6);
  padding-right: var(--space-6);
}

/* Display Utilities */
.hidden {
  display: none;
}

.block {
  display: block;
}

.inline-block {
  display: inline-block;
}

.flex {
  display: flex;
}

.inline-flex {
  display: inline-flex;
}

.grid {
  display: grid;
}

/* Flex Utilities */
.flex-col {
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.items-center {
  align-items: center;
}

.items-start {
  align-items: flex-start;
}

.items-end {
  align-items: flex-end;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-start {
  justify-content: flex-start;
}

.justify-end {
  justify-content: flex-end;
}

.gap-2 {
  gap: var(--space-2);
}

.gap-4 {
  gap: var(--space-4);
}

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

/* Grid Utilities */
.grid-cols-1 {
  grid-template-columns: repeat(1, minmax(0, 1fr));
}

.grid-cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* Card Component */
.card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-base);
  padding: var(--space-6);
  transition: transform var(--transition-base), opacity var(--transition-base);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Button Base Styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-8);
  /* Increased for better touch targets */
  min-height: 48px;
  /* WCAG AAA touch target */
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  border: none;
  border-radius: var(--radius-lg);
  /* More rounded for modern feel */
  cursor: pointer;
  transition: transform var(--transition-base), opacity var(--transition-base), background-color var(--transition-base),
    color var(--transition-base);
  text-decoration: none;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn-primary {
  background: var(--color-primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--color-primary-dark);
  color: #ffffff;
  text-decoration: none;
}

a.btn,
a.btn-primary,
a.btn-action,
a.btn-accent {
  color: #ffffff;
  text-decoration: none;
}

a.btn-primary:hover,
a.btn-action:hover,
a.btn-accent:hover {
  color: #ffffff;
  text-decoration: none;
}

/* Action Button - Orange CTA */
.btn-action {
  background: var(--color-action);
  color: white;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(249, 115, 22, 0.25);
}

.btn-action:hover {
  background: var(--color-action-dark);
  color: white;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}

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

.btn-accent:hover {
  background: var(--color-accent-dark);
  color: white;
  text-decoration: none;
}

.btn-secondary {
  background: var(--color-gray-200);
  color: var(--color-gray-800);
}

.btn-secondary:hover {
  background: var(--color-gray-300);
  color: var(--color-gray-900);
  text-decoration: none;
}

.btn-lg {
  padding: var(--space-5) var(--space-10);
  font-size: var(--text-lg);
  min-height: 56px;
}

/* Alert Boxes */
.alert {
  padding: var(--space-4);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
  border-left: 4px solid;
}

.alert-info {
  background-color: #dbeafe;
  border-color: var(--color-info);
  color: #1e40af;
}

.alert-success {
  background-color: #d1fae5;
  border-color: var(--color-success);
  color: #065f46;
}

.alert-warning {
  background-color: #fef3c7;
  border-color: var(--color-warning);
  color: #92400e;
}

.alert-error {
  background-color: #fee2e2;
  border-color: var(--color-error);
  color: #991b1b;
}

/* Badge */
.badge {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: white;
}

/* Responsive Design */
@media (min-width: 640px) {
  :root {
    --container-padding: var(--space-6);
  }

  h1 {
    font-size: var(--text-5xl);
  }

  .sm\:grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sm\:grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sm\:text-lg {
    font-size: var(--text-lg);
  }
}

@media (min-width: 768px) {
  :root {
    --container-padding: var(--space-8);
  }

  .md\:grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .md\:grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .md\:grid-cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .md\:flex-row {
    flex-direction: row;
  }

  .md\:text-left {
    text-align: left;
  }
}

@media (min-width: 1024px) {
  .lg\:grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .lg\:grid-cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Focus States for Accessibility */
*:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

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

/* Smooth Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn var(--transition-base);
}

.slide-down {
  animation: slideDown var(--transition-base);
}

/* ============================================
   PWA Install Banner
   ============================================ */

.pwa-install-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--color-primary);
  color: white;
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 9999;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-bottom: 3px solid var(--color-action);
  animation: slideDownBanner 0.4s ease-out;
}

@keyframes slideDownBanner {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.pwa-banner-content {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.pwa-banner-icon {
  font-size: 1.75rem;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }
}

.pwa-banner-text {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.pwa-banner-text strong {
  font-size: var(--text-base);
  font-weight: 600;
}

.pwa-banner-text span {
  font-size: var(--text-sm);
  opacity: 0.9;
}

.pwa-banner-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.pwa-install-btn {
  background: white;
  color: #2563eb;
  border: none;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.pwa-install-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3);
}

.pwa-dismiss-btn {
  background: transparent;
  border: none;
  color: white;
  font-size: 1.25rem;
  cursor: pointer;
  padding: var(--space-2);
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.pwa-dismiss-btn:hover {
  opacity: 1;
}

/* Mobile responsive */
@media (max-width: 480px) {
  .pwa-install-banner {
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-4);
  }

  .pwa-banner-content {
    width: 100%;
  }

  .pwa-banner-actions {
    width: 100%;
    justify-content: space-between;
  }

  .pwa-install-btn {
    flex: 1;
  }
}

/* Dark mode */
[data-theme="dark"] .pwa-install-banner {
  background: linear-gradient(135deg, #1e40af 0%, #4338ca 100%);
}

[data-theme="dark"] .pwa-install-btn {
  background: #f8fafc;
  color: #1e40af;
}

/* ============================================
   Cookie Consent Banner
   ============================================ */

.cookie-consent {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: #f8fafc;
  padding: var(--space-4) var(--space-6);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-4);
  z-index: var(--z-modal);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.cookie-consent-content {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
  max-width: 1200px;
  width: 100%;
}

.cookie-icon {
  font-size: 2rem;
  flex-shrink: 0;
}

.cookie-text {
  flex: 1;
  min-width: 250px;
}

.cookie-text p {
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.5;
  color: #cbd5e1;
}

.cookie-actions {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  flex-shrink: 0;
}

.cookie-btn {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
}

.cookie-accept {
  background: var(--color-primary);
  color: #ffffff;
}

.cookie-accept:hover {
  background: var(--color-primary-dark);
  transform: translateY(-1px);
}

.cookie-decline {
  background: transparent;
  color: #94a3b8;
  border: 1px solid #475569;
}

.cookie-decline:hover {
  background: #334155;
  color: #f8fafc;
}

.cookie-learn-more {
  color: #60a5fa;
  font-size: var(--text-sm);
  text-decoration: underline;
}

.cookie-learn-more:hover {
  color: #93c5fd;
}

/* Mobile responsive */
@media (max-width: 640px) {
  .cookie-consent {
    padding: var(--space-4);
    flex-direction: column;
  }

  .cookie-consent-content {
    flex-direction: column;
    text-align: center;
  }

  .cookie-actions {
    width: 100%;
    justify-content: center;
  }

  .cookie-btn {
    flex: 1;
  }
}

/* Light mode override (if needed) */
[data-theme="light"] .cookie-consent {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

/* ============================================
   Accessibility Enhancements
   ============================================ */

/* Use :focus-visible for clearer keyboard intent */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18);
}

/* Avoid persistent outlines on pointer/mouse interactions */
a:focus:not(:focus-visible),
button:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible),
textarea:focus:not(:focus-visible) {
  outline: none;
  box-shadow: none;
}

/* Respect user motion preference across global UI */
@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;
  }
}