/* ==========================================================================
   Responsive Styles - All Media Queries
   ========================================================================== */

/* ==========================================================================
   Desktop & Large Screens (min-width: 992px)
   ========================================================================== */

@media (min-width: 992px) {
    .hero-logo-container {
        display: block;
    }
    
    .hero-logo {
        width: 350px;
        height: auto;
    }
    
    .doctor-hero-image-container {
        display: block;
    }
    
    .doctor-hero-image {
        width: 350px;
        height: auto;
    }
}

/* ==========================================================================
   Large Tablets (max-width: 1199.98px)
   ========================================================================== */

@media (max-width: 1199.98px) {
    .staff-grid .staff-member {
        flex: 0 0 calc((100% - 6rem) / 4); /* 4 items with 3 gaps */
        max-width: calc((100% - 6rem) / 4);
    }
}

/* ==========================================================================
   Tablets (max-width: 991.98px)
   ========================================================================== */

@media (max-width: 991.98px) {
    :root {
        --section-padding: 80px;
    }
    
    /* Navigation Mobile */
    .navbar-collapse {
        background: var(--color-dark-card);
        margin-top: 1rem;
        padding: 1.5rem;
        border-radius: 16px;
        border: 1px solid var(--border-subtle);
    }
    
    .nav-cta {
        flex-direction: column;
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid var(--border-subtle);
    }
    
    .nav-cta .btn {
        width: 100%;
    }
    
    /* Mobile dropdown */
    .navbar .dropdown-menu {
        background: transparent;
        border: none;
        box-shadow: none;
        padding: 0;
        margin: 0;
        min-width: 100%;
    }
    
    .navbar .dropdown-item {
        padding: 0.5rem 1rem 0.5rem 2rem;
        font-size: 0.875rem;
    }
    
    .navbar .dropdown-divider {
        margin: 0.25rem 0;
    }
    
    .navbar-light .dropdown-menu {
        background: transparent;
    }
    
    /* Navbar light mobile menu */
    .navbar-light .navbar-collapse {
        background: var(--color-white);
        border: 1px solid rgba(0,0,0,0.1);
    }
    
    .navbar-light .nav-cta {
        border-top: 1px solid rgba(0,0,0,0.1);
    }
    
    .navbar-light .navbar-toggler-icon {
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%284, 11, 19, 0.8%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
    }
    
    /* Hero */
    .hero-visual {
        margin-top: 3rem;
    }
    
    .floating-card {
        display: none;
    }
    
    .hero-stats {
        flex-wrap: wrap;
        gap: 1.5rem;
    }
    
    .stat-divider {
        display: none;
    }
    
    /* About & Story */
    .about-content,
    .story-content {
        padding-left: 0;
        margin-top: 3rem;
    }
    
    .about-images,
    .story-images {
        margin-bottom: 2rem;
    }
    
    /* Emergency */
    .emergency-content {
        flex-direction: column;
        text-align: center;
    }
    
    .emergency-features {
        justify-content: center;
    }
    
    .emergency-notice-card {
        flex-direction: column;
        text-align: center;
    }
    
    /* Staff Grid */
    .staff-grid {
        gap: 1.5rem;
    }
    .staff-grid .staff-member {
        flex: 0 0 calc((100% - 3rem) / 3); /* 3 items with 2 gaps */
        max-width: calc((100% - 3rem) / 3);
    }
    
    /* Doctor Profile */
    .doctor-profile-content {
        padding-left: 0;
        margin-top: 2rem;
    }
    
    .doctor-highlight {
        flex-direction: column;
        text-align: center;
    }
    
    .doctor-highlight .highlight-icon {
        margin: 0 auto;
    }
    
    /* Rewards */
    .rewards-intro-content {
        flex-direction: column;
        text-align: center;
    }

    .rewards-intro-icon {
        margin: 0 auto;
    }

    .rewards-features {
        justify-content: center;
    }

    .rewards-cta {
        margin-top: 2rem;
    }

    .rewards-intro-card {
        padding: 2rem;
    }
    
    /* End of Life */
    .eol-intro-content {
        flex-direction: column;
        text-align: center;
    }

    .eol-intro-icon {
        margin: 0 auto;
    }

    .eol-intro-card {
        padding: 2rem;
    }

    .eol-partner-card {
        text-align: center;
    }

    .eol-partner-card .text-lg-end {
        margin-top: 1.5rem;
    }
    
    /* Modals */
    .refill-modal-card {
        border-radius: 24px;
    }

    .refill-modal-card .row {
        flex-direction: column;
    }

    .refill-modal-intro {
        border-radius: 24px 24px 0 0;
    }

    .refill-modal-form-wrap {
        border-radius: 0 0 24px 24px;
    }

    .form-modal .modal-body {
        padding: 0 0.5rem 1rem;
    }

    .refill-modal-form-wrap {
        padding: 2rem;
    }
}

