/**
 * Mobile Responsive Enhancements
 * Additional CSS rules to improve mobile experience across all pages
 */

/* Enhanced Base Mobile Optimizations */
* {
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    box-sizing: border-box;
}

/* Touch-friendly interactions */
button, a, input, select, textarea {
    touch-action: manipulation;
}

/* Prevent zoom on input focus */
input, select, textarea {
    font-size: 16px;
}

@media screen and (max-width: 768px) {
    input, select, textarea {
        font-size: 16px !important;
    }
}

/* Enhanced Auto-Adjusting Navigation */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    min-height: 60px;
}

.navbar-brand {
    font-size: clamp(1.2rem, 4vw, 1.8rem);
    font-weight: bold;
    white-space: nowrap;
}

.navbar-toggler {
    border: none;
    padding: 0.5rem;
    font-size: 1.5rem;
    background: transparent;
    color: #00ffff;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.navbar-toggler:hover {
    background: rgba(0, 255, 255, 0.1);
    transform: scale(1.1);
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 2px rgba(0, 255, 255, 0.3);
    outline: none;
}

.navbar-nav {
    width: 100%;
}

.navbar-nav .nav-link {
    padding: 0.75rem 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
}

.navbar-nav .nav-link:hover {
    color: #00ffff !important;
    transform: translateY(-2px);
}

.navbar-nav .nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: #00ffff;
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.navbar-nav .nav-link:hover::after {
    width: 80%;
}

/* Enhanced Mobile & Tablet Navigation */
@media (max-width: 1024px) {
    .navbar-collapse {
        background: rgba(0, 0, 0, 0.98);
        border-radius: 15px;
        margin-top: 15px;
        padding: 1.5rem;
        box-shadow: 0 15px 40px rgba(0, 255, 255, 0.3);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border: 1px solid rgba(0, 255, 255, 0.2);
        animation: slideDown 0.4s ease-out;
    }
    
    .navbar-nav .nav-link {
        text-align: center;
        padding: 1.2rem;
        border-bottom: 1px solid rgba(0, 255, 255, 0.1);
        margin: 0.5rem 0;
        border-radius: 12px;
        font-size: clamp(1rem, 3vw, 1.3rem);
        position: relative;
        overflow: hidden;
    }
    
    .navbar-nav .nav-link:hover {
        background: linear-gradient(45deg, rgba(0, 255, 255, 0.1), rgba(0, 255, 255, 0.2));
        transform: translateX(15px) scale(1.02);
        box-shadow: 0 5px 15px rgba(0, 255, 255, 0.2);
    }
    
    .navbar-nav .nav-link:last-child {
        border-bottom: none;
    }
}

/* Tablet Specific Optimizations */
@media (min-width: 769px) and (max-width: 1024px) {
    .navbar {
        padding: 0.8rem 2rem;
    }
    
    .navbar-brand {
        font-size: 1.6rem;
    }
    
    .navbar-nav .nav-link {
        font-size: 1.1rem;
        padding: 0.8rem 1.2rem;
    }
}

/* Mobile Specific Optimizations */
@media (max-width: 768px) {
    .navbar {
        padding: 0.5rem 1rem;
        min-height: 55px;
    }
    
    .navbar-brand {
        font-size: 1.3rem;
    }
    
    .navbar-toggler {
        padding: 0.4rem;
        font-size: 1.3rem;
    }
    
    .navbar-collapse {
        margin-top: 10px;
        padding: 1rem;
    }
    
    .navbar-nav .nav-link {
        padding: 1rem;
        font-size: 1.1rem;
    }
}

