/* UX Optimized Styles - Performance & Accessibility First */

/* === Performance Optimizations === */
/* Reduce paint operations and improve rendering */
* {
  box-sizing: border-box;
}

/* Improve font loading performance */
@font-face {
  font-family: 'Inter';
  font-display: swap;
  src: local('Inter'), local('Inter-Regular');
}

/* === CSS Variables for Consistency === */
:root {
  /* Enhanced color system with better contrast */
  --navy: #062b67;
  --deep-navy: #041d49;
  --blue: #0a57b8;
  --gold: #ffc400;
  --gold-dark: #e0a600;
  --paper: #f5f5f3;
  --ink: #08295d;
  --muted: #425b83;
  --shadow: 0 14px 34px rgba(2, 15, 42, 0.28);
  --bottom-app-nav-height: 0px;
  
  /* UX enhancement variables */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 350ms ease;
  --border-radius-sm: 6px;
  --border-radius-md: 12px;
  --border-radius-lg: 20px;
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
}

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

/* Focus indicators for better keyboard navigation */
*:focus {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

*:focus:not(:focus-visible) {
  outline: none;
}

*:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* === Base Typography & Performance === */
html {
  min-height: 100%;
  scroll-behavior: smooth;
  font-size: 16px; /* Base rem size */
}

body {
  min-height: 100%;
  margin: 0;
  padding-bottom: 0;
  background: #ffffff;
  color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* === Mobile-First Responsive Design === */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

/* === Enhanced Button Styles === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-sm) var(--spacing-md);
  border: none;
  border-radius: var(--border-radius-md);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-base);
  min-height: 44px; /* iOS touch target minimum */
  min-width: 44px;
  position: relative;
  overflow: hidden;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--gold);
  color: var(--navy);
}

.btn-primary:hover {
  background: var(--gold-dark);
}

.btn-secondary {
  background: transparent;
  color: var(--navy);
  border: 2px solid var(--navy);
}

.btn-secondary:hover {
  background: var(--navy);
  color: white;
}

/* === Loading States === */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

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

/* === Image Optimization === */
img {
  max-width: 100%;
  height: auto;
}

/* === Enhanced Cards === */
.card {
  background: white;
  border-radius: var(--border-radius-lg);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  padding: var(--spacing-lg);
  transition: all var(--transition-base);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

/* === Navigation Improvements === */
.nav-link {
  display: flex;
  align-items: center;
  padding: var(--spacing-sm) var(--spacing-md);
  color: var(--navy);
  text-decoration: none;
  border-radius: var(--border-radius-sm);
  transition: all var(--transition-fast);
  min-height: 44px;
}

.nav-link:hover,
.nav-link:focus {
  background: rgba(255, 196, 0, 0.1);
  color: var(--navy);
}

.nav-link.active {
  background: var(--gold);
  color: var(--navy);
  font-weight: 600;
}

/* === Form Improvements === */
.form-group {
  margin-bottom: var(--spacing-lg);
}

.form-label {
  display: block;
  margin-bottom: var(--spacing-xs);
  font-weight: 600;
  color: var(--navy);
}

.form-input {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  border: 2px solid #e0e0e0;
  border-radius: var(--border-radius-sm);
  font-family: inherit;
  font-size: 1rem;
  transition: all var(--transition-fast);
  min-height: 44px;
}

.form-input:focus {
  border-color: var(--gold);
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 196, 0, 0.1);
}

/* === Responsive Grid === */
.grid {
  display: grid;
  gap: var(--spacing-md);
}

.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); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: 1fr;
  }
  
  .container {
    padding: 0 var(--spacing-sm);
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* === Touch Optimizations === */
@media (hover: none) and (pointer: coarse) {
  .btn {
    min-height: 48px;
    padding: var(--spacing-md) var(--spacing-lg);
  }
  
  .nav-link {
    min-height: 48px;
    padding: var(--spacing-md);
  }
}

/* === Print Styles === */
@media print {
  .btn,
  .nav-link,
  .skeleton {
    display: none;
  }
  
  body {
    font-size: 12pt;
    line-height: 1.4;
  }
}

/* === 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;
  }
  
  html {
    scroll-behavior: auto;
  }
}