/* ==========================================================================
   Mobile / Announcement Banner (max-width: 768px)
   ========================================================================== */

@media (max-width: 768px) {
    .announcement-content {
        flex-direction: column;
        gap: 0.5rem;
    }

    .announcement-icon {
        order: -1;
        margin-bottom: 0.25rem;
    }
}

/* ==========================================================================
   Mobile Devices (max-width: 767.98px)
   ========================================================================== */

@media (max-width: 767.98px) {
    :root {
        --section-padding: 60px;
    }
    
    /* Mobile Bottom Nav */
    .mobile-bottom-nav {
        display: flex;
        justify-content: space-around;
        align-items: center;
    }
    
    /* Add bottom padding to footer to prevent overlap */
    .footer {
        padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px));
    }
    
    body {
        padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
    }
    
    /* Hero */
    .hero {
        padding-top: 120px;
    }
    
    .hero-title {
        font-size: 2.25rem;
    }
    
    .hero-description {
        font-size: 1.0625rem;
    }
    
    .hero-cta {
        flex-direction: column;
    }
    
    .hero-stats {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }
    
    .stat-item {
        text-align: center;
        flex: 1 1 120px;
    }
    
    /* Hide decorative SVG elements that can cause horizontal overflow */
    .hero-swirl,
    .hero-blob,
    .section-accent {
        display: none;
    }
    
    /* About */
    .about-features {
        grid-template-columns: 1fr;
    }
    
    /* CTA */
    .cta-card {
        padding: 2.5rem 1.5rem;
    }
    
    .cta-buttons {
        flex-direction: column;
    }
    
    /* Welcome Card */
    .welcome-card {
        padding: 1.5rem;
        text-align: center;
    }
    
    /* Story */
    .story-stats {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    /* Contact */
    .contact-form-card {
        padding: 2rem;
    }
    
    /* Footer */
    .footer-bottom {
        text-align: center;
    }
    
    .emergency-note {
        justify-content: center;
        margin-top: 1rem;
    }
    
    /* Staff Grid */
    .staff-grid {
        gap: 1rem;
    }
    .staff-grid .staff-member {
        flex: 0 0 calc((100% - 1rem) / 2); /* 2 items with 1 gap */
        max-width: calc((100% - 1rem) / 2);
    }
    
    /* Staff Modal */
    .staff-modal {
        padding: 1rem;
    }
    
    .staff-modal-body {
        flex-direction: column;
        padding: 1.5rem;
        gap: 1.5rem;
    }
    
    .staff-modal-image {
        width: 100%;
        max-width: 200px;
        margin: 0 auto;
    }
    
    .staff-modal-info h3 {
        font-size: 1.5rem;
        text-align: center;
    }
    
    .staff-modal-role {
        text-align: center;
    }
    
    .staff-modal-close {
        top: 1rem;
        right: 1rem;
    }
    
    /* Doctor Profile */
    .doctor-profile-section {
        padding: var(--section-padding-mobile) 0;
    }
    
    .doctor-credentials,
    .doctor-specialties,
    .doctor-memberships {
        padding: 1.25rem;
    }
    
    .doctor-bio p {
        font-size: 1rem;
    }
    
    /* FAQ */
    .faq-section {
        padding: var(--section-padding-mobile) 0;
    }

    .faq-accordion .accordion-button {
        font-size: 1rem;
        padding: 1.25rem 1.5rem;
    }

    .faq-accordion .accordion-button i {
        font-size: 1.125rem;
    }

    .faq-accordion .accordion-body {
        padding: 1.25rem 1.5rem 1.5rem;
        font-size: 0.9375rem;
    }
    
    /* Rewards */
    .rewards-intro-section {
        padding: 0 0 var(--section-padding-mobile);
    }

    .rewards-products-section {
        padding: var(--section-padding-mobile) 0;
    }

    .reward-product-card {
        padding: 1.5rem;
    }
    
    /* End of Life */
    .eol-intro-section {
        padding: 0 0 var(--section-padding-mobile);
    }

    .eol-guides-section,
    .eol-services-section {
        padding: var(--section-padding-mobile) 0;
    }

    .eol-guide-card {
        padding: 2rem;
    }

    .eol-service-item {
        flex-direction: column;
        text-align: center;
        padding: 1.5rem;
    }

    .eol-service-icon {
        margin: 0 auto;
    }
    
    /* Pharmacy Modal */
    .pharmacy-modal .modal-dialog {
        margin: 1rem;
    }

    .pharmacy-modal-image {
        height: 180px;
        min-height: auto;
    }

    .pharmacy-modal-image img {
        position: relative;
        height: 180px;
    }

    .pharmacy-modal-content {
        padding: 1.5rem;
        min-height: auto;
    }

    .pharmacy-modal h3 {
        font-size: 1.5rem;
    }

    .pharmacy-desc {
        font-size: 0.9rem;
        margin-bottom: 1.25rem;
    }

    .pharmacy-option {
        padding: 0.875rem 1rem;
    }

    .pharmacy-option span {
        font-size: 0.9375rem;
    }
    
    /* Hide hamburger menu on mobile - using new mobile menu instead */
    .navbar-toggler {
        display: none !important;
    }
    
    .navbar-collapse {
        display: none !important;
    }
    
    /* Mobile centered logo */
    .navbar .container {
        justify-content: center;
    }
    
    .desktop-brand {
        display: none !important;
    }
    
    .mobile-brand {
        display: flex !important;
        margin: 0 auto;
    }
    
    .mobile-brand img {
        height: 50px;
        width: auto;
        border-radius: 8px;
    }
}

