/* 
* XRayCost.com - Main Stylesheet
* Mobile-first, responsive design
*/

/* Critical rendering path optimizations - LCP priorities first */
:root {
  --primary-color: #0072b5;
  --secondary-color: #f8f9fa;
  --accent-color: #ff6b6b;
  --text-color: #333;
  --light-text: #666;
  --border-color: #e1e4e8;
  --success-color: #28a745;
  --warning-color: #ffc107;
  --info-color: #17a2b8;
  --max-width: 1200px;
  --box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  --transition: all 0.3s ease;
  --link-color: #004c8c; /* Darker blue for better contrast */
  --link-hover-color: #003366; /* Even darker blue for hover state */
  --link-underline-color: #0072b5; /* Underline color for links */
}

/* Hero section - high priority for LCP */
.hero {
  padding: 3rem 1rem;
  text-align: center;
  background-color: #2a6bb1;
  position: relative;
}

.hero::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background: linear-gradient(120deg, #2a6bb1, #1e4c7b);
  z-index: 0;
  pointer-events: none;
}

.hero-content {
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

.hero h1 {
  font-size: 2rem;
  margin-top: 0;
  margin-bottom: 1rem;
  color: #fff;
  line-height: 1.2;
  font-weight: 700;
}

.hero p {
  font-size: 1.125rem;
  margin-bottom: 1.5rem; 
  color: #fff;
}

/* High-priority image display styles - critical for LCP */
.card-image {
  width: 100%;
  height: auto; /* Changed from fixed height to auto for faster rendering */
  aspect-ratio: 16/9; /* Maintain aspect ratio without forcing height calculation */
  display: block;
  object-fit: cover;
  background-color: #f1f1f1; /* Placeholder color while image loads */
  contain: size layout paint style; /* Enhanced performance optimization */
  content-visibility: auto; /* Optimize paint time */
  background-size: 400% 100%; /* Background for loading state */
  transform: translateZ(0); /* Force GPU acceleration */
}

/* Critical CSS for fastest rendering */
html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: #ffffff;
  margin: 0;
  padding: 0;
  text-rendering: optimizeSpeed; /* Optimize text rendering */
}

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

/* Fast-loading content - minimal styling for LCP elements */
p {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1rem;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
}

/* Card styling optimized for image-heavy content */
.card {
  background: #fff;
  border-radius: 4px;
  box-shadow: var(--box-shadow);
  margin-bottom: 1.5rem;
  overflow: hidden;
  transition: transform 0.2s ease; /* Optimized transition */
  contain: content; /* Performance boost */
  transform: translateZ(0); /* Force GPU acceleration */
}

.card-content {
  padding: 1rem;
}

