/* ============================================
   CSS Variables & Design System
   ============================================ */
:root {
    /* Colors - Deepened for Premium Feel */
    --primary-color: #0c7fa3;
    /* Slightly deeper blue */
    --primary-dark: #075985;
    --primary-light: #22d3ee;
    --secondary-color: #0ea5e9;
    --accent-color: #38bdf8;
    --surface-light: #f8fafc;
    --surface-white: #ffffff;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #0c7fa3 0%, #075985 100%);
    --gradient-hero: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    --gradient-glass: linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.6));

    /* Neutrals */
    --dark: #0f172a;
    /* Darker slate */
    --dark-light: #334155;
    --gray: #64748b;
    --gray-light: #94a3b8;

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    --spacing-xxl: 5rem;

    /* Typography */
    --font-family: 'Inter', sans-serif;
    --font-heading: 'Inter', sans-serif;

    /* Shadows - Layered & Colored */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(12, 127, 163, 0.1), 0 2px 4px -1px rgba(12, 127, 163, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(12, 127, 163, 0.1), 0 4px 6px -2px rgba(12, 127, 163, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(12, 127, 163, 0.1), 0 10px 10px -5px rgba(12, 127, 163, 0.04);
    --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.07);

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Overrides */
[data-theme="dark"] {
    --surface-light: #0f172a;
    --surface-white: #1e293b;
    --dark: #f8fafc;
    --dark-light: #e2e8f0;
    --gray: #94a3b8;
    --gray-light: #475569;

    --gradient-hero: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --gradient-glass: linear-gradient(145deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.6));

    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Dark Mode Component Overrides */
[data-theme="dark"] .services-section,
[data-theme="dark"] .testimonials-section,
[data-theme="dark"] .contact-section {
    background: transparent;
}

[data-theme="dark"] .service-card,
[data-theme="dark"] .testimonial-card,
[data-theme="dark"] .contact-card,
[data-theme="dark"] .stat-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.4) 0%, rgba(15, 23, 42, 0.6) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Dim map in dark mode */
[data-theme="dark"] iframe {
    filter: invert(90%) hue-rotate(180deg);
}

[data-theme="dark"] .service-card h4,
[data-theme="dark"] .contact-card h3,
[data-theme="dark"] .contact-item h6,
[data-theme="dark"] .service-card p,
[data-theme="dark"] .stat-card p,
[data-theme="dark"] .stat-card h3,
[data-theme="dark"] .testimonial-text,
[data-theme="dark"] .hero-content p,
[data-theme="dark"] .section-header p {
    color: var(--dark-light);
    /* This is light in dark mode */
}

[data-theme="dark"] .service-card:hover h4,
[data-theme="dark"] .service-card:hover p {
    color: white;
    /* Keep white on hover as background becomes blue */
}

/* Fix Biography Section in Dark Mode */
/* In light mode it uses var(--dark) as bg (dark blue). 
   In dark mode var(--dark) becomes light, so we must force a dark bg */
[data-theme="dark"] .biography-section {
    background: rgba(15, 23, 42, 0.6);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .biography-content {
    background: rgba(30, 41, 59, 0.4);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Bootstrap Utility Overrides for Dark Mode */
[data-theme="dark"] .bg-light,
[data-theme="dark"] .bg-white {
    background-color: transparent !important;
}

[data-theme="dark"] .text-muted {
    color: var(--gray) !important;
}

[data-theme="dark"] .navbar {
    background: rgba(15, 23, 42, 0.85);
    /* Darker navbar */
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Theme Toggle Button Styles */
.theme-toggle {
    background: none;
    border: none;
    color: var(--dark-light);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-fast), transform var(--transition-fast);
    margin-left: 1rem;
}

.theme-toggle:hover {
    color: var(--primary-color);
    transform: scale(1.1);
}

.theme-toggle .bi-sun-fill {
    display: none;
}

[data-theme="dark"] .theme-toggle .bi-moon-fill {
    display: none;
}

[data-theme="dark"] .theme-toggle .bi-sun-fill {
    display: block;
}

/* Smooth transition for theme switching */
body {
    transition: background-color var(--transition-base), color var(--transition-base);
}

.navbar,
.glass-card,
.service-card,
.testimonial-card,
.contact-card,
.footer {
    transition: background-color var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base);
}

/* ============================================
   Global Styles
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    line-height: 1.7;
    color: var(--dark-light);
    background-color: var(--surface-light);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

[data-theme="dark"] body {
    background: radial-gradient(circle at 0% 0%, #1e293b 0%, #0f172a 100%);
    background-attachment: fixed;
}

html {
    scroll-behavior: smooth;
}

/* ============================================
   Typography - Refined
   ============================================ */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.2;
    color: var(--dark);
    letter-spacing: -0.025em;
    margin-bottom: var(--spacing-sm);
}

.display-4 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
}

.display-5 {
    font-size: clamp(2rem, 4vw, 3rem);
    letter-spacing: -0.03em;
}