/* ==========================================================================
   Mobile Full Menu Overlay Styles
   ========================================================================== */

.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    background: rgba(4, 11, 19, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu-overlay.active {
    display: block;
    opacity: 1;
}

.mobile-menu-container {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background: #0d1117;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu-overlay.active .mobile-menu-container {
    transform: translateX(0);
}

/* Menu Header */
.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(110, 152, 199, 0.1);
    background: linear-gradient(180deg, rgba(110, 152, 199, 0.05) 0%, transparent 100%);
}

.mobile-menu-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--font-heading);
    font-size: 1.125rem;
    font-weight: 600;
    color: #ffffff;
}

.mobile-menu-logo {
    width: 36px;
    height: 36px;
    border-radius: 10px;
}

.mobile-menu-close {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-menu-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

/* Menu Content */
.mobile-menu-content {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
    -webkit-overflow-scrolling: touch;
}

/* Menu Sections */
.mobile-menu-section {
    padding: 0.75rem 1.5rem;
}

.mobile-menu-section-title {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 0.75rem;
    padding-left: 0.25rem;
}

.mobile-menu-group {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(110, 152, 199, 0.08);
}

/* Menu Items */
.mobile-menu-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
}

.mobile-menu-item:not(:last-child) {
    border-bottom: 1px solid rgba(110, 152, 199, 0.06);
}

.mobile-menu-item:hover,
.mobile-menu-item:focus {
    background: rgba(110, 152, 199, 0.08);
    color: #ffffff;
}

.mobile-menu-item:active {
    background: rgba(110, 152, 199, 0.12);
}

.mobile-menu-item i:first-child {
    width: 24px;
    text-align: center;
    font-size: 1rem;
    color: var(--color-accent);
    opacity: 0.8;
    flex-shrink: 0;
}

.mobile-menu-item span {
    flex: 1;
    font-size: 0.9375rem;
    font-weight: 500;
}

.mobile-menu-chevron {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.25);
    transition: transform 0.2s ease;
}

.mobile-menu-item:hover .mobile-menu-chevron {
    transform: translateX(3px);
    color: rgba(255, 255, 255, 0.4);
}

/* Highlight Item */
.mobile-menu-item.mobile-menu-highlight {
    background: linear-gradient(135deg, rgba(110, 152, 199, 0.15) 0%, rgba(110, 152, 199, 0.05) 100%);
}

.mobile-menu-item.mobile-menu-highlight i:first-child {
    color: var(--color-accent);
    opacity: 1;
}

/* Badge */
.mobile-menu-badge {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-accent);
    flex: none !important;
}

