/* ================================================
   Republic Daily Pro - Global Stylesheet v2.0
   Dark Premium Theme with Glassmorphism
   Enhanced with 3D Animations & Dark Mode System
   System Fonts Only - No External Dependencies
   ================================================ */

/* ============================================
   CSS Custom Properties (Design Tokens)
   ============================================ */
:root {
  /* Primary Colors */
  --color-primary: #6366f1;
  --color-primary-light: #818cf8;
  --color-primary-dark: #4f46e5;
  --color-primary-glow: rgba(99, 102, 241, 0.4);
  
  /* Secondary Colors */
  --color-secondary: #10b981;
  --color-secondary-light: #34d399;
  --color-secondary-dark: #059669;
  
  /* Accent Colors */
  --color-accent: #f59e0b;
  --color-accent-light: #fbbf24;
  
  /* Background Colors - Dark Mode (Default) */
  --bg-dark: #0a0a12;
  --bg-darker: #050508;
  --bg-card: rgba(25, 25, 45, 0.65);
  --bg-card-hover: rgba(35, 35, 60, 0.75);
  --bg-input: rgba(15, 15, 30, 0.85);
  --bg-gradient-start: #0a0a12;
  --bg-gradient-end: #151525;
  --bg-elevated: rgba(30, 30, 55, 0.7);
  
  /* Text Colors */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0a0a12;
  
  /* Border Colors */
  --border-color: rgba(99, 102, 241, 0.25);
  --border-color-light: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);
  
  /* State Colors */
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-error: #ef4444;
  --color-info: #3b82f6;
  
  /* Glassmorphism */
  --glass-bg: rgba(25, 25, 45, 0.45);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-blur: 16px;
  
  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 0 30px var(--color-primary-glow);
  --shadow-glow-sm: 0 0 15px var(--color-primary-glow);
  --shadow-3d: 0 20px 40px rgba(0, 0, 0, 0.5), 0 0 1px rgba(99, 102, 241, 0.3);
  
  /* Typography */
  --font-system: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', Menlo, Monaco, Consolas, monospace;
  
  /* Font Sizes - Responsive Scale */
  --text-xs: clamp(0.65rem, 0.6rem + 0.25vw, 0.75rem);
  --text-sm: clamp(0.8rem, 0.75rem + 0.25vw, 0.875rem);
  --text-base: clamp(0.9rem, 0.85rem + 0.25vw, 1rem);
  --text-lg: clamp(1rem, 0.95rem + 0.3vw, 1.125rem);
  --text-xl: clamp(1.1rem, 1rem + 0.5vw, 1.25rem);
  --text-2xl: clamp(1.3rem, 1.1rem + 1vw, 1.5rem);
  --text-3xl: clamp(1.5rem, 1.2rem + 1.5vw, 1.875rem);
  --text-4xl: clamp(1.8rem, 1.3rem + 2.5vw, 2.25rem);
  --text-5xl: clamp(2.2rem, 1.5rem + 3.5vw, 3rem);
  --text-6xl: clamp(2.8rem, 1.8rem + 5vw, 3.75rem);
  
  /* Line Heights */
  --leading-tight: 1.2;
  --leading-normal: 1.5;
  --leading-relaxed: 1.65;
  
  /* 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-xs: 0.125rem;
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-3xl: 2rem;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-fast: 120ms ease;
  --transition-normal: 220ms ease;
  --transition-slow: 320ms ease;
  --transition-spring: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
  
  /* Z-Index Scale */
  --z-base: 1;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-modal: 300;
  --z-toast: 400;
  --z-tooltip: 500;
  
  /* 3D Transform Presets */
  --perspective: 1000px;
  --rotate-x: 0deg;
  --rotate-y: 0deg;
}

/* ============================================
   Light Mode Theme (Optional)
   ============================================ */
[data-theme="light"] {
  --bg-dark: #f8fafc;
  --bg-darker: #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: rgba(255, 255, 255, 0.95);
  --bg-input: rgba(241, 245, 249, 0.9);
  --bg-gradient-start: #f8fafc;
  --bg-gradient-end: #e2e8f0;
  --bg-elevated: rgba(255, 255, 255, 0.9);
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #f8fafc;
  
  --border-color: rgba(99, 102, 241, 0.15);
  --border-color-light: rgba(0, 0, 0, 0.05);
  
  --glass-bg: rgba(255, 255, 255, 0.6);
  --glass-border: rgba(0, 0, 0, 0.05);
  
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-3d: 0 20px 40px rgba(0, 0, 0, 0.1);
}