.lead {
    font-size: 1.125rem;
    font-weight: 400;
    color: var(--gray);
    max-width: 65ch;
}

/* ============================================
   Navigation - Sticky Blur
   ============================================ */
.navbar {
    padding: var(--spacing-md) 0;
    transition: all var(--transition-base);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.navbar.scrolled {
    padding: var(--spacing-sm) 0;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .navbar.scrolled {
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .navbar-brand {
    color: white !important;
}

[data-theme="dark"] .nav-link {
    color: var(--dark-light) !important;
}

[data-theme="dark"] .nav-link:hover,
[data-theme="dark"] .nav-link.active {
    color: white !important;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-color) !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link {
    font-weight: 500;
    color: var(--dark-light) !important;
    font-size: 0.95rem;
    padding: 0.5rem 1rem !important;
    transition: color var(--transition-fast);
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 24px;
    height: 2px;
    background: var(--primary-color);
    transition: transform var(--transition-base);
    transform-origin: center;
}

.nav-link:hover::after,
.nav-link.active::after {
    transform: translateX(-50%) scaleX(1);
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color) !important;
}

/* ============================================
   Buttons - Modern
   ============================================ */
.btn {
    font-weight: 600;
    padding: 0.875rem 1.75rem;
    border-radius: var(--radius-xl);
    transition: all var(--transition-fast);
    border: none;
    letter-spacing: 0.01em;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(12, 127, 163, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(12, 127, 163, 0.3);
    color: white;
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-outline-primary {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(12, 127, 163, 0.15);
}

/* ============================================
   Glassmorphism Card Style
   ============================================ */
.glass-card {
    background: var(--surface-white);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: var(--shadow-glass);
    backdrop-filter: blur(12px);
    border-radius: var(--radius-2xl);
    transition: background-color var(--transition-base), transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
}

.glass-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
    border-color: rgba(12, 127, 163, 0.1);
}

/* ============================================
   Hero Section - Enhanced
   ============================================ */
.hero-section {
    padding: 8rem 0 6rem;
    background: var(--surface-light);
    position: relative;
    overflow: hidden;
}

/* Abstract Background Pattern */
.hero-bg-pattern {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(12, 127, 163, 0.05) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(34, 211, 238, 0.05) 0%, transparent 20%);
    z-index: 0;
}

.hero-section::after {
    content: '';
    position: absolute;
    top: -10%;
    right: -5%;
    width: 60%;
    height: 80%;
    background: radial-gradient(ellipse at center, rgba(12, 127, 163, 0.08) 0%, transparent 70%);
    filter: blur(60px);
    z-index: 0;
}

.hero-content {
    position: relative;
    z-index: 2;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background: rgba(12, 127, 163, 0.1);
    color: var(--primary-color);
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.hero-image-wrapper {
    position: relative;
    z-index: 2;
    padding: 1rem;
}

.hero-image {
    border-radius: var(--radius-2xl);
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    transform: perspective(1000px) rotateY(-5deg);
    transition: transform var(--transition-slow);
}

.hero-image-wrapper:hover .hero-image {
    transform: perspective(1000px) rotateY(0deg);
}

/* ============================================
   Stats Section - Glassmorphism
   ============================================ */
.stats-section {
    padding: var(--spacing-xl) 0;
    position: relative;
    z-index: 10;
    margin-top: -3rem;
}

.stat-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 2rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.5);
    height: 100%;
    transition: transform var(--transition-base);
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ============================================
   Services Section - Interactive
   ============================================ */
.services-section {
    padding: var(--spacing-xxl) 0;
    background: white;
}

.section-header {
    margin-bottom: 4rem;
    text-align: center;
}

.section-tag {
    color: var(--primary-color);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.875rem;
    display: block;
    margin-bottom: 0.5rem;
}

.service-card {
    padding: 2.5rem 2rem;
    border-radius: var(--radius-2xl);
    background: white;
    border: 1px solid var(--surface-light);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
    height: 100%;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    opacity: 0;
    z-index: -1;
    transition: opacity var(--transition-base);
}

.service-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-xl);
    border-color: transparent;
}

.service-card:hover::before {
    opacity: 1;
}

.service-icon {
    width: 70px;
    height: 70px;
    background: rgba(12, 127, 163, 0.1);
    color: var(--primary-color);
    border-radius: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin-bottom: 1.5rem;
    transition: all var(--transition-base);
}

