/* --- Reusable CSS Variables --- */
:root {
    --primary: #2a6f97;
    --primary-light: #468faf;
    --secondary: #014f86;
    --dark-bg: #0b132b;
    --light-bg: #f8f9fa;
    --text-dark: #212529;
    --text-light: #f8f9fa;
    --glass-bg-light: rgba(255, 255, 255, 0.65);
    --glass-border-light: rgba(255, 255, 255, 0.25);
    --glass-bg-dark: rgba(15, 23, 42, 0.6);
    --glass-border-dark: rgba(255, 255, 255, 0.08);
    --input-bg-light: #ffffff;
    --input-bg-dark: #1a2340;

    /* Dynamically controlled defaults */
    --bg-color: var(--light-bg);
    --text-color: var(--text-dark);
    --card-bg: var(--glass-bg-light);
    --card-border: var(--glass-border-light);
    --nav-bg: rgba(255, 255, 255, 0.8);
    --accent: #e63946;
    --gradient: linear-gradient(135deg, var(--primary), var(--secondary));
    --shadow-lift: 0 12px 40px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 8px 30px rgba(42, 111, 151, 0.25);
    --transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

[data-theme="dark"] {
    --bg-color: var(--dark-bg);
    --text-color: var(--text-light);
    --card-bg: var(--glass-bg-dark);
    --card-border: var(--glass-border-dark);
    --nav-bg: rgba(11, 19, 43, 0.8);
}

/* --- Skip Link --- */
.skip-link {
    position: absolute; top: -100px; left: 16px; z-index: 10000;
    background: var(--primary); color: white; padding: 10px 18px; border-radius: 6px;
    font-weight: 600; text-decoration: none; transition: top 0.3s ease;
}
.skip-link:focus { top: 16px; }

/* --- Base & Reset Rules --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-family: 'Poppins', sans-serif;
    overflow-x: hidden;
}

img {
    max-width: 100%;
    height: auto;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: var(--transition);
    overflow-x: hidden;
    line-height: 1.6;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

.section-padding {
    padding: clamp(60px, 8vw, 100px) 0;
}

.section-header {
    text-align: center;
    margin-bottom: 50px;
    position: relative;
}

.section-header::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: var(--gradient);
    margin: 18px auto 0;
    border-radius: 2px;
}

.section-header h2 {
    font-size: clamp(2rem, 3.5vw, 2.8rem);
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--text-color);
    letter-spacing: -0.3px;
}

/* --- Glassmorphism Base --- */
.card-glass {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.05);
    transition: var(--transition);
}

.card-glass:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.1);
}

/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: 12px 28px;
    border-radius: 30px;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: var(--gradient);
    color: white;
    border: 2px solid transparent;
    box-shadow: 0 4px 15px rgba(42,111,151,0.3);
    font-size: 1rem;
    letter-spacing: 0.2px;
}

.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(42,111,151,0.45);
}

.btn-primary:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(42,111,151,0.35);
}

.btn-secondary {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    margin-left: 15px;
    backdrop-filter: blur(6px);
}

.btn-secondary:hover {
    background: var(--gradient);
    color: white;
    border-color: transparent;
    transform: translateY(-3px);
    box-shadow: var(--shadow-glow);
}

.btn-secondary:active {
    transform: translateY(-1px);
}

/* --- Sticky Navbar --- */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--card-border);
    transition: var(--transition);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 5%;
    padding: 12px 5%;
}

.logo {
    font-size: 1.5rem;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo i {
    color: var(--accent);
    font-size: 1.6rem;
    filter: drop-shadow(0 0 8px rgba(230, 57, 70, 0.4));
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 30px;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: var(--transition);
}

.nav-links a:hover {
    color: var(--primary);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

#theme-toggle {
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 1.2rem;
    cursor: pointer;
}

.menu-toggle {
    display: none;
    font-size: 1.4rem;
    cursor: pointer;
}

/* --- Hero Section --- */
.hero-section {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-top: 100px;
    padding-top: 80px;
    overflow: hidden; /* Contains background shapes and morphing image */
}

.hero-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    align-items: center;
}

.hero-content .subtitle {
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 3px;
    font-size: 0.85rem;
    display: inline-block;
    background: rgba(42, 111, 151, 0.08);
    padding: 8px 18px;
    border-radius: 20px;
    margin-bottom: 8px;
}

.hero-content h1 {
    font-size: clamp(2.8rem, 5vw, 4.2rem);
    font-weight: 700;
    line-height: 1.15;
    margin: 12px 0;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-content h3 {
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    font-weight: 500;
    color: var(--secondary);
    margin-bottom: 20px;
    line-height: 1.4;
}

.hero-content p {
    margin-bottom: 32px;
    font-size: 1.1rem;
    opacity: 0.8;
    max-width: 520px;
    line-height: 1.7;
}

.hero-image .image-wrapper {
    position: relative;
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    overflow: hidden;
    animation: morphing 8s ease-in-out infinite alternate;
}

.hero-image img {
    width: 100%;
    height: 550px;
    object-fit: cover;
}

@keyframes morphing {
    0% { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; }
    100% { border-radius: 50% 50% 30% 70% / 50% 60% 40% 50%; }
}

/* Background Shapes */
.hero-bg-shapes .shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    opacity: 0.15;
}