/* ============================================
   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;
  }
  
  .particle-canvas,
  .hero-particles,
  .floating-element,
  .parallax-layer {
    display: none !important;
  }
}

/* ============================================
   CSS Reset & Base Styles
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-system);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background: var(--bg-dark);
  background: linear-gradient(145deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  position: relative;
}

/* Animated Background Pattern */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    radial-gradient(ellipse at 15% 20%, rgba(99, 102, 241, 0.12) 0%, transparent 45%),
    radial-gradient(ellipse at 85% 80%, rgba(16, 185, 129, 0.08) 0%, transparent 45%),
    radial-gradient(ellipse at 50% 50%, rgba(139, 92, 246, 0.05) 0%, transparent 60%);
  pointer-events: none;
  z-index: -2;
  animation: backgroundPulse 20s ease-in-out infinite;
}

@keyframes backgroundPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Floating Background Elements */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    radial-gradient(circle at 20% 80%, rgba(99, 102, 241, 0.03) 0%, transparent 25%),
    radial-gradient(circle at 80% 20%, rgba(16, 185, 129, 0.03) 0%, transparent 25%);
  pointer-events: none;
  z-index: -1;
  animation: backgroundShift 30s ease-in-out infinite alternate;
}

@keyframes backgroundShift {
  0% { transform: translateX(0) translateY(0); }
  100% { transform: translateX(20px) translateY(-20px); }
}

/* ============================================
   Typography
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: var(--leading-tight);
  color: var(--text-primary);
  margin-bottom: var(--space-4);
  letter-spacing: -0.02em;
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); font-weight: 600; }

p {
  margin-bottom: var(--space-4);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

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

a:hover {
  color: var(--color-primary);
}

a:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

strong, b {
  font-weight: 600;
  color: var(--text-primary);
}

small {
  font-size: var(--text-sm);
}

code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

code {
  padding: 0.15em 0.4em;
  background: rgba(99, 102, 241, 0.15);
  border-radius: var(--radius-sm);
  color: var(--color-primary-light);
}

/* ============================================
   Layout Utilities
   ============================================ */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

@media (max-width: 480px) {
  .container {
    padding: 0 var(--space-4);
  }
}

.container-narrow {
  max-width: 800px;
}

.container-wide {
  max-width: 1400px;
}

.flex {
  display: flex;
}

.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-end {
  justify-content: flex-end;
}

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

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

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-error { color: var(--color-error); }

.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

.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); }
.mt-12 { margin-top: var(--space-12); }
.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); }
.mb-12 { margin-bottom: var(--space-12); }
.mx-auto { margin-left: auto; margin-right: auto; }

.p-2 { padding: var(--space-2); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

.hidden { display: none !important; }
.block { display: block; }
.inline-block { display: inline-block; }
.inline-flex { display: inline-flex; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }

.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }

/* ============================================
   Grid System
   ============================================ */
.grid {
  display: grid;
}

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

.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }
.col-span-full { grid-column: 1 / -1; }

.row-span-2 { grid-row: span 2; }

/* Responsive Grid */
@media (max-width: 1200px) {
  .xl\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
  .xl\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1024px) {
  .lg\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
  .lg\:grid-cols-1 { grid-template-columns: 1fr; }
  .lg\:col-span-1 { grid-column: span 1; }
}

@media (max-width: 768px) {
  .md\:grid-cols-1 { grid-template-columns: 1fr; }
  .md\:flex-col { flex-direction: column; }
  .md\:text-left { text-align: left; }
}

@media (max-width: 640px) {
  .sm\:grid-cols-1 { grid-template-columns: 1fr; }
  .sm\:flex-col { flex-direction: column; }
  .sm\:hidden { display: none !important; }
}

/* ============================================
   Glass Card Component with 3D Effects
   ============================================ */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  transition: 
    transform var(--transition-normal),
    box-shadow var(--transition-normal),
    border-color var(--transition-normal);
  transform-style: preserve-3d;
  perspective: var(--perspective);
}

.glass-card:hover {
  transform: translateY(-4px) rotateX(2deg);
  box-shadow: var(--shadow-3d), var(--shadow-glow-sm);
  border-color: rgba(99, 102, 241, 0.35);
}

.glass-card-static {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
}

.glass-card-interactive {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  cursor: pointer;
  transition: 
    transform var(--transition-spring),
    box-shadow var(--transition-normal),
    border-color var(--transition-normal);
  transform-style: preserve-3d;
  will-change: transform;
}

