/* ==========================================================================
   UK Insurance Guide - Common Styles
   ========================================================================== */

/* CSS Custom Properties (Variables)
   ========================================================================== */

:root {
  /* Colors - Primary */
  --color-primary: #1e293b;
  --color-primary-dark: #0f172a;
  --color-primary-light: #475569;

  /* Colors - Accent */
  --color-accent-blue: #3b82f6;
  --color-accent-red: #ef4444;
  --color-accent-yellow: #eab308;
  --color-accent-green: #22c55e;

  /* Colors - Background */
  --color-bg-primary: #f8fafc;
  --color-bg-secondary: #ffffff;
  --color-bg-accent: #f1f5f9;

  /* Colors - Semantic */
  --color-danger: #dc2626;
  --color-danger-light: #fef2f2;
  --color-warning: #d97706;
  --color-warning-light: #fffbeb;
  --color-success: #16a34a;
  --color-success-light: #f0fdf4;
  --color-info: #2563eb;
  --color-info-light: #eff6ff;

  /* Colors - Borders */
  --color-border-light: #e2e8f0;
  --color-border-medium: #cbd5e1;
  --color-border-dark: #94a3b8;

  /* Typography */
  --font-family-primary: 'Inter', system-ui, -apple-system, sans-serif;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* Font Sizes */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;
  --text-6xl: 3.75rem;

  /* Line Heights */
  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  --leading-loose: 2;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

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

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --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);

  /* Transitions */
  --transition-fast: all 0.15s ease;
  --transition-normal: all 0.2s ease;
  --transition-slow: all 0.3s ease;

  /* Container Widths */
  --container-content: 80rem;
}

/* Base Styles
   ========================================================================== */

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family-primary);
  background-color: var(--color-bg-primary);
  color: var(--color-primary);
  line-height: var(--leading-normal);
  margin: 0;
  padding: 0;
}

/* Layout Components
   ========================================================================== */

.container {
  width: 100%;
  max-width: var(--container-content);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

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

/* Navigation Components
   ========================================================================== */

.nav-sticky {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border-light);
  box-shadow: var(--shadow-sm);
}

.nav-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
}

.nav-link {
  display: inline-block;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-full);
  background: var(--color-bg-accent);
  color: var(--color-primary-light);
  font-weight: var(--font-weight-medium);
  font-size: var(--text-sm);
  text-decoration: none;
  transition: var(--transition-normal);
}

.nav-link:hover {
  background: var(--color-border-light);
  color: var(--color-primary);
}

.nav-link--primary {
  background: var(--color-success-light);
  color: var(--color-success);
}

.nav-link--primary:hover {
  background: var(--color-success);
  color: white;
}

/* Typography
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-bold);
  line-height: var(--leading-tight);
  margin: 0;
}

h1 {
  font-size: var(--text-4xl);
  color: var(--color-primary-dark);
}

h2 {
  font-size: var(--text-3xl);
  color: var(--color-primary-dark);
}

h3 {
  font-size: var(--text-2xl);
  color: var(--color-primary);
}

h4 {
  font-size: var(--text-xl);
  color: var(--color-primary);
}

@media (min-width: 768px) {
  h1 {
    font-size: var(--text-6xl);
  }
  
  h2 {
    font-size: var(--text-4xl);
  }
}

.lead-text {
  font-size: var(--text-xl);
  color: var(--color-primary-light);
  line-height: var(--leading-relaxed);
}

@media (min-width: 768px) {
  .lead-text {
    font-size: var(--text-2xl);
  }
}

/* Card Components
   ========================================================================== */

.card {
  background: var(--color-bg-secondary);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-md);
}

.content-card {
  background: var(--color-bg-secondary);
  border: 2px solid transparent;
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-md);
  transition: var(--transition-slow);
  cursor: pointer;
}

