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

/* Sticky mobile CTA clamp */
.mobile-cta {
    max-width: calc(100vw - 32px);
}
@supports (width: 100dvw) { .mobile-cta { max-width: calc(100dvw - 32px); } }
@supports (width: 100svw) { .mobile-cta { max-width: calc(100svw - 32px); } }

/* Clamp the chat container as well (fixed element can cause layout viewport overflow on zoom) */
.ai-chat-container {
    max-width: calc(100vw - 32px) !important;
    right: 16px !important;
    left: auto !important;
}
@supports (width: 100dvw) {
  .ai-chat-container { max-width: calc(100dvw - 32px) !important; }
}
@supports (width: 100svw) {
  .ai-chat-container { max-width: calc(100svw - 32px) !important; }
}

/* iOS Safari specific safeguard when zooming */
@supports (-webkit-touch-callout: none) {
  html, body { overflow-x: hidden; position: relative; }
  header, .hero, .services, .doctors, .appointment, footer { overflow-x: clip; }
}

/* Accessible focus styles */
:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}
.btn:focus-visible, .mobile-cta:focus-visible { outline: 3px solid var(--accent-color); outline-offset: 3px; }
.testimonial-dots .dot:focus-visible { outline: 2px solid var(--accent-color); outline-offset: 2px; }
/* Global Styles */
:root {
    --primary-color: #388E3C;
    --secondary-color: #38b2ac;
    --accent-color: #f59e0b;
    --text-color: #333;
    --light-gray: #f5f5f5;
    --dark-gray: #4a5568;
    --white: #ffffff;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-color);
    line-height: 1.6;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-tap-highlight-color: rgba(0,0,0,0); /* nicer tap on mobile */
}

/* Prevent horizontal scrolling/whitespace on mobile */
html, body { width: 100%; max-width: 100%; overflow-x: hidden; }
html { scrollbar-gutter: stable both-edges; overscroll-behavior-x: none; }

/* Clamp top-level sections to viewport width to prevent zoom gutters */
header, .hero, .services, .doctors, .appointment, footer {
    max-width: 100vw;
    overflow-x: clip;
}

/* Prefer dynamic viewport units when supported to align with visual viewport on zoom */
@supports (width: 100dvw) {
  header, .hero, .services, .doctors, .appointment, footer { max-width: 100dvw; }
  .hero > img { width: 100dvw !important; min-width: 100dvw !important; }
}
@supports (width: 100svw) {
  header, .hero, .services, .doctors, .appointment, footer { max-width: 100svw; }
  .hero > img { width: 100svw !important; min-width: 100svw !important; }
}

html { scroll-behavior: smooth; }

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Ensure containers never exceed the visual viewport on zoom (Android/foldables) */
@supports (width: 100dvw) {
  .container { max-width: min(1200px, 100dvw); }
}
@supports (width: 100svw) {
  .container { max-width: min(1200px, 100svw); }
}

img {
    max-width: 100%;
    height: auto;
}

/* Testimonial slider clamps to prevent horizontal overflow on narrow/zoomed viewports */
.testimonial-slider {
    max-width: 100vw;
    overflow-x: hidden;
}
.testimonial-slide { max-width: 100%; }
@supports (width: 100dvw) { .testimonial-slider { max-width: 100dvw; } }
@supports (width: 100svw) { .testimonial-slider { max-width: 100svw; } }

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

ul {
    list-style: none;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 30px;
    font-weight: 600;
    transition: var(--transition);
    cursor: pointer;
}

.btn.primary {
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
}

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

.btn.secondary {
    background-color: var(--secondary-color);
    color: var(--white);
    border: none;
}

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

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