.glass-card-interactive:hover {
  transform: translateY(-6px) rotateX(3deg) rotateY(-1deg);
  box-shadow: var(--shadow-xl), var(--shadow-glow);
  border-color: rgba(99, 102, 241, 0.4);
}

.glass-card-interactive:active {
  transform: translateY(-2px) rotateX(1deg);
  transition-duration: 50ms;
}

.card-header {
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-color-light);
}

.card-title {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.card-description {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* ============================================
   Button Components
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-system);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: 
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    background var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: var(--text-primary);
  box-shadow: var(--shadow-md), var(--shadow-glow-sm);
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  transition: left 0.5s ease;
}

.btn-primary:hover:not(:disabled)::before {
  left: 100%;
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--color-primary) 100%);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: var(--shadow-sm), var(--shadow-glow-sm);
}

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

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--color-primary);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--color-primary-light);
  border: 1px solid var(--color-primary);
}

.btn-outline:hover:not(:disabled) {
  background: rgba(99, 102, 241, 0.12);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.btn-success {
  background: linear-gradient(135deg, var(--color-secondary) 0%, var(--color-secondary-dark) 100%);
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
}

.btn-success:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--color-secondary-light) 0%, var(--color-secondary) 100%);
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, var(--color-error) 0%, #dc2626 100%);
  color: var(--text-primary);
}

.btn-danger:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
}

.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
  border-radius: var(--radius-md);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
}

.btn-xl {
  padding: var(--space-5) var(--space-10);
  font-size: var(--text-lg);
}

.btn-icon {
  padding: var(--space-3);
  width: 40px;
  height: 40px;
}

.btn-icon-lg {
  padding: var(--space-4);
  width: 48px;
  height: 48px;
}

/* Button Group */
.btn-group {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* ============================================
   Form Components
   ============================================ */
.form-group {
  margin-bottom: var(--space-5);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.form-label-required::after {
  content: ' *';
  color: var(--color-error);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-system);
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  transition: 
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    background var(--transition-fast);
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
  border-color: var(--border-focus);
  background: rgba(20, 20, 35, 0.9);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
  background: rgba(20, 20, 35, 0.95);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-input-error {
  border-color: var(--color-error) !important;
  background: rgba(239, 68, 68, 0.05);
}

.form-input-error:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2) !important;
}

.form-input-success {
  border-color: var(--color-success) !important;
}

.form-error {
  font-size: var(--text-sm);
  color: var(--color-error);
  margin-top: var(--space-2);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: rgba(239, 68, 68, 0.1);
  border-radius: var(--radius-md);
  animation: shake 0.3s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-2);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-4) center;
  padding-right: var(--space-12);
  cursor: pointer;
}

/* Currency Input */
.currency-input-wrapper {
  position: relative;
}

.currency-input-wrapper::before {
  content: '£';
  position: absolute;
  left: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-primary-light);
  font-weight: 600;
  pointer-events: none;
  z-index: 1;
}

.currency-input-wrapper .form-input {
  padding-left: var(--space-10);
}

/* Percentage Input */
.percentage-input-wrapper {
  position: relative;
}

.percentage-input-wrapper::after {
  content: '%';
  position: absolute;
  right: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-weight: 500;
  pointer-events: none;
}

.percentage-input-wrapper .form-input {
  padding-right: var(--space-10);
}

/* Toggle Switch */
.toggle-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.toggle {
  position: relative;
  width: 52px;
  height: 28px;
  cursor: pointer;
  flex-shrink: 0;
}

.toggle input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  z-index: 2;
}

.toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-input);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-full);
  transition: all var(--transition-fast);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 2px;
  top: 2px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.toggle input:checked + .toggle-slider {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(24px);
  background: var(--text-primary);
}

