/* Touch action optimization */
html, body {
    touch-action: manipulation;
}

/* Enhanced Mobile Navigation Styles */
.ratio > * {
    height: 90%!important;
    left: 0;
    position: absolute;
    top: 0;
    width: 100%;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem !important;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    color: #495057 !important;
    text-decoration: none;
}

.mobile-nav-link:hover {
    background-color: rgba(13, 110, 253, 0.08);
    color: #0d6efd !important;
    transform: translateX(5px);
}

.mobile-nav-link.active {
    background-color: rgba(13, 110, 253, 0.1);
    color: #0d6efd !important;
    border-left: 4px solid #0d6efd;
}

.mobile-nav-link.active i:first-child {
    color: #0d6efd !important;
}

/* Enhanced gradients and animations */
.bg-gradient-subtle {
    background: linear-gradient(135deg, rgba(13, 110, 253, 0.05) 0%, rgba(108, 117, 125, 0.05) 100%);
}

.btn-close-modern {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: rgba(0,0,0,0.05);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.btn-close-modern:hover {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    transform: rotate(90deg);
}

.logo-container img {
    border: 2px solid rgba(13, 110, 253, 0.1);
    transition: all 0.3s ease;
}

.logo-container:hover img {
    border-color: #0d6efd;
    transform: scale(1.05);
}

/* Mobile Navigation Animation */
.offcanvas-start {
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
}

.offcanvas-start.show {
    transform: translateX(0);
}

/* Mobile Quick Action Buttons */
.btn-outline-primary:hover,
.btn-outline-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Social Media Buttons */
.btn-outline-secondary.rounded-circle {
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.btn-outline-secondary.rounded-circle:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}

/* Enhanced Hamburger Animation with Fixed Z-Index */
.navbar-toggler {
    transition: all 0.3s ease;
    z-index: 10000 !important;
    position: relative !important;
    pointer-events: all !important;
}

.navbar-toggler:hover {
    transform: scale(1.05);
    background-color: rgba(0,0,0,0.05) !important;
    border-radius: 8px;
}

/* Ensure navbar always stays on top */
.navbar-sticky {
    z-index: 9999 !important;
    position: sticky !important;
}

.navbar-sticky .navbar {
    z-index: 9999 !important;
    position: relative !important;
}

/* Fix for any overlaying content */
.min-h-screen {
    z-index: 1 !important;
    position: relative;
}

/* Ensure content doesn't interfere with navbar */
body > * {
    z-index: auto;
}

body > header {
    z-index: 9999 !important;
}

/* Hamburger to X animation - multiple selectors for reliability */
.navbar-toggler[aria-expanded="true"] .hamburger-line:nth-child(1),
.navbar-toggler.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.navbar-toggler[aria-expanded="true"] .hamburger-line:nth-child(2),
.navbar-toggler.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.navbar-toggler[aria-expanded="true"] .hamburger-line:nth-child(3),
.navbar-toggler.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Mobile Menu Enhancement for Small Screens */
@media (max-width: 576px) {
    .offcanvas-start {
        --bs-offcanvas-width: 320px;
    }
    
    .mobile-nav-link {
        padding: 1rem 1.25rem !important;
        font-size: 0.95rem;
    }
    
    .logo-container img {
        width: 2.5rem !important;
        height: 2.5rem !important;
    }
    
    .offcanvas-title {
        font-size: 1.1rem !important;
    }
    
    .btn-sm {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
}

/* Medium screens */
@media (max-width: 768px) and (min-width: 577px) {
    .offcanvas-start {
        --bs-offcanvas-width: 350px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .mobile-nav-link {
        color: #dee2e6 !important;
        border-bottom-color: rgba(255,255,255,0.1);
    }
    
    .mobile-nav-link:hover {
        background-color: rgba(13, 110, 253, 0.15);
    }
    
    .bg-gradient-subtle {
        background: linear-gradient(135deg, rgba(13, 110, 253, 0.1) 0%, rgba(108, 117, 125, 0.1) 100%);
    }
}

/* Animation for Menu Items */
.mobile-nav-link {
    animation: slideInLeft 0.3s ease-out;
}

.mobile-nav-link:nth-child(1) { animation-delay: 0.1s; }
.mobile-nav-link:nth-child(2) { animation-delay: 0.2s; }
.mobile-nav-link:nth-child(3) { animation-delay: 0.3s; }
.mobile-nav-link:nth-child(4) { animation-delay: 0.4s; }

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