/* 
 * Clean Mobile Navigation - Fresh Start
 */

/* Ensure mobile nav overlay is never visible on desktop */
@media (min-width: 769px) {
    .mobile-nav-overlay {
        display: none !important;
        visibility: hidden !important;
    }
}

/* Mobile Navigation - Simple & Clean */
@media (max-width: 768px) {
    /* Mobile/* Premium background dimming effect */
.mobile-nav-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    z-index: 9980;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.mobile-nav-backdrop.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

body.mobile-nav-open .mobile-nav-backdrop {
    opacity: 1;
    pointer-events: auto;
}

    /* Mobile toggle button - Premium Minimalist */
    .mobile-nav-toggle,
    .hero-header .mobile-nav-toggle,
    .site-header .mobile-nav-toggle {
        display: block !important;
        background: rgba(255, 255, 255, 0.95);
        border: 1px solid rgba(255, 255, 255, 0.2);
        color: #2c3e50;
        font-size: 1.4rem;
        cursor: pointer;
        padding: 8px 10px;
        border-radius: 8px;
        z-index: 1001;
        transition: all 0.3s ease;
        line-height: 1;
        height: auto;
        align-self: center;
        margin: 0;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    
    /* Override Bootstrap d-md-none for testing */
    .mobile-nav-toggle.d-md-none {
        display: block !important;
    }
    
    .mobile-nav-toggle:hover,
    .hero-header .mobile-nav-toggle:hover,
    .site-header .mobile-nav-toggle:hover {
        color: #3498db;
        background: rgba(255, 255, 255, 1);
        transform: scale(1.05);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
    
    .mobile-nav-toggle:focus,
    .hero-header .mobile-nav-toggle:focus,
    .site-header .mobile-nav-toggle:focus {
        outline: none;
        color: #3498db;
        background: rgba(255, 255, 255, 1);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
    
    /* Ensure header wrapper alignment is perfect */
    .header-wrapper,
    .hero-header-wrapper {
        align-items: center !important;
    }
    
    .site-branding,
    .hero-branding {
        display: flex;
        align-items: center;
    }
    
    /* Hide desktop navigation on mobile */
    .hero-navigation,
    .main-navigation {
        display: none;
    }
    
    /* Mobile navigation overlay - Premium Design */
    .mobile-nav-overlay,
    .hero-header .mobile-nav-overlay,
    .site-header .mobile-nav-overlay {
        display: none;
        position: absolute !important;
        top: 100% !important;
        right: 0 !important;
        width: 240px;
        max-width: calc(100vw - 30px);
        max-height: calc(100vh - 70px);
        overflow-y: auto;
        
        /* Premium aesthetics */
        background: rgba(255, 255, 255, 0.92);
        backdrop-filter: blur(8px) saturate(180%);
        -webkit-backdrop-filter: blur(8px) saturate(180%);
        
        /* Premium borders and shadows */
        border: 1px solid rgba(209, 213, 219, 0.3);
        border-radius: 12px;
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 
                    0 4px 6px -2px rgba(0, 0, 0, 0.05);
        
        /* Premium animations */
        transform-origin: top right;
        transform: scale(0.95);
        opacity: 0;
        transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
        z-index: 99999 !important;
        padding: 0.5rem 0;
        margin-top: 5px;
    }
    
    /* Ensure both header types handle the mobile nav consistently */
    .hero-header,
    .site-header {
        position: sticky;
        top: 0;
        left: 0;
        width: 100%;
        z-index: 9990;
        overflow: visible !important;
    }
    
    /* Ensure header containers allow dropdown overflow */
    .hero-header .container,
    .site-header .container {
        position: relative;
        overflow: visible !important;
    }
    
    /* Ensure header wrappers allow dropdown overflow */
    .hero-header-wrapper,
    .header-wrapper {
        position: relative;
        overflow: visible !important;
    }
    
    .mobile-nav-overlay.active {
        display: block;
        transform: scale(1);
        opacity: 1;
        animation: slideDown 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    }
    
    /* Debug: Ensure dropdown is visible */
    .mobile-nav-overlay.active {
        visibility: visible !important;
        display: block !important;
    }
    
    @keyframes slideDown {
        from {
            opacity: 0;
            transform: scale(0.95) translateY(-10px);
        }
        to {
            opacity: 1;
            transform: scale(1) translateY(0);
        }
    }
    
    /* Mobile navigation menu - Premium Style */
    .mobile-nav-menu {
        list-style: none;
        padding: 0;
        margin: 0;
    }
    
    .mobile-nav-menu li {
        margin: 0;
    }
    
    .mobile-nav-menu li:not(:last-child) {
        border-bottom: 1px solid rgba(226, 232, 240, 0.7);
    }
    
    .mobile-nav-menu a {
        display: block;
        color: #1a202c;
        font-size: 0.95rem;
        font-weight: 500;
        letter-spacing: 0.3px;
        padding: 0.85rem 1.25rem;
        text-decoration: none;
        transition: all 0.2s ease;
        position: relative;
        text-align: left;
    }
    
    .mobile-nav-menu a::after {
        content: '';
        position: absolute;
        left: 1.25rem;
        bottom: 0.7rem;
        height: 2px;
        width: 0;
        background: #3498db;
        transition: width 0.2s ease;
    }
    
    .mobile-nav-menu a:hover {
        color: #3498db;
        background: rgba(236, 240, 241, 0.6);
    }
    
    .mobile-nav-menu a:hover::after {
        width: 20px;
    }
    
    .mobile-nav-menu a.active {
        color: #3498db;
        font-weight: 600;
    }
}

/* Keep existing responsive styles for content */
@media (max-width: 991.98px) {
    h1 { font-size: 2.5rem; }
    h2 { font-size: 1.8rem; }
    .section-title { font-size: 1.5rem; }
    .profile-photo { width: 180px; height: 180px; }
    .container { padding-left: 15px; padding-right: 15px; }
    p { font-size: 1rem; line-height: 1.6; }
    
    /* Adjust profile photo container for mobile */
    .profile-photo-container {
        width: 180px;
        height: 180px;
        border: 4px solid white;
    }
    
    .profile-photo {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center;
        border-radius: 50%;
    }
}

@media (max-width: 768px) {
    h1 { font-size: 2rem; margin-bottom: 1.5rem; }
    h2 { font-size: 1.5rem; margin-bottom: 1rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.1rem; }
    .lead { font-size: 1.1rem; }
    .py-4 { padding-top: 2rem !important; padding-bottom: 2rem !important; }
    .mb-5 { margin-bottom: 2rem !important; }
    .mb-4 { margin-bottom: 1.5rem !important; }
    .img-fluid { max-width: 100%; height: auto; margin-bottom: 1rem; }
    a { min-height: 44px; display: inline-block; padding: 0.25rem 0; }
    
    /* Contact page mobile optimizations */
    .mb-4 .mb-1 { margin-bottom: 0.25rem !important; }
    .mb-4 .mb-0 { margin-bottom: 0 !important; }
    
    /* Reduce gap between email addresses in mobile */
    .mb-4 p.mb-1 { margin-bottom: 0.1rem !important; }
    .mb-4 p.mb-0 { margin-bottom: 0 !important; }
    
    /* Reduce gap between connect online components in mobile */
    .d-flex.gap-4 { gap: 0.75rem !important; }
    .d-flex.gap-4 a { margin-bottom: 0.25rem; }
    
    /* Enhanced mobile profile photo styling */
    .profile-photo-container {
        width: 160px;
        height: 160px;
        border: 3px solid white;
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    }
    
    .profile-photo {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center;
        border-radius: 50%;
    }
    
    /* Adjust profile wrapper position for mobile */
    .profile-photo-wrapper {
        top: calc(33vh - 80px);
    }
    
    /* Smaller photo for About page on mobile */
    .col-md-4 img.img-fluid {
        max-width: 60%;
        height: auto;
        display: block;
        margin: 0 auto 1rem auto;
    }
}

@media (max-width: 480px) {
    .header, .footer { padding: 15px; }
    .nav a { padding: 8px 10px; }
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.3rem; }
    .container { padding-left: 10px; padding-right: 10px; }
    .py-4 { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }
    .col-md-4, .col-md-6, .col-md-8 { margin-bottom: 1rem; }
    
    /* Further reduce spacing for contact elements on small screens */
    .mb-4 p.mb-1 { margin-bottom: 0.05rem !important; }
    .d-flex.gap-4 { gap: 0.5rem !important; }
    .d-flex.gap-4 a { 
        margin-bottom: 0.1rem;
        font-size: 0.9rem;
        padding: 0.15rem 0;
    }
    
    /* Adjust mobile nav for small screens */
    .mobile-nav-overlay {
        width: 220px !important;
        right: 5px !important;
    }
    
    .mobile-nav-menu a {
        font-size: 0.9rem;
        padding: 0.75rem 1rem;
    }
    
    .mobile-nav-menu a::after {
        left: 1rem;
    }
    
    /* Further optimize profile photo for very small screens */
    .profile-photo-container {
        width: 140px;
        height: 140px;
        border: 3px solid white;
    }
    
    .profile-photo-wrapper {
        top: calc(33vh - 70px);
    }
    
    /* Make mobile toggle button more compact on small screens */
    .mobile-nav-toggle {
        padding: 6px 8px;
        font-size: 1.2rem;
    }
}

/* Premium background dimming effect */
.mobile-nav-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    z-index: 9980;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

body.mobile-nav-open .mobile-nav-backdrop {
    opacity: 1;
    pointer-events: auto;
}

/* Keep header visible but allow background scrolling */
.site-header,
.hero-header {
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 9990;
    overflow: visible;
}

/* Special handling for hero background section to allow dropdown overflow */
.hero-background-section {
    overflow: visible !important;
}

/* Make header container relative for dropdown positioning */
.site-header .container,
.hero-header .container {
    position: relative;
    overflow: visible;
}

/* Ensure header wrapper allows dropdown overflow */
.header-wrapper,
.hero-header-wrapper {
    overflow: visible;
    position: relative;
}

@keyframes fadeBgIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Homepage-specific mobile navigation */
@media (max-width: 768px) {
    /* Homepage mobile navigation overlay */
    .homepage-mobile-nav {
        position: fixed !important;
        top: 60px !important;
        right: 15px !important;
        width: 240px;
        max-width: calc(100vw - 30px);
        background: rgba(255, 255, 255, 0.92);
        backdrop-filter: blur(8px) saturate(180%);
        -webkit-backdrop-filter: blur(8px) saturate(180%);
        border: 1px solid rgba(209, 213, 219, 0.3);
        border-radius: 12px;
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 
                    0 4px 6px -2px rgba(0, 0, 0, 0.05);
        z-index: 99999 !important;
        transform: translateY(-10px);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        padding: 0.5rem 0;
    }
    
    .homepage-mobile-nav.active {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
    
    /* Homepage backdrop */
    .homepage-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.2);
        z-index: 99990;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }
    
    .homepage-backdrop.active {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }
    
    /* Ensure homepage mobile menu styling matches */
    .homepage-mobile-nav .mobile-nav-menu {
        list-style: none;
        padding: 0;
        margin: 0;
    }
    
    .homepage-mobile-nav .mobile-nav-menu li {
        margin: 0;
    }
    
    .homepage-mobile-nav .mobile-nav-menu li:not(:last-child) {
        border-bottom: 1px solid rgba(226, 232, 240, 0.7);
    }
    
    .homepage-mobile-nav .mobile-nav-menu a {
        display: block;
        color: #1a202c;
        font-size: 0.95rem;
        font-weight: 500;
        letter-spacing: 0.3px;
        padding: 0.85rem 1.25rem;
        text-decoration: none;
        transition: all 0.2s ease;
        position: relative;
        text-align: left;
    }
    
    .homepage-mobile-nav .mobile-nav-menu a::after {
        content: '';
        position: absolute;
        left: 1.25rem;
        bottom: 0.7rem;
        height: 2px;
        width: 0;
        background: #3498db;
        transition: width 0.2s ease;
    }
    
    .homepage-mobile-nav .mobile-nav-menu a:hover {
        color: #3498db;
        background: rgba(236, 240, 241, 0.6);
    }
    
    .homepage-mobile-nav .mobile-nav-menu a:hover::after {
        width: 20px;
    }
    
    .homepage-mobile-nav .mobile-nav-menu a.active {
        color: #3498db;
        font-weight: 600;
    }
}