.toggle input:focus-visible + .toggle-slider {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.toggle-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

/* Segmented Control */
.segmented-control {
  display: flex;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 4px;
  gap: 4px;
}

.segmented-btn {
  flex: 1;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.segmented-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.segmented-btn.active {
  background: var(--color-primary);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.segmented-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
}

/* Range Slider */
.range-wrapper {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.range-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.range-value {
  font-weight: 600;
  color: var(--color-primary-light);
}

input[type="range"] {
  width: 100%;
  height: 8px;
  background: var(--bg-input);
  border-radius: var(--radius-full);
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow-md), 0 0 10px var(--color-primary-glow);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: var(--shadow-lg), 0 0 20px var(--color-primary-glow);
}

input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: var(--shadow-md);
}

input[type="range"]:focus-visible::-webkit-slider-thumb {
  box-shadow: var(--shadow-md), 0 0 0 4px rgba(99, 102, 241, 0.25);
}

/* ============================================
   Header & Navigation
   ============================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: rgba(10, 10, 18, 0.88);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--border-color-light);
  transition: background var(--transition-fast);
}

.site-header.scrolled {
  background: rgba(10, 10, 18, 0.95);
  box-shadow: var(--shadow-md);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  max-width: 1400px;
  margin: 0 auto;
}

@media (max-width: 480px) {
  .header-inner {
    padding: var(--space-3) var(--space-4);
  }
}

.site-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

@media (max-width: 360px) {
  .site-logo span {
    display: none;
  }
}

.site-logo:hover {
  color: var(--color-primary-light);
}

.logo-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: var(--text-base);
  color: white;
  box-shadow: var(--shadow-sm), 0 0 15px var(--color-primary-glow);
  transition: transform var(--transition-fast);
}

.site-logo:hover .logo-icon {
  transform: rotate(-5deg) scale(1.05);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.nav-link {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--color-primary);
  transition: all var(--transition-fast);
  transform: translateX(-50%);
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.nav-link:hover::after {
  width: 50%;
}

.nav-link.active {
  color: var(--color-primary-light);
  background: rgba(99, 102, 241, 0.12);
}

.nav-link.active::after {
  width: 50%;
  background: var(--color-primary-light);
}

.mobile-menu-btn {
  display: none;
  padding: var(--space-2);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-primary);
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
}

.mobile-menu-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

@media (max-width: 768px) {
  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .main-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--bg-darker);
    border-bottom: 1px solid var(--border-color-light);
    padding: var(--space-4);
    gap: var(--space-2);
    display: none;
    box-shadow: var(--shadow-lg);
  }
  
  .main-nav.open {
    display: flex;
    animation: slideDown 0.25s ease;
  }
  
  @keyframes slideDown {
    from {
      opacity: 0;
      transform: translateY(-10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  
  .nav-link {
    width: 100%;
    padding: var(--space-3) var(--space-4);
  }
  
  .nav-link::after {
    display: none;
  }
}

/* Theme Toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.theme-toggle:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--color-primary);
}

/* ============================================
   Footer
   ============================================ */
.site-footer {
  background: var(--bg-darker);
  border-top: 1px solid var(--border-color-light);
  padding: var(--space-16) var(--space-6) var(--space-8);
  margin-top: var(--space-20);
  position: relative;
}

.site-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-primary), transparent);
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-10);
  margin-bottom: var(--space-10);
}

@media (max-width: 900px) {
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-8);
  }
}

@media (max-width: 480px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }
}

.footer-section h4 {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-5);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: var(--space-3);
}

.footer-links a {
  font-size: var(--text-sm);
  color: var(--text-muted);
  transition: color var(--transition-fast);
  display: inline-block;
}

.footer-links a:hover {
  color: var(--color-primary-light);
  transform: translateX(4px);
}

.footer-bottom {
  padding-top: var(--space-8);
  border-top: 1px solid var(--border-color-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.footer-copyright {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* ============================================
   Breadcrumbs
   ============================================ */
.breadcrumbs {
  padding: var(--space-4) 0;
  margin-bottom: var(--space-4);
}

.breadcrumb-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  list-style: none;
  font-size: var(--text-sm);
}

.breadcrumb-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-muted);
}

.breadcrumb-item a {
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.breadcrumb-item a:hover {
  color: var(--color-primary-light);
}

.breadcrumb-item.active {
  color: var(--text-primary);
  font-weight: 500;
}

.breadcrumb-separator {
  color: var(--text-muted);
  user-select: none;
}

/* ============================================
   Tool Page Layout
   ============================================ */
.tool-page {
  padding: var(--space-8) 0;
  min-height: calc(100vh - 200px);
}

.tool-header {
  text-align: center;
  margin-bottom: var(--space-12);
}

.tool-title {
  font-size: var(--text-4xl);
  margin-bottom: var(--space-4);
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--color-primary-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tool-description {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  max-width: 650px;
  margin: 0 auto;
  line-height: var(--leading-relaxed);
}

.tool-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-8);
  margin-bottom: var(--space-12);
}

@media (max-width: 1024px) {
  .tool-content {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }
}