.btn.outline:hover {
    background-color: var(--primary-color);
    color: var(--white);
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-header h2 {
    font-size: 2.5rem;
    color: #388E3C !important;
    margin-bottom: 1rem;
}

.section-header p {
    color: var(--dark-gray);
    font-size: 1.1rem;
}

.section-footer {
    text-align: center;
    margin-top: 2rem;
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.logo-text h1 {
    margin: 0;
}

.logo-text p {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #000;
}

/* Header Styles */
header {
    background-color: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}
/* Make sticky header span exact visual width so it can't create a gutter on zoom */
header.header-preview { left: 0; right: 0; max-width: 100vw; }
@supports (width: 100dvw) { header.header-preview { max-width: 100dvw; } }
@supports (width: 100svw) { header.header-preview { max-width: 100svw; } }

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

.logo h1 {
    font-size: 1.6rem;
    color: var(--primary-color);
    margin-bottom: 0;
}

.logo p {
    font-size: 1rem;
    color: var(--dark-gray);
}

nav ul {
    display: flex;
}

nav ul li {
    margin-left: 1.5rem;
}

nav ul li a {
    color: #000;
    font-weight: 700;
    padding: 0.5rem;
}

nav ul li a:hover,
nav ul li a.active {
    color: #000;
    border-bottom: 2px solid #000;
}

/* Header nav CTA */
nav ul li a.nav-cta,
.nav-cta {
    background: linear-gradient(135deg, var(--accent-color), #ffd04d 40%, var(--accent-color));
    background-image: linear-gradient(135deg, var(--accent-color), #ffd04d 40%, var(--accent-color)) !important;
    color: #1a1a1a !important;
    border: none;
    padding: 12px 18px;
    border-radius: 999px;
    box-shadow: 0 10px 22px rgba(0,0,0,0.18), 0 0 0 3px rgba(255,255,255,0.7) inset;
    transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
    white-space: nowrap;
    font-weight: 800;
    position: relative;
    overflow: hidden;
    animation: nav-glow 4.5s ease-in-out infinite;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
}

nav ul li a.nav-cta::after,
.nav-cta::after {
    content: "";
    position: absolute;
    top: 0; left: -120%;
    width: 60%; height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255,255,255,0.7), transparent);
    transform: skewX(-20deg);
    animation: nav-shine 5.5s ease-in-out infinite;
}

/* Add calendar icon */
nav ul li a.nav-cta::before,
.nav-cta::before {
    content: "📅";
    font-size: 1rem;
}

nav ul li a.nav-cta:hover,
.nav-cta:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 12px 26px rgba(0,0,0,0.24), 0 0 0 3px rgba(255,255,255,0.9) inset;
    filter: brightness(1.03);
}

@keyframes nav-shine {
  0% { left: -120%; }
  18% { left: 160%; }
  100% { left: 160%; }
}

@keyframes nav-glow {
  0%, 100% { box-shadow: 0 10px 22px rgba(0,0,0,0.18), 0 0 0 3px rgba(255,255,255,0.7) inset; }
  50% { box-shadow: 0 10px 22px rgba(0,0,0,0.18), 0 0 0 5px rgba(255,255,255,0.9) inset; }
}

/* Prevent default nav underline/border from affecting CTA */
nav ul li a.nav-cta,
nav ul li a.nav-cta:hover,
nav ul li a.nav-cta.active { border-bottom: none !important; color: #1a1a1a !important; }

@media (max-width: 768px) {
  nav ul li .nav-cta { display: inline-flex; width: auto; margin-top: 8px; }
}

.mobile-menu {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--primary-color);
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.mobile-menu:hover {
    background-color: rgba(56, 142, 60, 0.1);
}

/* Hero Section */
.hero {
    background: linear-gradient(rgba(56, 142, 60, 0.8), rgba(56, 178, 172, 0.8)), url('../images/hero-bg.jpg');
    background-size: cover;
    background-position: center;
    color: var(--white);
    padding: 6rem 0;
    text-align: center;
}

/* Ensure no child causes horizontal overflow in hero */
.hero { overflow-x: clip; }

/* Center absolute hero background image across zoom levels (index.html inline image) */
.hero > img {
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 100vw !important;
    min-width: 100vw !important;
    height: 100% !important;
    object-fit: cover !important;
}

.hero-content h2 {
    font-size: 3rem;
    margin-bottom: 1.5rem;
}

.hero-content p {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* Reusable classes to replace inline hero styles */
.hero--green {
  position: relative;
  color: #ffffff;
  text-align: center;
  padding: 6rem 0;
  overflow: hidden;
  background: linear-gradient(135deg, #388E3C, #2E7D32);
}
.hero__overlay {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: linear-gradient(135deg, #388E3C, #2E7D32);
  z-index: -1;
}
.hero__container { position: relative; z-index: 1; }

.hero-title {
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  margin-bottom: 1rem;
  color: #F4E4BC !important;
  text-shadow: 3px 3px 6px rgba(0,0,0,0.5), 0 0 20px rgba(244,228,188,0.3);
  font-weight: 800;
  letter-spacing: clamp(1px, 2vw, 2px);
  background: linear-gradient(135deg, #F4E4BC 0%, #D4AF37 50%, #B8860B 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  text-align: center; line-height: 1.2;
}
.hero-subtitle {
  font-size: clamp(1rem, 3.5vw, 1.4rem);
  margin-bottom: 2rem;
  color: #ffffff; text-shadow: 2px 2px 4px rgba(0,0,0,0.4);
  font-weight: 400; line-height: 1.6; text-align: center; max-width: 90%; margin-left: auto; margin-right: auto;
}

/* Mobile-first perf: avoid rendering work until scrolled near viewport */
.defer-visibility {
  content-visibility: auto;
  contain-intrinsic-size: 800px; /* reasonable placeholder to prevent jumps */
}

.hero-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2.6rem;
    margin-top: 2rem;
    flex-wrap: wrap;
    padding: 0 1rem;
}

.hero-button {
    text-decoration: none;
    font-weight: 700;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 1rem;
    text-align: center;
}

.hero-button-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 205px;
    height: 68px;
    padding: 0 14px;
    color: #EAC44B;
    font-size: 0.98rem;
    font-weight: 800;
    line-height: 1;
    background: transparent;
    letter-spacing: 0.2px;
    text-shadow: none;
}

.hero-button-oval {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 205px;
    height: 68px;
    border-radius: 34px;
    background: linear-gradient(180deg, #409447 0%, #2E7D32 100%);
    color: transparent; /* text color handled by inner .gold-text */
    border: none;
    box-shadow: 0 12px 26px rgba(0,0,0,0.22), inset 0 1px 0 rgba(255,255,255,0.10);
    line-height: 1.28;
    font-size: 0.96rem;
    font-weight: 800;
    letter-spacing: 0.2px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

/* Premium gold gradient text for button labels */
.gold-text {
  color: #D4AF37 !important;
  -webkit-text-fill-color: #D4AF37 !important;
  background: none !important;
  font-weight: 800;
}

/* Services Section */
.services {
    padding: 5rem 0;
    background-color: var(--light-gray);
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.service-card {
    background-color: var(--white);
    border-radius: 10px;
    padding: 2rem;
    text-align: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
    color: var(--text-color);
    text-decoration: none;
    display: block;
}

.service-card:hover {
    transform: translateY(-10px);
}

.service-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.service-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.service-card p {
    color: var(--dark-gray);
}

/* Doctors Section */
.doctors {
    padding: 5rem 0;
}

.doctor-card .avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 1rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    border: 3px solid #D4AF37; /* gold ring */
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #ffffff; /* white fill inside circle */
}

.doctor-card .avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.doctor-card .avatar .emoji {
    font-size: 2.2rem;
    color: #4a4a4a; /* neutral emoji color inside white circle */
    line-height: 1;
    display: inline-block;
    text-align: center;
}

.doctors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    align-items: stretch;
}

.doctor-card {
    background-color: var(--white);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
    text-align: center; /* ensure headings and paragraphs are centered */
    padding: 1.5rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.doctor-image {
    height: 250px;
    overflow: hidden;
}

.doctor-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.doctor-card h3 {
    padding: 1.5rem 1.5rem 0.5rem;
    font-size: 1.25rem;
}

.doctor-card .specialty {
    padding: 0 1.5rem;
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.doctor-card p {
    padding: 0 1.5rem 1.5rem;
    color: var(--dark-gray);
}

/* Service detail specific styling */
.services-details .service-image {
    height: 400px;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 2rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
}

.services-details .service-image:hover {
    transform: scale(1.02);
}

.services-details .service-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.service-detail {
    padding: 2rem;
    margin-bottom: 2rem;
    background-color: #f8f8f8;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Testimonials Section */
.testimonials {
    background-color: var(--light-gray);
    padding: 5rem 0;
}

.testimonial-slider {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    margin: 0 -15px;
}

.testimonial-slide {
    flex: 0 0 100%;
    scroll-snap-align: start;
    padding: 0 15px;
}

.testimonial-content {
    background-color: var(--white);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
    position: relative;
}

.testimonial-content::before {
    content: '"';
    position: absolute;
    top: 10px;
    left: 20px;
    font-size: 5rem;
    color: rgba(56, 142, 60, 0.1);
    line-height: 0;
}

.testimonial-content p {
    font-style: italic;
    margin-bottom: 1.5rem;
}

.testimonial-author {
    text-align: right;
    font-weight: 600;
}

/* Testimonial Dots */
.testimonial-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
}
.testimonial-dots .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(0,0,0,0.25);
    border: none;
    cursor: pointer;
}
.testimonial-dots .dot.active {
    background: var(--primary-color);
}
.testimonial-dots .dot:focus-visible { outline: 2px solid var(--primary-color); outline-offset: 2px; }

/* Appointment Section */
.appointment {
    padding: 5rem 0;
    background: linear-gradient(135deg, #388E3C, #2E7D32);
    color: var(--white);
}

/* Anchor offset so heading is visible after jump */
#appointment { scroll-margin-top: 90px; }

.appointment-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.appointment-text h2 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: #ffffff;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.7);
}

.appointment-text p {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    color: #ffffff;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

/* Elegant attention highlight for the appointment form */
.appointment .appointment-form {
    position: relative;
    padding: 16px;
    border-radius: 16px;
    background: #ffffff;
    border: 2px solid rgba(255, 255, 255, 1);
    box-shadow:
        /* tight halo */
        0 0 0 3px rgba(56, 142, 60, 0.55),
        /* elevation */
        0 18px 36px rgba(0, 0, 0, 0.22);
    z-index: 0;
    isolation: isolate; /* keep ::after above section background */
}

.appointment .appointment-form::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 16px;
    pointer-events: none;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.9) inset;
}

/* Dedicated glow ring behind the form for clear visibility */
.appointment .appointment-form::after {
    content: "";
    position: absolute;
    inset: -10px;
    border-radius: 22px;
    background: radial-gradient(closest-side, rgba(56,142,60,0.55), rgba(56,178,172,0.0) 75%);
    filter: blur(8px);
    opacity: 0.85;
    z-index: -1;
}

/* Hero logo circular styling */
.hero-logo-container {
    width: clamp(200px, 25vw, 300px);
    height: clamp(200px, 25vw, 300px);
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 2rem;
    background: #ffffff;
    transition: all 0.3s ease;
    border: 3px solid #1B5E20; /* darker green border to match header badge */
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.hero-logo {
    width: 100%;
    height: 100%;
    object-fit: cover; /* fill circle cleanly */
    padding: 0;
}

/* Subtle emphasis on hover for clarity */
.appointment .appointment-form:hover {
    box-shadow:
        0 0 0 3px rgba(56, 142, 60, 0.55),
        0 0 0 14px rgba(56, 178, 172, 0.22),
        0 22px 44px rgba(0, 0, 0, 0.24);
}

/* Input focus refinement for a premium feel */

/* Black divider/border lines for appointment fields */
.appointment-form input,
.appointment-form select,
.appointment-form textarea {
    border: 1px solid #000; /* solid black */
    background: #ffffff;
    color: #111;
}

.appointment-form input:focus,
.appointment-form select:focus,
.appointment-form textarea:focus {
    outline: none;
    border-color: #000; /* keep black on focus */
    box-shadow: none;   /* remove blue focus glow */
}

/* Ensure selects and date inputs render cleanly */
.appointment-form select {
    appearance: auto;
}
.appointment-form input[type="date"] {
    color: #111;
}

.appointment-form .form-group {
    margin-bottom: 1rem;
}

.appointment-form input,
.appointment-form select,
.appointment-form textarea {
    width: 100%;
    padding: 12px;
    border-radius: 5px;
    border: 1px solid #000; /* ensure black border not overridden */
    font-size: 1rem;
}

.appointment-form button {
    width: 100%;
    margin-top: 1rem;
    background-color: var(--primary-color);
    color: white;
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.appointment-form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.25);
}

/* Footer */
footer {
    background-color: var(--dark-gray);
    color: var(--white);
    padding: 4rem 0 1rem;
}

/* Sticky Mobile CTA */
.mobile-cta {
    position: fixed;
    right: 16px;
    left: auto;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    z-index: 2147483600; /* below chatbot safeguard */
    background: linear-gradient(135deg, var(--primary-color), #388E3C 45%, var(--secondary-color));
    color: #fff;
    padding: 16px 22px;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 900;
    letter-spacing: .2px;
    box-shadow: 0 12px 28px rgba(0,0,0,0.3);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transform: translateZ(0);
    animation: pulse-cta 2.4s ease-in-out infinite, wiggle-cta 1.1s ease-in-out 6s infinite;
}

@supports selector(:has(*)) {
  body:has(.ai-chat-button) .mobile-cta,
  body:has(.ai-chat-container) .mobile-cta {
    right: 128px; /* increased horizontal gap for wider chat pill */
  }
  /* On very narrow screens, stack vertically instead of side-by-side */
  @media (max-width: 390px) {
    body:has(.ai-chat-button) .mobile-cta,
    body:has(.ai-chat-container) .mobile-cta {
      right: 16px; /* reset */
      bottom: calc(112px + env(safe-area-inset-bottom, 0px)); /* push higher above chat */
    }
  }
  /* On small screens, prefer bottom-left placement to avoid any overlap */
  @media (max-width: 520px) {
    body:has(.ai-chat-button) .mobile-cta,
    body:has(.ai-chat-container) .mobile-cta {
      left: 16px; /* move CTA to left side */
      right: auto;
      bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    }
  }
}

/* Fallback for browsers without :has support: move CTA to bottom-left on small screens */
@media (max-width: 520px) {
  .mobile-cta { padding: 16px 24px; font-size: 1.05rem; }
}

.mobile-cta i { font-size: 1.1rem; }

/* Strong override: if chat exists, always place CTA at bottom-left to avoid any collision */
@supports selector(:has(*)) {
  body:has(.ai-chat-button) .mobile-cta,
  body:has(.ai-chat-container) .mobile-cta {
    left: 16px !important;
    right: auto !important;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

@keyframes pulse-cta {
  0% { box-shadow: 0 10px 26px rgba(0,0,0,0.28), 0 0 0 0 rgba(56,142,60,0.35); }
  70% { box-shadow: 0 10px 26px rgba(0,0,0,0.28), 0 0 0 12px rgba(56,142,60,0); }
  100% { box-shadow: 0 10px 26px rgba(0,0,0,0.28), 0 0 0 0 rgba(56,142,60,0); }
}

@keyframes wiggle-cta {
  0% { transform: translateX(0) translateY(0) rotate(0deg) scale(1); }
  10% { transform: translateX(-2px) translateY(-1px) rotate(-1deg) scale(1.02); }
  20% { transform: translateX(2px) translateY(1px) rotate(1deg) scale(1.05); }
  30% { transform: translateX(-1px) translateY(-2px) rotate(-0.5deg) scale(1.02); }
  40% { transform: translateX(1px) translateY(2px) rotate(0.5deg) scale(1.03); }
  50% { transform: translateX(0) translateY(0) rotate(0deg) scale(1); }
  60% { transform: translateX(-1px) translateY(1px) rotate(-0.3deg) scale(1.01); }
  70% { transform: translateX(1px) translateY(-1px) rotate(0.3deg) scale(1.02); }
  80% { transform: translateX(0) translateY(1px) rotate(0deg) scale(1.01); }
  90% { transform: translateX(0) translateY(-1px) rotate(0deg) scale(1); }
  100% { transform: translateX(0) translateY(0) rotate(0deg) scale(1); }
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 5px rgba(56,142,60,0.3), 0 0 10px rgba(56,142,60,0.2);
  }
  50% {
    box-shadow: 0 0 10px rgba(56,142,60,0.5), 0 0 20px rgba(56,142,60,0.3), 0 0 30px rgba(56,142,60,0.1);
  }
}

.btn-cta {
  background: linear-gradient(135deg, #388E3C, #2E7D32) !important;
  color: white !important;
  padding: clamp(0.75rem, 2vw, 1rem) clamp(1.5rem, 4vw, 2rem) !important;
  border-radius: 50px !important;
  text-decoration: none !important;
  font-weight: 700 !important;
  font-size: clamp(0.9rem, 2.5vw, 1.1rem) !important;
  transition: all 0.3s ease !important;
  border: none !important;
  text-transform: uppercase !important;
  letter-spacing: 1px !important;
  position: relative !important;
  overflow: hidden !important;
  animation: pulse-glow 2s infinite, wiggle-cta 3s infinite !important;
  box-shadow: 0 8px 25px rgba(56,142,60,0.4) !important;
  min-width: 140px !important;
  text-align: center !important;
}

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

.btn-cta:hover::before {
  left: 100%;
}

.cta {
  background: linear-gradient(135deg, #388E3C, #2E7D32) !important;
  color: white !important;
  padding: clamp(0.75rem, 2vw, 1rem) clamp(1.5rem, 4vw, 2rem) !important;
  border-radius: 50px !important;
  text-decoration: none !important;
  font-weight: 700 !important;
  font-size: clamp(0.9rem, 2.5vw, 1.1rem) !important;
  transition: all 0.3s ease !important;
  border: none !important;
  text-transform: uppercase !important;
  letter-spacing: 1px !important;
  position: relative !important;
  overflow: hidden !important;
  animation: pulse-glow 2s infinite, wiggle-cta 3s infinite !important;
  box-shadow: 0 8px 25px rgba(56,142,60,0.4) !important;
  min-width: 140px !important;
  text-align: center !important;
}

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

.cta:hover::before {
  left: 100%;
}

@media (min-width: 769px) {
  .mobile-cta { padding: 16px 24px; font-size: 1.05rem; }
}

/* Reduced motion accessibility */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .testimonial-slider { scroll-behavior: auto; }
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.footer-column h3 {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
    display: inline-block;
}

.footer-column p {
    margin-bottom: 0.8rem;
}

.social-icons {
    display: flex;
    gap: 1rem;
}

.social-icons a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--white);
}

.social-icons a:hover {
    background-color: var(--primary-color);
    transform: translateY(-3px);
}

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

/* Split Hero Styles REMOVED */
.hero-split {
    display: flex;
    min-height: 600px;
    width: 100%;
    position: relative;
}

.hero-left {
    flex: 1 1 50%;
    background: url('../images/facilities/centro_medico_exterior.jpg') center/cover no-repeat;
}

.hero-right {
    flex: 1 1 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--white);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 3rem;
    text-align: center;
}

.hero-right h2 {
    font-size: 3rem;
    margin-bottom: 1.5rem;
}

.hero-right p {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    max-width: 500px;
}

.hero-split .hero-buttons {
    display: flex;
    gap: 1rem;
}

.chevron-down {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.5rem;
    animation: bounce 2s infinite;
    color: var(--white);
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {transform: translate(-50%, 0);} 
    40% {transform: translate(-50%, -10px);} 
    60% {transform: translate(-50%, -5px);} 
}

@media (max-width: 992px) {
    .hero-split {min-height: 500px;}
    .hero-right h2 {font-size: 2.5rem;}
}

@media (max-width: 768px) {
    .hero-split {flex-direction: column;}
    .hero-left, .hero-right {flex: 1 1 100%;}
    .hero-left {height: 300px;}
    .hero-right {padding: 2rem;}
    .hero-split .hero-buttons {flex-direction: column;}

    /* Appointment section: single column and comfortable spacing */
    .appointment {padding: 3.5rem 0;}
    .appointment-content {grid-template-columns: 1fr; gap: 1.25rem;}
    .appointment-text h2 {font-size: 2rem;}
    .appointment-text p {font-size: 1rem;}
    .container {width: 94%;}
}

/* Responsive Styles */
@media (max-width: 992px) {
    .hero-content h2 {
        font-size: 2.5rem;
    }
}

.doctor-card-detailed {
    background-color: var(--white);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
    text-align: center;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    height: 500px;
}

.doctor-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.doctor-actions {
    margin-top: auto;
    padding-top: 1rem;
}

.department-doctors {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    align-items: stretch;
}

.department-doctors .doctor-card-detailed {
    height: 500px;
}

.doctor-image {
    width: 80px !important;
    height: 80px !important;
    min-width: 80px !important;
    min-height: 80px !important;
    max-width: 80px !important;
    max-height: 80px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 auto 1rem !important;
    background: white !important;
    border: 3px solid #D4AF37 !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1) !important;
    font-size: 2rem !important;
    line-height: 1 !important;
    overflow: hidden !important;
    position: relative !important;
    flex-shrink: 0 !important;
    aspect-ratio: 1/1 !important;
}

.doctor-image > * {
    line-height: 1; /* normalize any nested element like span */
}

.doctor-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.doctor-image picture {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Ensure no extra overlay icons inside doctor avatars on doctor cards */
.doctor-card-detailed .doctor-image .specialty-icon { 
    display: none !important; 
}

.doctor-image i {
    display: none;
}

/* Mobile-optimized cards and content */
@media (max-width: 768px) {
    .doctor-card, .service-card {
        padding: 24px 20px;
        margin-bottom: 16px;
        border-radius: 12px;
        left: 0;
        right: 0;
        background: white;
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    nav ul {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        flex-direction: column;
        padding: 1rem;
    }
    
    .mobile-menu {
        display: block;
    }
    
    /* Show nav when toggled via JS on mobile */
    nav ul.show {
        display: flex;
    }
    
    nav ul li {
        margin-left: 0;
        margin-bottom: 0.5rem;
    }
    
    .hero-content h2 {
        font-size: 2rem;
    }
    
    /* Ensure hero content stays centered and within visual viewport when zoomed */
    .hero .container { max-width: 100vw; overflow-x: clip; }
    .hero-content { margin: 0 auto; max-width: 680px; padding: 0 16px; }
    
    .hero-buttons {
        flex-direction: column;
        gap: 1rem;
    }
    
    .section-header h2 {
        font-size: 2rem;
    }
    
    .appointment {
        background-attachment: scroll;
    }
    
    .appointment-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .hero-logo-container {
        width: 150px;
        height: 150px;
    }
    
    .logo-badge {
        width: 50px;
        height: 50px;
    }
}

@media (max-width: 576px) {
    /* Remove negative margins that can induce horizontal overflow on small screens */
    .testimonial-slider { margin: 0; }
    .logo h1 {
        font-size: 1.3rem;
    }
    
    .logo p {
        font-size: 0.9rem;
    }
    
    .hero {
        padding: 4rem 0;
    }
    /* Clamp header layout pieces to viewport width on small phones */
    .header-preview, .header-wrap, nav, .actions { max-width: 100vw; overflow-x: clip; }
    
    .hero-content h2 {
        font-size: 1.8rem;
    }
    
    .hero-content p {
        font-size: 1rem;
    }

    /* Ensure appointment form is fully readable on phones */
    .appointment .appointment-form {margin: 0 8px; border-radius: 14px; padding: 14px;}
    .appointment .appointment-form::after {inset: -6px; border-radius: 20px; filter: blur(6px); opacity: 0.7;}
    .appointment-form input,
    .appointment-form select,
    .appointment-form textarea {font-size: 16px; /* prevent iOS zoom */ min-height: 48px;}
    .appointment-form button {min-height: 52px; font-size: 16px;}
    .btn {padding: 12px 18px;}
}

/* Mobile zoom overflow guards (apply across sizes but mainly affect phones) */
/* Clamp floating UI so it never widens the visual viewport while zoomed */
.ai-chat-button {
    max-width: calc(100vw - 32px) !important; /* 16px margins on both sides */
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    right: 16px !important;
    left: auto !important;
}

/* Construction banner clamps */
.cmu-construction-banner,
.cmu-construction-inner {
    max-width: 100vw !important;
    overflow-x: clip !important;
}