/* Mobile Menu Trigger Button in Bottom Nav */
.mobile-menu-trigger {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.mobile-menu-trigger.active i {
    color: var(--color-accent);
}

/* Expandable Menu Items */
.mobile-menu-expandable {
    position: relative;
}

.mobile-menu-toggle {
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
}

.mobile-menu-toggle .mobile-menu-expand-icon {
    transition: transform 0.3s ease;
}

.mobile-menu-expandable.expanded .mobile-menu-toggle .mobile-menu-expand-icon {
    transform: rotate(180deg);
}

.mobile-menu-expandable.expanded .mobile-menu-toggle {
    background: rgba(110, 152, 199, 0.08);
}

/* Submenu Styles */
.mobile-menu-submenu {
    max-height: 0;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
    transition: max-height 0.35s ease;
}

.mobile-menu-expandable.expanded .mobile-menu-submenu {
    max-height: 600px;
}

.mobile-submenu-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1.25rem 0.875rem 1.45rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
    font-size: 0.875rem;
    flex-wrap: nowrap;
}

.mobile-submenu-item:not(:last-child) {
    border-bottom: 1px solid rgba(110, 152, 199, 0.04);
}

.mobile-submenu-item:hover,
.mobile-submenu-item:focus {
    background: rgba(110, 152, 199, 0.06);
    color: #ffffff;
}

.mobile-submenu-item:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: -4px;
}

.mobile-submenu-item i {
    width: 20px;
    text-align: center;
    font-size: 0.8125rem;
    color: var(--color-accent);
    opacity: 0.6;
    flex-shrink: 0;
}

.mobile-submenu-text {
    flex: 1 1 auto;
    min-width: 0;
    font-weight: 400;
}

.mobile-submenu-subtext {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.55);
}

.mobile-submenu-avatar {
    flex: 0 0 auto;
    border-color: rgba(0, 0, 0, 0.35);
    background: #0f1a26;
    box-shadow: none;
}

.mobile-team-link {
    gap: 1rem;
}

.mobile-team-link-cta {
    align-items: center;
    justify-content: space-between;
}

.mobile-team-link-cta .nav-team-avatars {
    margin-left: auto;
    margin-right: 0.5rem;
}

.mobile-doctor-toggle {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    color: inherit;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.mobile-doctor-toggle .mobile-submenu-chevron {
    transition: transform 0.2s ease, color 0.2s ease;
}

.mobile-doctor-toggle[aria-expanded="true"] .mobile-submenu-chevron {
    transform: rotate(180deg);
}

.mobile-team-copy {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.mobile-submenu-chevron {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.9rem;
    flex: 0 0 auto;
    transition: transform 0.2s ease, color 0.2s ease;
}

.mobile-team-link-cta:hover .mobile-submenu-chevron,
.mobile-team-link-cta:focus .mobile-submenu-chevron {
    color: #ffffff;
    transform: translateX(3px);
}

.mobile-team-link .nav-team-avatars {
    margin-left: auto;
}

.mobile-team-link .nav-dropdown-avatar-sm {
    box-shadow: none;
}

.mobile-submenu-nested {
    padding-left: 1.75rem;
    margin-left: 0.35rem;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.82);
}

.mobile-doctor-list {
    display: block;
    border-top: 1px solid rgba(110, 152, 199, 0.08);
    margin-top: -0.25rem;
}

.mobile-doctor-list.is-collapsed {
    display: none;
}

/* Submenu Badges */
.mobile-submenu-badge {
    font-size: 0.625rem;
    font-weight: 600;
    padding: 0.25rem 0.625rem;
    border-radius: 4px;
    background: var(--color-primary);
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
    width: auto !important;
    flex: 0 0 auto !important;
    display: inline-block;
}

.mobile-submenu-badge-new {
    background: #22c55e;
}

.mobile-submenu-badge-founder {
    background: #6b7280;
}

/* Animation for menu items */
.mobile-menu-overlay.active .mobile-menu-section {
    animation: menuFadeIn 0.4s ease forwards;
    opacity: 0;
}

.mobile-menu-overlay.active .mobile-menu-section:nth-child(1) { animation-delay: 0.1s; }
.mobile-menu-overlay.active .mobile-menu-section:nth-child(2) { animation-delay: 0.15s; }
.mobile-menu-overlay.active .mobile-menu-section:nth-child(3) { animation-delay: 0.2s; }
.mobile-menu-overlay.active .mobile-menu-section:nth-child(4) { animation-delay: 0.25s; }

@keyframes menuFadeIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Prevent body scroll when menu is open */
body.mobile-menu-open {
    overflow: hidden;
}