.card-title {
  font-size: 1.25rem;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

/* Images - critical for LCP */
img {
  max-width: 100%;
  height: auto;
  display: block;
  will-change: transform; /* Optimizes GPU handling */
}

/* Content optimizations - secondary priority items */
h1, h2, h3, h4, h5, h6 {
  margin: 1.5rem 0 1rem;
  line-height: 1.2;
  font-weight: 600;
  color: #222;
}

h1 {
  font-size: 2rem;
  margin-top: 0;
}

h2 {
  font-size: 1.75rem;
}

h3 {
  font-size: 1.5rem;
}

h4 {
  font-size: 1.25rem;
}

/* Accessibility improvements for links */
a {
  color: var(--link-color);
  text-decoration: underline;
  text-decoration-color: var(--link-underline-color);
  text-underline-offset: 0.2em;
  transition: color 0.2s ease;
  padding: 0.25rem;
  display: inline-block;
}

a:hover, a:focus {
  color: var(--link-hover-color);
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

/* Section styling */
.section {
  padding: 2rem 0;
}

.section-title {
  text-align: center;
  margin-bottom: 2rem;
  position: relative;
}

.section-title:after {
  content: '';
  display: block;
  width: 50px;
  height: 3px;
  background: var(--primary-color);
  margin: 0.75rem auto 0;
}

/* Header - secondary priority */
.site-header {
  background-color: #fff;
  box-shadow: var(--box-shadow);
  position: sticky;
  top: 0;
  z-index: 1000;
  contain: layout style; /* Containment for performance */
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
}

.logo img {
  height: 40px;
  will-change: transform;
}

/* Navigation */
.nav-toggle {
  background: transparent;
  border: none;
  cursor: pointer;
  display: block;
  padding: 0.5rem;
}

.nav-toggle .bar {
  display: block;
  width: 25px;
  height: 3px;
  background: var(--primary-color);
  margin: 5px 0;
  transition: transform 0.3s ease;
}

.main-nav {
  display: none;
  width: 100%;
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
}

.main-nav.active {
  display: block;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-list li {
  border-bottom: 1px solid var(--border-color);
}

.nav-list li:last-child {
  border-bottom: none;
}

.nav-list a {
  display: block;
  padding: 0.75rem 1rem;
  color: var(--text-color);
  min-height: 44px;
}

.nav-list a:hover, .nav-list a:focus, .nav-list a.active {
  background: var(--secondary-color);
  color: var(--link-hover-color);
  text-decoration: underline;
}

/* Buttons */
.btn {
  display: inline-block;
  background: var(--primary-color);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s ease;
  min-width: 44px;
  min-height: 44px;
  line-height: 1.2;
  text-align: center;
  transform: translateZ(0); /* Force GPU acceleration */
}

.btn:hover, .btn:focus {
  background: var(--link-hover-color);
  color: #fff;
  text-decoration: none;
  outline: 2px solid #fff;
  outline-offset: 2px;
}

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

.btn-secondary:hover, .btn-secondary:focus {
  background: #e2e6ea;
  color: var(--text-color);
  outline: 2px solid var(--primary-color);
}

/* Primary button LCP optimization */
.btn-primary {
  background-color: #ff6b3d;
  color: white;
  padding: 14px 28px;
  border-radius: 30px;
  font-weight: 600;
  font-size: 1.1rem;
  text-transform: uppercase;
  border: none;
  box-shadow: 0 4px 12px rgba(255, 107, 61, 0.3);
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
  transform: translateZ(0); /* Force GPU acceleration */
  will-change: transform; /* Optimization hint */
}

.btn-primary:hover {
  background-color: #ff5122;
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(255, 107, 61, 0.4);
}

/* Grid system */
.row {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -1rem;
}

.col {
  width: 100%;
  padding: 0 1rem;
  margin-bottom: 1.5rem;
}

/* FAQ Accordions - deferred loading */
.faq-section {
  background: var(--secondary-color);
  content-visibility: auto;
  contain-intrinsic-size: 1px 500px;
}

.accordion {
  margin-bottom: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  overflow: hidden;
}

.accordion-header {
  background: #fff;
  padding: 1rem;
  cursor: pointer;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.accordion-header:after {
  content: '+';
  font-size: 1.25rem;
  transition: transform 0.2s ease;
}

.accordion-header.active:after {
  content: '−';
}

.accordion-body {
  padding: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background: #fff;
}

.accordion-body.active {
  padding: 1rem;
  max-height: 1000px;
}

.accordion-content {
  padding: 0 1rem 1rem;
}

/* Cost table - optimize with containment */
.cost-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  contain: content; /* Optimize rendering */
}

.cost-table th, .cost-table td {
  border: 1px solid var(--border-color);
  padding: 0.75rem;
  text-align: left;
}

.cost-table th {
  background-color: var(--secondary-color);
  font-weight: 600;
}

.cost-table tr:nth-child(even) {
  background-color: #f8f9fa;
}

/* Testimonials - deferred loading */
.testimonial {
  text-align: center;
  padding: 1.5rem;
  background: #fff;
  border-radius: 4px;
  box-shadow: var(--box-shadow);
  margin-bottom: 1.5rem;
  content-visibility: auto;
  contain-intrinsic-size: 1px 200px;
}

.testimonial-text {
  font-style: italic;
  margin-bottom: 1rem;
}

.testimonial-author {
  font-weight: 600;
}

/* Contact form - deferred loading */
.contact-form {
  max-width: 600px;
  margin: 0 auto;
  content-visibility: auto; /* Deferred rendering */
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.form-control {
  display: block;
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 114, 181, 0.2);
}

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

/* Footer - deferred loading */
.site-footer {
  background: #2c3e50;
  color: #ecf0f1;
  padding: 2rem 0;
  content-visibility: auto;
  contain-intrinsic-size: 1px 400px;
}

.footer-container {
  display: flex;
  flex-wrap: wrap;
}

.footer-column {
  width: 100%;
  padding: 0 1rem;
  margin-bottom: 1.5rem;
}

.footer-column h4 {
  color: #fff;
  margin-bottom: 1rem;
  /* Change h4 to h3 in HTML for proper heading hierarchy */
}

.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-links li {
  margin-bottom: 0.5rem;
}

.footer-links a {
  color: #ffffff;
  text-decoration: underline;
  display: inline-block;
  padding: 0.5rem 0;
  min-height: 44px;
  min-width: 44px;
}

.footer-links a:hover {
  color: #fff;
  text-decoration-thickness: 2px;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 1.5rem;
  text-align: center;
}

.social-links {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.social-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  margin: 0 0.5rem;
  color: #fff;
}

.social-links a:hover {
  background: var(--primary-color);
}

/* Medical disclaimer */
.medical-disclaimer {
  background: #f8f9fa;
  padding: 1.25rem;
  border-radius: 4px;
  border-left: 4px solid var(--warning-color);
  margin-bottom: 1.5rem;
}

.last-updated {
  font-style: italic;
  color: var(--light-text);
  margin-bottom: 1.5rem;
}

/* Responsive styles */
@media (min-width: 576px) {
  .container {
    padding: 0 1.5rem;
  }
  
  h1 {
    font-size: 2.25rem;
  }
  
  .hero h1 {
    font-size: 2.75rem;
  }

  .hero {
    background-color: var(--primary-color);
    will-change: transform;
  }
  
  /* Optimize image loading for this breakpoint */
  .card-image {
    max-height: 200px;
  }
}

@media (min-width: 768px) {
  .nav-toggle {
    display: none;
  }
  
  .header-container {
    padding: 0.75rem 1.5rem;
  }
  
  .main-nav {
    display: block;
    position: static;
    width: auto;
    box-shadow: none;
  }
  
  .nav-list {
    display: flex;
  }
  
  .nav-list li {
    border-bottom: none;
    margin-left: 1.5rem;
  }
  
  .nav-list a {
    padding: 0.5rem 0.75rem;
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
  }
  
  .nav-list a:hover, .nav-list a:focus, .nav-list a.active {
    background: transparent;
  }
  
  .col {
    width: 50%;
  }
  
  .footer-column {
    width: 50%;
  }

  .hero {
    background: linear-gradient(to right, rgba(0, 114, 181, 0.9), rgba(0, 90, 140, 0.9));
    will-change: transform;
  }
}

@media (min-width: 992px) {
  .container {
    padding: 0 2rem;
  }
  
  h1 {
    font-size: 2.75rem;
  }
  
  .hero h1 {
    font-size: 3.25rem;
  }
  
  .hero p {
    font-size: 1.25rem;
  }
  
  .col {
    width: 33.333%;
  }
  
  .footer-column {
    width: 25%;
  }

  .hero {
    background: linear-gradient(to right, rgba(0, 114, 181, 0.8), rgba(0, 90, 140, 0.8));
    will-change: transform;
  }
}

@media (min-width: 1200px) {
  .container {
    padding: 0;
  }
}

/* Print styles for better performance */
@media print {
  .hero {
    background: none !important;
    color: #000 !important;
  }
  
  .site-header, .site-footer, .nav-toggle {
    display: none !important;
  }
}

/* Reduced motion preferences - performance optimizations */
@media (prefers-reduced-motion: no-preference) {
  .card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }
  
  .card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  }
}

/* Loading animation for images - improve perceived performance */
@keyframes cardImageLoading {
  0% {
    background-position: 0% 0%;
  }
  100% {
    background-position: 100% 0%;
  }
}

/* Image loading optimization */
.card-image {
  background-size: cover;
  background-position: center;
  transition: opacity 0.2s ease;
}

.card-image.loading {
  animation: cardImageLoading 1.5s infinite;
  background-image: linear-gradient(to right, #f0f0f0 0%, #e0e0e0 50%, #f0f0f0 100%);
}

/* Add font display swap for system fonts */
@font-face {
  font-family: system-ui;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

/* Reduce paint complexity */
* {
  backface-visibility: hidden;
}

/* Enhanced LCP optimization - preload critical paths */
.price-badge {
  background: #27ae60;
  color: white;
  font-weight: bold;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  display: inline-block;
  margin-left: 10px;
  will-change: transform;
  transform: translateZ(0);
}

/* Quick stats optimization for LCP */
.quick-stats {
  display: flex;
  justify-content: space-around;
  text-align: center;
  margin: 30px 0;
  flex-wrap: wrap;
  contain: content;
}

.stat-item {
  padding: 15px;
  flex: 1;
  min-width: 150px;
  will-change: transform;
}

.stat-value {
  font-size: 2.2rem;
  font-weight: 700;
  color: #2a6bb1;
  margin-bottom: 5px;
  will-change: transform;
}