.shape-1 { width: 300px; height: 300px; background: var(--primary); top: 15%; left: 10%; }
.shape-2 { width: 400px; height: 400px; background: var(--primary-light); bottom: 10%; right: 5%; }

/* --- Stats Section --- */
.stats-section {
    padding: 65px 0;
    background: var(--primary);
    color: white;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    text-align: center;
    gap: 30px;
}

.stat-card h2 { font-size: 3rem; font-weight: 700; }

/* --- About Section --- */
.about-bio-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
}

.about-info { order: 1; }
.about-image { order: 2; }

.about-image img {
    width: 100%;
    height: 420px;
    object-fit: cover;
    border-radius: 12px;
    display: block;
}

.about-info h3, .about-values h3 { margin-bottom: 20px; font-size: 1.5rem; }
.about-meta { margin-top: 25px; display: flex; flex-direction: column; gap: 10px; }
.about-values ul { list-style: none; }
.about-values li { margin-bottom: 15px; display: flex; align-items: flex-start; gap: 10px; }
.about-values i { color: var(--primary); margin-top: 5px; }

/* --- Why Choose Me --- */
.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.feature-item {
    text-align: center;
    padding: 30px;
}

.feature-item i {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 20px;
}

.feature-item h4 { font-size: 1.3rem; margin-bottom: 10px; }

/* --- Services Section --- */
.services-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.service-card {
    text-align: center;
}