.tool-inputs {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.tool-results {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

/* ============================================
   Result Display Components
   ============================================ */
.result-card {
  background: linear-gradient(145deg, rgba(99, 102, 241, 0.12) 0%, rgba(16, 185, 129, 0.06) 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  position: relative;
  overflow: hidden;
}

.result-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
}

.result-main {
  text-align: center;
  padding: var(--space-8) var(--space-4);
}

.result-value {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: 800;
  color: var(--color-primary-light);
  margin-bottom: var(--space-3);
  text-shadow: 0 0 30px var(--color-primary-glow);
  transition: transform var(--transition-spring);
}

.result-value.updated {
  animation: resultPulse 0.5s ease;
}

@keyframes resultPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

.result-label {
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
}

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

.breakdown-table {
  width: 100%;
  border-collapse: collapse;
}

.breakdown-table th,
.breakdown-table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--border-color-light);
}

.breakdown-table th {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.breakdown-table td {
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.breakdown-table tr:last-child td,
.breakdown-table tr:last-child th {
  border-bottom: none;
}

.breakdown-table .amount {
  font-weight: 600;
  color: var(--color-primary-light);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.breakdown-table .total-row td {
  font-weight: 700;
  font-size: var(--text-base);
  border-top: 2px solid var(--border-color);
  background: rgba(99, 102, 241, 0.05);
}

/* Result Highlight Animation */
.result-highlight {
  animation: highlightFade 2s ease;
}

@keyframes highlightFade {
  0% {
    background: rgba(99, 102, 241, 0.2);
  }
  100% {
    background: transparent;
  }
}

/* ============================================
   Toast Notifications
   ============================================ */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}

@media (max-width: 480px) {
  .toast-container {
    left: var(--space-4);
    right: var(--space-4);
    bottom: var(--space-4);
  }
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--bg-card);
  backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  min-width: 280px;
  max-width: 400px;
  animation: toastSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: auto;
}

@media (max-width: 480px) {
  .toast {
    min-width: auto;
    width: 100%;
    max-width: none;
  }
}

@keyframes toastSlideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast-success { border-color: var(--color-success); }
.toast-error { border-color: var(--color-error); }
.toast-warning { border-color: var(--color-warning); }
.toast-info { border-color: var(--color-info); }

.toast-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.toast-success .toast-icon { color: var(--color-success); }
.toast-error .toast-icon { color: var(--color-error); }
.toast-warning .toast-icon { color: var(--color-warning); }
.toast-info .toast-icon { color: var(--color-info); }

.toast-message {
  font-size: var(--text-sm);
  color: var(--text-primary);
  line-height: var(--leading-normal);
}

/* ============================================
   Related Tools Widget
   ============================================ */
.related-tools {
  margin-top: var(--space-16);
  padding-top: var(--space-10);
  border-top: 1px solid var(--border-color-light);
}

.related-tools-title {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-6);
}

.related-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-5);
}

.related-tool-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-5);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  text-decoration: none;
  transition: all var(--transition-fast);
  transform-style: preserve-3d;
  perspective: 600px;
}

.related-tool-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--color-primary);
  transform: translateY(-3px) rotateX(1deg);
  box-shadow: var(--shadow-lg), var(--shadow-glow-sm);
}

.related-tool-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: var(--text-lg);
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.related-tool-content h4 {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.related-tool-content p {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin: 0;
  line-height: var(--leading-normal);
}

/* ============================================
   Prev/Next Navigation
   ============================================ */
.tool-nav {
  display: flex;
  justify-content: space-between;
  gap: var(--space-5);
  margin-top: var(--space-10);
  padding-top: var(--space-10);
  border-top: 1px solid var(--border-color-light);
}

.tool-nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-6);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  text-decoration: none;
  transition: all var(--transition-fast);
  max-width: 45%;
  min-width: 200px;
}

.tool-nav-link:hover {
  background: var(--bg-card-hover);
  border-color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.tool-nav-link.next {
  margin-left: auto;
  text-align: right;
}

.tool-nav-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-1);
  display: block;
}

.tool-nav-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
}

@media (max-width: 640px) {
  .tool-nav {
    flex-direction: column;
  }
  
  .tool-nav-link {
    max-width: 100%;
    min-width: auto;
  }
  
  .tool-nav-link.next {
    margin-left: 0;
  }
}

/* ============================================
   FAQ Section
   ============================================ */
.faq-section {
  margin-top: var(--space-16);
}

.faq-title {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-8);
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: border-color var(--transition-fast);
}

.faq-item:hover {
  border-color: var(--border-focus);
}

.faq-item.open {
  border-color: var(--color-primary);
}

.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--space-5) var(--space-6);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background var(--transition-fast);
}