.content-card:hover {
  border-color: var(--color-border-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.content-card .details {
  display: none;
  margin-top: var(--space-4);
}

.content-card.open .details {
  display: block;
  animation: fadeIn 0.3s ease-in;
}

.content-card svg {
  transition: transform 0.3s ease;
}

.content-card.open svg {
  transform: rotate(180deg);
}

/* Card Variants */
.card--info {
  background: var(--color-info-light);
  border: 1px solid var(--color-accent-blue);
}

.card--warning {
  background: var(--color-warning-light);
  border: 1px solid var(--color-accent-yellow);
}

.card--danger {
  background: var(--color-danger-light);
  border: 1px solid var(--color-accent-red);
}

.card--success {
  background: var(--color-success-light);
  border: 1px solid var(--color-accent-green);
}

/* Section Icons
   ========================================================================== */

.section-icon {
  width: 4rem;
  height: 4rem;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-6);
}

.section-icon--blue {
  background: var(--color-info-light);
  color: var(--color-accent-blue);
}

.section-icon--red {
  background: var(--color-danger-light);
  color: var(--color-accent-red);
}

.section-icon--yellow {
  background: var(--color-warning-light);
  color: var(--color-accent-yellow);
}

.section-icon--green {
  background: var(--color-success-light);
  color: var(--color-accent-green);
}

/* Alert/Badge Components
   ========================================================================== */

.alert {
  display: inline-flex;
  align-items: center;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  font-weight: var(--font-weight-medium);
  font-size: var(--text-sm);
}

.alert--danger {
  background: var(--color-danger-light);
  color: var(--color-danger);
  border: 1px solid var(--color-accent-red);
}

.alert--warning {
  background: var(--color-warning-light);
  color: var(--color-warning);
  border: 1px solid var(--color-accent-yellow);
}

.alert--success {
  background: var(--color-success-light);
  color: var(--color-success);
  border: 1px solid var(--color-accent-green);
}

/* Chart Container
   ========================================================================== */

.chart-container {
  position: relative;
  width: 100%;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  height: 350px;
  max-height: 450px;
}

@media (min-width: 768px) {
  .chart-container {
    height: 450px;
  }
}

/* Button Components
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  font-weight: var(--font-weight-medium);
  font-size: var(--text-base);
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: var(--transition-normal);
}

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

.btn--primary:hover {
  background: var(--color-info);
  transform: translateY(-1px);
}

.btn--secondary {
  background: var(--color-bg-accent);
  color: var(--color-primary);
  border: 1px solid var(--color-border-light);
}

.btn--secondary:hover {
  background: var(--color-border-light);
}

/* Grid Components
   ========================================================================== */

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

.grid--cols-1 {
  grid-template-columns: 1fr;
}

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

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

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

/* Spacing Utilities
   ========================================================================== */

.space-y-4 > * + * {
  margin-top: var(--space-4);
}

.space-y-6 > * + * {
  margin-top: var(--space-6);
}

.space-y-8 > * + * {
  margin-top: var(--space-8);
}

.space-y-16 > * + * {
  margin-top: var(--space-16);
}

.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.mb-12 { margin-bottom: var(--space-12); }
.mb-16 { margin-bottom: var(--space-16); }

.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); }

/* Text Utilities
   ========================================================================== */

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

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

.text-primary { color: var(--color-primary); }
.text-primary-light { color: var(--color-primary-light); }
.text-danger { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }
.text-success { color: var(--color-success); }

/* Background Utilities
   ========================================================================== */

.bg-gradient {
  background: linear-gradient(135deg, var(--color-success-light) 0%, var(--color-info-light) 100%);
}

.bg-dark {
  background: linear-gradient(135deg, var(--color-primary) 0%, #334155 100%);
  color: #f1f5f9;
  border: 1px solid var(--color-border-medium);
  box-shadow: var(--shadow-md);
}

/* Enhanced dark section styling */
.card.bg-dark {
  border-radius: var(--radius-xl);
  padding: var(--space-8);
}

.card.bg-dark h3 {
  color: #f8fafc;
  margin-bottom: var(--space-4);
}

.card.bg-dark .text-left {
  margin-bottom: var(--space-6);
}

.card.bg-dark .text-left:last-child {
  margin-bottom: 0;
}

/* Alternative background utilities for better integration */
.bg-subtle {
  background: linear-gradient(135deg, var(--color-bg-accent) 0%, #e2e8f0 100%);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
}

.bg-accent {
  background: linear-gradient(135deg, var(--color-info-light) 0%, #dbeafe 100%);
  border: 1px solid #93c5fd;
  border-radius: var(--radius-lg);
}

.bg-highlight {
  background: linear-gradient(135deg, #1e293b 0%, #475569 100%);
  color: #f1f5f9;
  border: 1px solid #64748b;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

/* Animations
   ========================================================================== */

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

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

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

.animate-fade-in {
  animation: fadeIn 0.6s ease-out;
}

.animate-slide-up {
  animation: slideInUp 0.6s ease-out;
}

/* Scroll behavior
   ========================================================================== */

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

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus styles for accessibility */
*:focus {
  outline: 2px solid var(--color-accent-blue);
  outline-offset: 2px;
}

/* Print styles
   ========================================================================== */

@media print {
  body {
    background: white;
    color: black;
  }
  
  .nav-sticky {
    display: none;
  }
  
  .chart-container {
    break-inside: avoid;
  }
} 