.service-card .icon-box {
    width: 70px;
    height: 70px;
    background: var(--gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 1.8rem;
    color: white;
    transition: var(--transition);
    box-shadow: 0 4px 20px rgba(42,111,151,0.2);
}

.service-card:hover .icon-box {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 8px 30px rgba(42,111,151,0.4);
}

.service-card h3 { font-size: 1.3rem; margin-bottom: 15px; }

/* --- Timeline Layout --- */
.timeline {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

.timeline::after {
    content: '';
    position: absolute;
    width: 2px;
    background: var(--gradient);
    top: 0; bottom: 0; left: 50%;
    margin-left: -1px;
    border-radius: 1px;
}

.timeline-item {
    padding: 10px 40px;
    position: relative;
    width: 50%;
}

.timeline-item.left::after {
    right: -8px;
    left: auto;
}

.timeline-item.left {
    left: 0;
}

.timeline-item.right {
    left: 50%;
}

.timeline-item.right::after {
    left: -8px;
    right: auto;
}

.timeline-item::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 30px;
    background-color: var(--bg-color);
    border: 3px solid var(--primary);
    border-radius: 50%;
    z-index: 1;
    box-shadow: 0 0 0 4px rgba(42,111,151,0.15);
}

.timeline-content .date {
    color: var(--primary);
    font-weight: 700;
    display: inline-block;
    background: rgba(42,111,151,0.08);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    margin-bottom: 10px;
}

/* --- Testimonials --- */
.testimonials-slider {
    max-width: 700px;
    margin: 0 auto;
    position: relative;
    overflow: hidden; /* Prevents overflow during testimonial transitions */
}

.testimonial-card .stars { color: #fec107; margin-bottom: 15px; }
.testimonial-card p { font-style: italic; font-size: 1.2rem; margin-bottom: 25px; }
.patient-info { display: flex; align-items: center; gap: 15px; }
.patient-info img { width: 50px; height: 50px; border-radius: 50%; object-fit: cover; }
.testimonial-card {
    display: none;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
}
.testimonial-card.active {
    display: block;
    opacity: 1;
    transform: translateX(0);
}

/* --- Gallery --- */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.gallery-item {
    overflow: hidden;
    border-radius: 12px;
    background: #000; /* Dark background to enhance the dimming effect */
    height: 250px;
    transition: var(--transition);
    cursor: pointer;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.gallery-item:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    z-index: 10;
    position: relative;
}

.gallery-item:hover img {
    transform: scale(1.1);
    opacity: 0.8; /* Slight opacity reduction to add depth on hover */
}

/* --- FAQ Accordion --- */
.faq-accordion { max-width: 700px; margin: 0 auto; display: flex; flex-direction: column; gap: 15px; }
.faq-item { border-radius: 10px; background: var(--card-bg); border: 1px solid var(--card-border); overflow: hidden; }
.faq-question { padding: 20px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.faq-question i { transition: var(--transition); }
.faq-answer { max-height: 0; overflow: hidden; transition: max-height 0.3s ease-out; background: rgba(0,0,0,0.02); }
.faq-answer p { padding: 20px; }
.faq-item.active .faq-question i { transform: rotate(180deg); color: var(--primary); }

/* --- Appointment Form --- */
.appointment-wrapper { max-width: 650px; margin: 0 auto; }
.appointment-form { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-group.full-width { grid-column: span 2; }
.form-group input, .form-group textarea {
    width: 100%; padding: 14px 16px; border-radius: 8px; border: 1px solid rgba(0,0,0,0.12);
    background: var(--input-bg-light); color: var(--text-dark); font-family: inherit; font-size: 1rem;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.form-group input:focus, .form-group textarea:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(42,111,151,0.15);
}
.form-group input::placeholder, .form-group textarea::placeholder {
    color: #888;
}
.form-group textarea {
    resize: vertical; min-height: 110px;
}
[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group textarea {
    background: var(--input-bg-dark); color: var(--text-light); border-color: rgba(255,255,255,0.15);
}
[data-theme="dark"] .form-group input::placeholder,
[data-theme="dark"] .form-group textarea::placeholder {
    color: #888;
}
[data-theme="dark"] .form-group input:focus,
[data-theme="dark"] .form-group textarea:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(70,143,175,0.2);
}

/* --- Contact & Map --- */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 50px; }
.contact-details { margin: 30px 0; display: flex; flex-direction: column; gap: 15px; }
.contact-details i { color: var(--primary); margin-right: 10px; }
.social-icons { display: flex; gap: 15px; flex-wrap: wrap; }
.social-icons a {
    width: 40px; height: 40px; border-radius: 50%; background: var(--card-bg); border: 1px solid var(--card-border);
    display: flex; align-items: center; justify-content: center; color: var(--text-color); text-decoration: none; transition: var(--transition);
}
.social-icons a:hover { background: var(--primary); color: white; }
.contact-map { border-radius: 16px; overflow: hidden; border: 1px solid var(--card-border); }

/* --- Footer --- */
.footer { background: #070c1e; color: #a1a7bb; padding: 60px 0 20px; border-top: 1px solid #141d38; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; margin-bottom: 40px; }
.footer h3, .footer h4 { color: white; margin-bottom: 20px; }
.footer-links { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.footer-links a { color: #a1a7bb; text-decoration: none; }
.footer-links a:hover { color: white; }
.footer-bottom { text-align: center; border-top: 1px solid #141d38; padding-top: 20px; font-size: 0.9rem; }

/* --- Scroll To Top --- */
#scroll-top {
    position: fixed; bottom: 30px; right: -60px; width: 45px; height: 45px; border-radius: 50%;
    background: var(--primary); color: white; border: none; cursor: pointer; transition: var(--transition); z-index: 999;
    opacity: 0;
    transform: translateY(6px);
    display: flex; align-items: center; justify-content: center;
}

#scroll-top.show {
    right: 30px;
    opacity: 1;
    transform: translateY(0);
}

/* --- Lightbox --- */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(5, 6, 15, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.lightbox.open {
    opacity: 1;
    visibility: visible;
}
.lightbox img {
    max-width: 92vw;
    max-height: 88vh;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.45);
    transform: scale(0.96);
    transition: transform 0.3s ease;
    object-fit: contain;
}
.lightbox.open img {
    transform: scale(1);
}
.lightbox-close {
    position: absolute;
    top: 22px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-color);
    font-size: 22px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.lightbox-close:hover {
    background: var(--primary);
    color: white;
    border-color: transparent;
}



/* --- Testimonials Slider Dots --- */
.slider-dots {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 18px;
}

.slider-dots .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.15);
    cursor: pointer;
    transition: var(--transition);
}

.slider-dots .dot.active {
    background: var(--primary);
    transform: scale(1.15);
}

/* --- Reveal on Scroll (kept in CSS for performance) --- */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.fade-in {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

/* --- Responsive Layout Rules --- */
@media(max-width: 992px) {
    .hero-container, .about-bio-grid, .contact-grid { grid-template-columns: 1fr; text-align: center; }
    .hero-image, .about-image { order: -1; }
    .hero-image img { height: 400px; }
    .hero-content h1 { font-size: 2.8rem; }
    .about-image { max-width: 500px; margin: 0 auto; }
    .services-grid, .features-grid { grid-template-columns: 1fr 1fr; }
    .gallery-grid { grid-template-columns: 1fr 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .timeline::after { left: 20px; }
    .timeline-item { width: 100%; padding-left: 50px; padding-right: 0; }
    .timeline-item.right { left: 0; }
    .timeline-item::after, .right::after { left: 12px; }
}

@media(max-width: 768px) {
    .nav-links {
        position: fixed; top: 80px; left: -100%; width: 100%; height: calc(100vh - 80px);
        position: fixed; top: 60px; left: -100%; width: 100%; height: calc(100vh - 60px);
        background: var(--bg-color); flex-direction: column; align-items: center; padding: 40px 0; transition: var(--transition);
    }
    .nav-links.active { left: 0; }
    .menu-toggle { display: block; }
    .services-grid, .features-grid, .gallery-grid, .stats-grid, .appointment-form, .footer-grid { grid-template-columns: 1fr; }
    .form-group.full-width { grid-column: auto; }
}