.faq-question:hover {
  background: rgba(255, 255, 255, 0.03);
}

.faq-icon {
  width: 22px;
  height: 22px;
  color: var(--text-muted);
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}

.faq-item.open .faq-icon {
  transform: rotate(180deg);
  color: var(--color-primary);
}

.faq-answer {
  padding: 0 var(--space-6) var(--space-5);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
  display: none;
  animation: fadeDown 0.25s ease;
}

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

.faq-item.open .faq-answer {
  display: block;
}

/* ============================================
   Back to Top Button
   ============================================ */
.back-to-top {
  position: fixed;
  bottom: var(--space-6);
  left: var(--space-6);
  width: 48px;
  height: 48px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all var(--transition-fast);
  z-index: var(--z-sticky);
  box-shadow: var(--shadow-lg);
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  transform: translateY(-3px);
  box-shadow: var(--shadow-glow);
}

.back-to-top svg {
  width: 22px;
  height: 22px;
  color: var(--text-primary);
}

/* ============================================
   Landing Page Specific Styles
   ============================================ */
.hero-section {
  position: relative;
  min-height: 92vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hero-background {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -1;
}

.hero-particles {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

.hero-gradient {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(ellipse at center, transparent 0%, var(--bg-dark) 65%);
}

.hero-content {
  text-align: center;
  max-width: 850px;
  padding: var(--space-8);
  z-index: 1;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-5);
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-primary-light);
  margin-bottom: var(--space-6);
  animation: badgePulse 3s ease-in-out infinite;
}

@keyframes badgePulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--color-primary-glow); }
  50% { box-shadow: 0 0 0 8px transparent; }
}

.hero-title {
  font-size: var(--text-5xl);
  font-weight: 800;
  margin-bottom: var(--space-6);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.hero-title-gradient {
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--color-primary-light) 50%, var(--color-secondary-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-description {
  font-size: var(--text-xl);
  color: var(--text-secondary);
  margin-bottom: var(--space-10);
  line-height: var(--leading-relaxed);
  max-width: 650px;
  margin-left: auto;
  margin-right: auto;
}

.hero-cta {
  display: flex;
  justify-content: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .hero-title {
    font-size: var(--text-3xl);
  }
  
  .hero-description {
    font-size: var(--text-lg);
  }
}

@media (max-width: 480px) {
  .hero-section {
    min-height: 85vh;
  }
  
  .hero-content {
    padding: var(--space-5);
  }
  
  .hero-cta {
    flex-direction: column;
    align-items: stretch;
  }
  
  .hero-cta .btn {
    width: 100%;
  }
}

/* Tool Preview Grid */
.tools-preview {
  padding: var(--space-24) 0;
  position: relative;
}

.section-header {
  text-align: center;
  margin-bottom: var(--space-14);
}

.section-title {
  font-size: var(--text-3xl);
  margin-bottom: var(--space-4);
}

.section-description {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-6);
}

@media (max-width: 1100px) {
  .tools-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .tools-grid {
    grid-template-columns: 1fr;
  }
}

/* Tool Card with 3D Effect */
.tool-card {
  display: flex;
  flex-direction: column;
  padding: var(--space-6);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  text-decoration: none;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
  transform-style: preserve-3d;
  perspective: 800px;
}

.tool-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease;
}

.tool-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 0;
  background: linear-gradient(180deg, transparent, rgba(99, 102, 241, 0.1));
  transition: height 0.3s ease;
}

.tool-card:hover {
  transform: translateY(-8px) rotateX(4deg) rotateY(-2deg);
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 
    0 25px 50px rgba(0, 0, 0, 0.4),
    0 0 30px var(--color-primary-glow);
}

.tool-card:hover::before {
  transform: scaleX(1);
}

.tool-card:hover::after {
  height: 100%;
}

.tool-card-icon {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-5);
  font-size: var(--text-xl);
  color: white;
  box-shadow: var(--shadow-md), 0 0 15px var(--color-primary-glow);
  transition: transform var(--transition-fast);
}

.tool-card:hover .tool-card-icon {
  transform: scale(1.1) rotate(-5deg);
}

.tool-card-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.tool-card-description {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-5);
  flex-grow: 1;
  line-height: var(--leading-relaxed);
}

.tool-card-cta {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-primary-light);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  transition: gap var(--transition-fast);
}

.tool-card:hover .tool-card-cta {
  gap: var(--space-3);
}

/* Trust Section */
.trust-section {
  padding: var(--space-16) 0;
  background: rgba(0, 0, 0, 0.25);
  position: relative;
}