.service-card:hover .service-icon {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.service-card h4 {
    transition: color var(--transition-base);
}

.service-card:hover h4,
.service-card:hover p {
    color: white;
}

.service-card p {
    color: var(--gray);
    margin: 0;
    transition: color var(--transition-base);
}

/* ============================================
    Biography Section - Adaptive
    ============================================ */
.biography-section {
    padding: var(--spacing-xxl) 0;
    background: var(--surface-light);
    color: var(--dark-light);
    position: relative;
}

.biography-content {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(12, 127, 163, 0.1);
    border-radius: var(--radius-2xl);
    padding: 3rem;
    box-shadow: var(--shadow-sm);
}

.bio-section h4 {
    color: var(--accent-color);
}

.list-check li {
    position: relative;
    padding-left: 2rem;
    margin-bottom: 0.75rem;
}

.list-check li::before {
    content: '\F270';
    /* Bootstrap Icons check-circle-fill */
    font-family: 'bootstrap-icons';
    position: absolute;
    left: 0;
    top: 2px;
    color: var(--success-color);
    font-size: 1.1rem;
}

/* ============================================
   Testimonials - Cards
   ============================================ */
.testimonials-section {
    padding: var(--spacing-xxl) 0;
    background: linear-gradient(to bottom, #f8fafc, #f1f5f9);
}

.testimonial-card {
    background: white;
    padding: 2.5rem;
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-md);
    position: relative;
    transition: transform var(--transition-base);
}

.testimonial-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: var(--shadow-xl);
}

.tooth-icon-bg {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    width: 80px;
    height: 80px;
    opacity: 0.05;
    color: var(--primary-color);
    transform: rotate(15deg);
}

.testimonial-text {
    font-size: 1.125rem;
    font-style: italic;
    color: var(--dark-light);
    margin-bottom: 1.5rem;
}

.rating-stars {
    color: #f59e0b;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    letter-spacing: 2px;
}

/* ============================================
   Gallery - Masonry Feel
   ============================================ */
.gallery-section {
    padding: var(--spacing-xxl) 0;
}

.gallery-grid {
    display: grid;
    /* Default: Mobile/Small (2 columns) */
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
        /* 3 on MD */
        gap: 1.5rem;
    }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
    .gallery-grid {
        grid-template-columns: repeat(4, 1fr);
        /* 4 on LG */
    }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .gallery-grid {
        grid-template-columns: repeat(5, 1fr);
        /* 5 on XL */
    }
}

.gallery-item {
    border-radius: var(--radius-xl);
    overflow: hidden;
    position: relative;
    cursor: zoom-in;
    aspect-ratio: 4/3;
    box-shadow: var(--shadow-md);
}

.gallery-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    opacity: 0;
    transition: opacity var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-icon {
    color: white;
    font-size: 2rem;
    transform: scale(0.8);
    transition: transform var(--transition-base);
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.gallery-item:hover .gallery-icon {
    transform: scale(1);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

/* ============================================
   Contact & Map
   ============================================ */
.contact-section {
    padding: var(--spacing-xxl) 0;
    background: white;
}

.contact-card {
    background: var(--surface-light);
    padding: 3rem;
    border-radius: var(--radius-2xl);
    height: 100%;
}

.contact-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 2rem;
}

.contact-icon {
    width: 48px;
    height: 48px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.map-wrapper {
    height: 100%;
    min-height: 400px;
    border-radius: var(--radius-2xl);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

/* ============================================
   Footer
   ============================================ */
.footer {
    background: var(--dark);
    color: var(--gray-light);
    padding: 5rem 0 2rem;
}

.footer-heading {
    color: white;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.footer-links li {
    margin-bottom: 0.75rem;
}

.footer-links a {
    color: var(--gray-light);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.footer-links a:hover {
    color: white;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 991px) {
    .hero-section {
        padding: 6rem 0 4rem;
        text-align: center;
    }

    .hero-content .d-flex {
        justify-content: center;
    }

    .hero-badge {
        display: inline-flex;
        margin-left: auto;
        margin-right: auto;
    }

    .hero-image {
        margin-top: 3rem;
        transform: none;
    }

    .hero-image-wrapper:hover .hero-image {
        transform: none;
    }

    .stats-section {
        margin-top: 0;
    }
}

@media (max-width: 768px) {
    .display-4 {
        font-size: 2.5rem;
    }

    .service-card,
    .testimonial-card {
        padding: 1.5rem;
    }
}

/* ============================================
   Animations
   ============================================ */
.fade-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-up.visible {
    opacity: 1;
    transform: translateY(0);
}

.stagger-1 {
    transition-delay: 100ms;
}

.stagger-2 {
    transition-delay: 200ms;
}

.stagger-3 {
    transition-delay: 300ms;
}

.stagger-4 {
    transition-delay: 400ms;
}

/* ============================================
   Lightbox Styles (Moved from JS)
   ============================================ */
.gallery-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
    visibility: hidden;
}

.gallery-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.lightbox-content {
    position: relative;
    max-width: 1200px;
    width: 100%;
    text-align: center;
}

.lightbox-content img {
    border-radius: 0.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    max-height: 85vh;
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: -50px;
    right: 0;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.lightbox-close:hover {
    background: var(--primary-color);
    transform: rotate(90deg);
}

@media (max-width: 768px) {
    .lightbox-close {
        top: -40px;
        right: 10px;
    }
}