/* Custom Doctor / Clinic Theme Styles */
body {
    font-family: var(--font-family);
    color: var(--hospital-text);
    background-color: var(--hospital-light);
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--hospital-dark);
    font-weight: 700;
}

.btn-primary {
    background-color: var(--hospital-primary);
    border-color: var(--hospital-primary);
    padding: 10px 24px;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: var(--hospital-secondary);
    border-color: var(--hospital-secondary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(38, 166, 154, 0.3);
}

.btn-outline-primary {
    color: var(--hospital-primary);
    border-color: var(--hospital-primary);
}

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

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

.text-primary {
    color: var(--hospital-primary) !important;
}

.bg-primary {
    background-color: var(--hospital-primary) !important;
}

.bg-secondary {
    background-color: var(--hospital-secondary) !important;
}

/* Navbar Styling */
.top-bar {
    background-color: var(--hospital-primary);
    color: white;
    font-size: 0.9rem;
    padding: 8px 0;
}

.navbar {
    background-color: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    padding: 15px 0;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--hospital-primary) !important;
}

.navbar-brand img {
    max-height: 75px;
}

.nav-link {
    font-weight: 600;
    color: var(--hospital-dark) !important;
    padding: 0.5rem 1rem !important;
    transition: color 0.3s ease;
}

.nav-link:hover, .nav-link.active {
    color: var(--hospital-primary) !important;
}

/* Cards and Elements */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(21, 101, 192, 0.12);
}

.card .card-img-top {
    transition: transform 0.5s ease;
}

.card:hover .card-img-top {
    transform: scale(1.05);
}

.transform-scale {
    transition: transform 0.3s ease;
}

.transform-scale:hover {
    transform: scale(1.03);
}

/* Section Styling */
.section-padding {
    padding: 80px 0;
}

.section-header-medical {
    color: var(--hospital-dark);
}

.tracking-wide {
    letter-spacing: 0.1em;
}

/* Footer Styling */
.site-footer {
    background-color: var(--hospital-dark);
    color: #cbd5e1;
    padding: 60px 0 30px;
}

.site-footer h5 {
    color: white;
    margin-bottom: 20px;
    font-weight: 600;
}

.site-footer a {
    color: #cbd5e1;
    text-decoration: none;
    transition: color 0.3s ease;
}

.site-footer a:hover {
    color: var(--hospital-secondary);
}

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: 40px;
    padding-top: 20px;
    font-size: 0.9rem;
}

#back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--hospital-primary);
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
}

#back-to-top.show {
    opacity: 1;
    visibility: visible;
}

#back-to-top:hover {
    background: var(--hospital-secondary);
    transform: translateY(-3px);
}

#whatsapp-float {
    position: fixed;
    bottom: 30px;
    left: 30px;
    background: #25d366;
    color: white;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.25);
    font-size: 1.8rem;
    z-index: 999;
    transition: all 0.3s ease;
}

#whatsapp-float:hover {
    transform: scale(1.08);
    color: white;
}

/* Compact emergency bar shown below the lg breakpoint */
.top-bar-mobile {
    font-size: 0.85rem;
    padding: 0;
}

.top-bar-mobile a {
    min-height: 44px;
}

.top-bar-mobile .top-bar-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-right: -12px;
}

/* Keep long brand names inside the navbar */
.navbar-brand {
    /* Leaves room for the toggler so it stays on the brand's row.
       Bootstrap sets white-space: nowrap, which pushes long brand names
       straight through the edge of a small screen. */
    max-width: calc(100% - 5.5rem);
    white-space: normal;
}

.navbar-brand .brand-name {
    min-width: 0;
    overflow-wrap: anywhere;
}

/* Readable measure for section intros without starving narrow screens */
.section-lead {
    max-width: 720px;
}

.testimonial-control {
    width: 50px;
}

.site-footer .social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
}

/* ---------- Tablet and below ---------- */
@media (max-width: 991.98px) {
    /* The navbar is sticky: an expanded menu taller than the screen can never be
       scrolled into view, so let the menu itself scroll instead. */
    .navbar-collapse {
        /* Leaves room for the emergency bar + brand row above it, so the last
           menu item stays inside the screen on a short phone. */
        max-height: calc(100vh - 9.5rem);
        max-height: calc(100dvh - 9.5rem);
        overflow-y: auto;
        overscroll-behavior: contain;
        padding-bottom: 0.5rem;
    }

    .navbar-collapse .nav-link {
        padding: 0.75rem 0.25rem !important;
    }

    .navbar-toggler {
        min-width: 44px;
        min-height: 44px;
    }

    .navbar-brand .brand-name {
        font-size: 1.25rem !important;
    }
}

/* ---------- Phones ---------- */
@media (max-width: 767.98px) {
    .section-padding {
        padding: 48px 0;
    }

    .site-footer {
        padding: 48px 0 24px;
    }

    .site-footer ul.list-unstyled a {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
    }

    .footer-bottom {
        margin-top: 24px;
        text-align: center;
    }

    .footer-bottom .text-end {
        text-align: center !important;
    }

    /* Below md the slide has no horizontal padding, so centred controls sit on
       top of the quote. Move them under it and make them proper tap targets. */
    #testimonialCarousel .carousel-item > div {
        padding-bottom: 3.5rem;
    }

    .testimonial-control {
        top: auto;
        bottom: 0;
        width: 44px;
        height: 44px;
    }

    /* Smaller floating buttons so they cover less of the page on a phone */
    #back-to-top {
        bottom: 16px;
        right: 16px;
    }

    #whatsapp-float {
        bottom: 16px;
        left: 16px;
        width: 48px;
        height: 48px;
        font-size: 1.5rem;
    }
}

@media (max-width: 575.98px) {
    .navbar-brand .brand-name {
        font-size: 1.1rem !important;
    }

    .stats-section {
        margin-top: -40px !important;
    }
}

/* ---------- Short viewports (landscape phones) ---------- */
@media (orientation: landscape) and (max-height: 500px) {
    .hero-section .carousel-caption h1 {
        font-size: 1.9rem;
        margin-bottom: 0.75rem !important;
    }

    .hero-section .carousel-caption .lead {
        font-size: 1rem;
        margin-bottom: 1rem !important;
    }

    .hero-section .carousel-caption .btn-lg {
        padding: 0.6rem 1.75rem;
    }
}