/* Touch Gesture Support */
.navbar-nav .nav-link {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.navbar-toggler {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Enhanced Accessibility */
.navbar-toggler:focus-visible {
    outline: 2px solid #00ffff;
    outline-offset: 2px;
}

.navbar-nav .nav-link:focus-visible {
    outline: 2px solid #00ffff;
    outline-offset: 2px;
    background: rgba(0, 255, 255, 0.1);
}

/* Auto-adjusting Menu Functionality */
@media (max-width: 480px) {
    .navbar {
        padding: 0.3rem 0.8rem;
        min-height: 50px;
    }
    
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .navbar-toggler {
        padding: 0.3rem;
        font-size: 1.2rem;
    }
    
    .navbar-collapse {
        margin-top: 8px;
        padding: 0.8rem;
        border-radius: 10px;
    }
    
    .navbar-nav .nav-link {
        padding: 0.8rem;
        font-size: 1rem;
        margin: 0.3rem 0;
    }
}

@media (max-width: 360px) {
    .navbar {
        padding: 0.2rem 0.5rem;
        min-height: 45px;
    }
    
    .navbar-brand {
        font-size: 1rem;
    }
    
    .navbar-toggler {
        padding: 0.2rem;
        font-size: 1.1rem;
    }
    
    .navbar-nav .nav-link {
        padding: 0.6rem;
        font-size: 0.95rem;
    }
}

/* Animation Keyframes */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Smooth Menu Transitions */
.navbar-collapse.collapsing {
    transition: height 0.35s ease;
}

.navbar-collapse.show {
    animation: fadeInUp 0.3s ease-out;
}

/* Improved Mobile Navigation */
@media (max-width: 768px) {
    /* Ensure proper spacing for fixed header */
    body {
        padding-top: 80px;
    }
    
    /* Better mobile scrolling */
    .scroll-container {
        -webkit-overflow-scrolling: touch;
        overflow-scrolling: touch;
    }
    
    /* Mobile-optimized images */
    img {
        max-width: 100%;
        height: auto;
        display: block;
    }
    
    /* Better mobile tables */
    table {
        width: 100%;
        overflow-x: auto;
        display: block;
        white-space: nowrap;
    }
    
    /* Mobile-friendly videos */
    video, iframe {
        max-width: 100%;
        height: auto;
    }
    
    /* Improved mobile forms */
    .form-group {
        margin-bottom: 1.5rem;
    }
    
    .form-control {
        width: 100%;
        padding: 1rem;
        font-size: 16px;
        border-radius: 8px;
        border: 1px solid rgba(0, 255, 255, 0.3);
        background: rgba(0, 0, 0, 0.8);
        color: #fff;
    }
    
    .form-control:focus {
        outline: none;
        border-color: #00ffff;
        box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
    }
    
    /* Mobile-optimized buttons */
    .btn-mobile {
        width: 100%;
        padding: 1rem;
        font-size: 1rem;
        margin-bottom: 1rem;
        border-radius: 10px;
        min-height: 48px;
    }
    
    /* Better mobile spacing */
    .mobile-spacing {
        margin-bottom: 2rem;
    }
    
    /* Mobile-friendly cards */
    .mobile-card {
        margin-bottom: 1.5rem;
        padding: 1.5rem;
        border-radius: 12px;
        background: rgba(0, 0, 0, 0.8);
        border: 1px solid rgba(0, 255, 255, 0.2);
    }
    
    /* Improved mobile text */
    .mobile-text {
        font-size: 1rem;
        line-height: 1.6;
        margin-bottom: 1rem;
    }
    
    /* Mobile-optimized animations */
    .mobile-animation {
        animation-duration: 0.3s;
        animation-timing-function: ease-out;
    }
}

/* Small Mobile Devices */
@media (max-width: 480px) {
    body {
        padding-top: 70px;
    }
    
    /* Compact mobile layout */
    .mobile-compact {
        padding: 1rem 0.5rem;
    }
    
    /* Smaller mobile buttons */
    .btn-mobile-small {
        padding: 0.8rem;
        font-size: 0.9rem;
        min-height: 44px;
    }
    
    /* Mobile-friendly modals */
    .modal-mobile {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
        overflow-y: auto;
    }
    
    /* Better mobile typography */
    .mobile-title {
        font-size: 1.8rem;
        line-height: 1.2;
        margin-bottom: 1rem;
    }
    
    .mobile-subtitle {
        font-size: 1.4rem;
        line-height: 1.3;
        margin-bottom: 0.8rem;
    }
}

/* Extra Small Mobile Devices */
@media (max-width: 360px) {
    body {
        padding-top: 65px;
    }
    
    /* Ultra-compact layout */
    .mobile-ultra-compact {
        padding: 0.8rem 0.4rem;
    }
    
    /* Minimal mobile buttons */
    .btn-mobile-minimal {
        padding: 0.7rem;
        font-size: 0.85rem;
        min-height: 42px;
    }
    
    /* Compact mobile text */
    .mobile-text-compact {
        font-size: 0.9rem;
        line-height: 1.5;
    }
}

/* Landscape Mobile Orientation */
@media (max-width: 768px) and (orientation: landscape) {
    body {
        padding-top: 60px;
    }
    
    .unified-header {
        padding: 0.4rem 0;
    }
    
    .mobile-landscape {
        padding: 1rem 0;
    }
    
    /* Compact landscape layout */
    .hero {
        padding: 3rem 0 2rem;
    }
    
    .section {
        padding: 2rem 0;
    }
}

/* High DPI Mobile Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Crisp images on retina displays */
    .retina-image {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
    
    /* Better text rendering */
    body {
        -webkit-font-smoothing: subpixel-antialiased;
    }
}

/* Mobile Accessibility Improvements */
@media (max-width: 768px) {
    /* Better focus indicators */
    *:focus {
        outline: 2px solid #00ffff;
        outline-offset: 2px;
    }
    
    /* Improved contrast for mobile */
    .mobile-high-contrast {
        background: #000;
        color: #fff;
        border: 1px solid #00ffff;
    }
    
    /* Touch-friendly interactive elements */
    .touch-target {
        min-height: 44px;
        min-width: 44px;
        padding: 0.5rem;
        margin: 0.25rem;
    }
}

/* Mobile Performance Optimizations */
@media (max-width: 768px) {
    /* Reduce animations on mobile for better performance */
    .mobile-reduced-motion {
        animation-duration: 0.2s;
        transition-duration: 0.2s;
    }
    
    /* Optimize transforms for mobile */
    .mobile-transform {
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
        will-change: transform;
    }
    
    /* Better mobile scrolling */
    .mobile-scroll {
        -webkit-overflow-scrolling: touch;
        overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
}