.trust-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 50%, rgba(16, 185, 129, 0.06) 0%, transparent 50%);
  pointer-events: none;
}

.trust-grid {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-10);
}

@media (max-width: 768px) {
  .trust-grid {
    gap: var(--space-6);
  }
}

.trust-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-6);
  background: rgba(30, 30, 50, 0.4);
  border: 1px solid var(--border-color-light);
  border-radius: var(--radius-xl);
  transition: all var(--transition-fast);
}

.trust-item:hover {
  background: rgba(40, 40, 60, 0.5);
  border-color: var(--border-focus);
  transform: translateY(-2px);
}

.trust-icon {
  width: 44px;
  height: 44px;
  background: rgba(99, 102, 241, 0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary-light);
  flex-shrink: 0;
}

.trust-text {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
}

/* ============================================
   Tools Hub Specific Styles
   ============================================ */
.popular-strip {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.12) 0%, rgba(16, 185, 129, 0.08) 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: var(--space-4) var(--space-6);
  margin-bottom: var(--space-10);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .popular-strip {
    flex-direction: column;
    align-items: flex-start;
  }
}

.popular-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.popular-links {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.popular-link {
  padding: var(--space-2) var(--space-5);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.popular-link:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow-sm);
}

/* Silo Map */
.silo-map {
  margin-top: var(--space-16);
  padding: var(--space-8);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
}

.silo-map-title {
  font-size: var(--text-xl);
  margin-bottom: var(--space-8);
}

.silo-categories {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-8);
}

@media (max-width: 768px) {
  .silo-categories {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }
}

.silo-category h4 {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-primary-light);
  margin-bottom: var(--space-4);
}

.silo-category ul {
  list-style: none;
}

.silo-category li {
  margin-bottom: var(--space-3);
}

.silo-category a {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.silo-category a:hover {
  color: var(--color-primary-light);
}

/* ============================================
   Legal Pages
   ============================================ */
.legal-content {
  max-width: 850px;
  margin: 0 auto;
  padding: var(--space-8) 0;
}

.legal-content h2 {
  font-size: var(--text-xl);
  margin-top: var(--space-10);
  margin-bottom: var(--space-5);
}

.legal-content h3 {
  font-size: var(--text-lg);
  margin-top: var(--space-8);
  margin-bottom: var(--space-4);
}

.legal-content p {
  margin-bottom: var(--space-5);
  line-height: var(--leading-relaxed);
}

.legal-content ul,
.legal-content ol {
  margin-bottom: var(--space-5);
  padding-left: var(--space-8);
}

.legal-content li {
  margin-bottom: var(--space-3);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

.last-updated {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-8);
  padding: var(--space-3) var(--space-4);
  background: rgba(99, 102, 241, 0.1);
  border-radius: var(--radius-md);
  display: inline-block;
}

/* ============================================
   404 Page
   ============================================ */
.error-page {
  min-height: 65vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-10) var(--space-6);
}

.error-code {
  font-size: clamp(6rem, 15vw, 10rem);
  font-weight: 900;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: var(--space-4);
  animation: errorFloat 3s ease-in-out infinite;
}

@keyframes errorFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-15px); }
}

.error-title {
  font-size: var(--text-3xl);
  margin-bottom: var(--space-4);
}

.error-description {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  margin-bottom: var(--space-10);
  max-width: 500px;
}

/* ============================================
   Contact Page
   ============================================ */
.contact-form {
  max-width: 650px;
  margin: 0 auto;
}

.contact-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-5);
  margin-bottom: var(--space-10);
}

.contact-info-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-5);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  transition: all var(--transition-fast);
}

.contact-info-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
  transform: translateY(-2px);
}

.contact-info-icon {
  width: 44px;
  height: 44px;
  background: rgba(99, 102, 241, 0.15);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary-light);
  flex-shrink: 0;
}

.contact-info-text h4 {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.contact-info-text p {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin: 0;
}

/* ============================================
   About Page
   ============================================ */
.about-hero {
  text-align: center;
  padding: var(--space-16) 0;
}

.about-content {
  max-width: 850px;
  margin: 0 auto;
}

.about-section {
  margin-bottom: var(--space-14);
}

.feature-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-6);
  margin-top: var(--space-8);
}

.feature-item {
  padding: var(--space-5);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  transition: all var(--transition-fast);
}

.feature-item:hover {
  border-color: var(--border-focus);
  transform: translateY(-2px);
}

.feature-item h4 {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.feature-item p {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin: 0;
  line-height: var(--leading-relaxed);
}

/* ============================================
   3D Animation Classes
   ============================================ */
.float-animation {
  animation: floatY 6s ease-in-out infinite;
}

@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-15px); }
}

.pulse-glow {
  animation: pulseGlow 3s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 20px var(--color-primary-glow); }
  50% { box-shadow: 0 0 40px var(--color-primary-glow), 0 0 60px rgba(99, 102, 241, 0.2); }
}

.tilt-3d {
  transform-style: preserve-3d;
  transition: transform 0.4s ease;
}

.tilt-3d:hover {
  transform: perspective(800px) rotateX(5deg) rotateY(-3deg);
}

/* Parallax Layers */
.parallax-container {
  perspective: 1000px;
  overflow: hidden;
  position: relative;
}

.parallax-layer {
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.parallax-layer-1 {
  transform: translateZ(-100px) scale(1.1);
}

.parallax-layer-2 {
  transform: translateZ(-50px) scale(1.05);
}

/* Floating Orbs */
.floating-orb {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(99, 102, 241, 0.3), transparent);
  filter: blur(40px);
  pointer-events: none;
  animation: orbFloat 20s ease-in-out infinite;
}

@keyframes orbFloat {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  25% {
    transform: translate(30px, -30px) scale(1.1);
  }
  50% {
    transform: translate(-20px, -60px) scale(0.9);
  }
  75% {
    transform: translate(-40px, -20px) scale(1.05);
  }
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
  body {
    background: white;
    color: black;
  }
  
  body::before,
  body::after {
    display: none;
  }
  
  .site-header,
  .site-footer,
  .back-to-top,
  .toast-container,
  .hero-background,
  .floating-orb {
    display: none !important;
  }
  
  .glass-card,
  .glass-card-static,
  .glass-card-interactive {
    background: #f8f8f8;
    border: 1px solid #ddd;
    backdrop-filter: none;
    box-shadow: none;
  }
  
  .result-card::before {
    display: none;
  }
}

/* ============================================
   Utility Classes for Calculators
   ============================================ */
.input-group {
  display: flex;
  align-items: stretch;
}

.input-group .form-input {
  flex: 1;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.input-group-btn {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  margin-left: -1px;
}

.input-addon {
  display: flex;
  align-items: center;
  padding: 0 var(--space-4);
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid var(--border-color);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  margin-left: -1px;
  color: var(--text-muted);
  font-weight: 500;
}

.input-addon-left {
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  margin-left: 0;
  margin-right: -1px;
}

/* Spacing utilities */
.my-2 { margin-top: var(--space-2); margin-bottom: var(--space-2); }
.my-4 { margin-top: var(--space-4); margin-bottom: var(--space-4); }
.my-6 { margin-top: var(--space-6); margin-bottom: var(--space-6); }
.my-8 { margin-top: var(--space-8); margin-bottom: var(--space-8); }
.py-2 { padding-top: var(--space-2); padding-bottom: var(--space-2); }
.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-2 { padding-left: var(--space-2); padding-right: var(--space-2); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.px-6 { padding-left: var(--space-6); padding-right: var(--space-6); }
.px-8 { padding-left: var(--space-8); padding-right: var(--space-8); }


/* ===== RepublicDaily SEO + EEAT Enhancements ===== */
.tool-meta, .article-meta{
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
}
.tool-meta p, .article-meta p{
  margin: 6px 0;
  font-size: 0.95rem;
  line-height: 1.35;
  color: rgba(255,255,255,0.86);
}
.tool-meta a, .article-meta a{
  text-decoration: underline;
  text-underline-offset: 3px;
}

#topic-clusters{
  margin-top: 18px;
}
.cluster-grid{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.cluster-card{
  display: block;
  padding: 14px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.03);
  transition: transform 160ms ease, background 160ms ease;
}
.cluster-card strong{
  display: block;
  font-size: 1rem;
  margin-bottom: 4px;
}
.cluster-card span{
  display: block;
  font-size: 0.92rem;
  color: rgba(255,255,255,0.80);
}
.cluster-card:hover{
  transform: translateY(-2px);
  background: rgba(255,255,255,0.06);
}

.topic-heading{
  grid-column: 1 / -1;
  margin: 18px 0 6px;
  font-size: 1.05rem;
  letter-spacing: 0.2px;
  color: rgba(255,255,255,0.92);
}

@media (max-width: 900px){
  .cluster-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px){
  .cluster-grid{ grid-template-columns: 1fr; }
}
