/* ========================================
   ENHANCED MOBILE OPTIMIZATIONS
   Additional improvements for mobile experience
   ======================================== */

/* Hero Section Mobile Enhancements */
@media (max-width: 768px) {
    .hero-section {
        min-height: 100vh;
        min-height: 100dvh; /* Dynamic viewport height */
        padding-top: 60px;
    }

    .hero-content {
        padding: 20px;
        text-align: center;
    }

    .hero-logo {
        font-size: 2.5rem !important;
        margin-bottom: 1rem;
    }

    .hero-tagline {
        font-size: 0.95rem !important;
        margin-bottom: 0.75rem;
    }

    .hero-description {
        font-size: 0.85rem !important;
        line-height: 1.6;
        max-width: 90%;
        margin: 0 auto 2rem;
    }

    /* Hero Bubbles Mobile Enhancement */
    .hero-floating-bubble {
        width: 100px !important;
        height: 100px !important;
    }

    .bubble-text {
        font-size: 0.7rem !important;
        padding: 6px 10px !important;
        letter-spacing: 1px;
    }

    /* Improve bubble spacing on small screens */
    @media (max-width: 480px) {
        .hero-floating-bubble {
            width: 85px !important;
            height: 85px !important;
        }

        .bubble-text {
            font-size: 0.65rem !important;
            padding: 5px 8px !important;
        }
    }
}

/* Navigation Mobile Enhancements */
@media (max-width: 768px) {
    .minimal-nav {
        padding: 10px 15px !important;
        background: rgba(26, 42, 58, 0.98) !important;
        backdrop-filter: blur(20px);
    }

    .nav-logo {
        font-size: 1.2rem !important;
    }

    .nav-links {
        display: none !important; /* Hide top nav on mobile, use bottom nav */
    }

    .lang-btn {
        padding: 6px 12px !important;
        font-size: 0.8rem !important;
    }
}

/* Hubs Grid Mobile Enhancement */
@media (max-width: 768px) {
    .hubs-grid,
    .services-grid {
        grid-template-columns: 1fr !important;
        gap: 15px;
        padding: 0 15px;
    }

    .hub-3d-card,
    .hub-card {
        min-height: 200px;
        margin-bottom: 10px;
    }

    .hub-card-title,
    .hub-3d-card h3 {
        font-size: 1.3rem !important;
    }

    .hub-card-description,
    .hub-3d-card p {
        font-size: 0.9rem !important;
        line-height: 1.5;
    }

    /* Hub card images */
    .hub-card-image,
    .hub-3d-card img {
        height: 140px !important;
        object-fit: cover;
    }
}

/* Products/Programs Grid Mobile */
@media (max-width: 768px) {
    .products-grid,
    .programs-grid {
        grid-template-columns: 1fr !important;
        gap: 15px;
        padding: 0 15px;
    }

    .product-card,
    .program-card {
        min-height: 180px;
    }

    .product-card-link,
    .program-card-link {
        display: block;
        height: 100%;
    }
}

/* Section Titles Mobile */
@media (max-width: 768px) {
    .section-title {
        font-size: 1.8rem !important;
        margin-bottom: 1rem;
    }

    .section-subtitle {
        font-size: 0.95rem !important;
        margin-bottom: 1.5rem;
        padding: 0 20px;
    }

    .section-content {
        padding: 40px 15px !important;
    }
}

/* Forms Mobile Enhancement */
@media (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    select,
    textarea {
        font-size: 16px !important; /* Prevents zoom on iOS */
        min-height: 48px;
        padding: 12px 15px;
        border-radius: 8px;
    }

    textarea {
        min-height: 120px;
    }

    button[type="submit"],
    .btn-primary,
    .btn-secondary {
        min-height: 48px;
        padding: 12px 24px;
        font-size: 1rem;
        width: 100%;
        border-radius: 8px;
    }
}

/* Cards Hover Effects - Disable on Mobile */
@media (max-width: 768px) {
    .hub-3d-card:hover,
    .product-card:hover,
    .program-card:hover {
        transform: none !important;
    }

    /* Add tap feedback instead */
    .hub-3d-card:active,
    .product-card:active,
    .program-card:active {
        transform: scale(0.98);
        opacity: 0.9;
    }
}

/* Loading States */
@media (max-width: 768px) {
    .page-loader {
        background: #1a2a3a;
    }

    .loader-text {
        font-size: 1.5rem !important;
    }
}

/* Scroll Indicator Mobile */
@media (max-width: 768px) {
    .scroll-indicator {
        bottom: 100px !important; /* Above bottom nav */
        font-size: 0.85rem;
    }

    .scroll-indicator i {
        font-size: 1.2rem;
    }
}

/* Mobile Menu Drawer Enhancement */
@media (max-width: 768px) {
    .mobile-menu-drawer {
        background: rgba(26, 42, 58, 0.98);
        backdrop-filter: blur(20px);
    }

    .mobile-menu-item {
        min-height: 54px;
        padding: 15px 20px;
        font-size: 1rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .mobile-menu-item:active {
        background: rgba(212, 175, 55, 0.1);
    }
}

/* Bottom Navigation Enhancement */
@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: flex !important;
    }

    .mobile-nav-item {
        flex: 1;
        max-width: 80px;
    }

    .mobile-nav-item i {
        font-size: 1.4rem;
    }

    .mobile-nav-item span {
        font-size: 0.7rem;
        font-weight: 500;
    }

    .mobile-nav-item.active {
        color: #d4af37;
    }

    .mobile-nav-item .badge {
        position: absolute;
        top: 5px;
        right: 10px;
        background: #ef4444;
        color: white;
        font-size: 0.65rem;
        padding: 2px 6px;
        border-radius: 10px;
        min-width: 18px;
        text-align: center;
    }
}

/* Floating Action Button Mobile */
@media (max-width: 768px) {
    #advanced-features-fab {
        bottom: 85px !important;
        right: 15px;
        z-index: 998;
    }

    .advanced-fab-btn {
        width: 55px !important;
        height: 55px !important;
        box-shadow: 0 4px 20px rgba(102, 126, 234, 0.5);
    }

    .fab-icon {
        font-size: 24px !important;
    }
}

/* Search Bar Mobile */
@media (max-width: 768px) {
    #mobile-search-container {
        padding: 15px;
    }

    #mobile-search-input {
        font-size: 16px !important;
        height: 48px;
        border-radius: 24px;
        padding: 12px 20px 12px 45px;
    }

    .search-results {
        max-height: calc(100vh - 200px);
        border-radius: 12px;
        margin-top: 10px;
    }

    .search-result-item {
        padding: 15px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
}

/* Toast Notifications Mobile */
@media (max-width: 768px) {
    .advanced-toast,
    .toast-notification {
        left: 15px !important;
        right: 15px !important;
        top: 70px !important;
        max-width: none;
        font-size: 0.9rem;
        padding: 12px 15px;
    }
}

/* Modal/Dialog Mobile */
@media (max-width: 768px) {
    .modal,
    .dialog,
    .advanced-menu-content {
        width: 95% !important;
        max-width: 95% !important;
        margin: 10px;
        border-radius: 15px;
    }

    .modal-header,
    .dialog-header,
    .advanced-menu-header {
        padding: 20px 15px;
        font-size: 1.2rem;
    }

    .modal-body,
    .dialog-body,
    .advanced-menu-body {
        padding: 15px;
        max-height: 70vh;
        overflow-y: auto;
    }

    .feature-card {
        padding: 15px;
        border-radius: 12px;
    }
}

/* Safe Area Insets for iOS */
@media (max-width: 768px) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: calc(80px + env(safe-area-inset-bottom));
    }

    .mobile-bottom-nav {
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }

    #advanced-features-fab {
        bottom: calc(85px + env(safe-area-inset-bottom)) !important;
    }
}

/* Landscape Mode Adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    .hero-section {
        min-height: auto;
        padding: 80px 20px 40px;
    }

    .hero-floating-bubble {
        width: 70px !important;
        height: 70px !important;
    }

    .bubble-text {
        font-size: 0.6rem !important;
    }

    .mobile-bottom-nav {
        padding: 5px 0 8px 0;
    }

    .mobile-nav-item {
        padding: 5px 8px;
    }

    .mobile-nav-item i {
        font-size: 1.2rem;
    }

    .mobile-nav-item span {
        font-size: 0.65rem;
    }
}

/* Performance Optimizations */
@media (max-width: 768px) {
    * {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }

    /* Reduce animations for better performance */
    @media (prefers-reduced-motion: reduce) {
        *,
        *::before,
        *::after {
            animation-duration: 0.01ms !important;
            animation-iteration-count: 1 !important;
            transition-duration: 0.01ms !important;
        }
    }

    /* Optimize images */
    img {
        image-rendering: -webkit-optimize-contrast;
        transform: translateZ(0);
        will-change: transform;
    }

    /* Optimize scrolling */
    .section-content,
    .hubs-grid,
    .products-grid {
        will-change: transform;
        transform: translateZ(0);
    }
}

/* Dark Mode Mobile Support */
@media (max-width: 768px) and (prefers-color-scheme: dark) {
    body.auto-dark-mode {
        background: #0f1419;
    }

    .mobile-bottom-nav {
        background: rgba(15, 20, 25, 0.98);
    }

    .minimal-nav {
        background: rgba(15, 20, 25, 0.98) !important;
    }
}

/* Very Small Screens (<375px) */
@media (max-width: 374px) {
    .hero-logo {
        font-size: 2rem !important;
    }

    .hero-tagline {
        font-size: 0.85rem !important;
    }

    .hero-description {
        font-size: 0.8rem !important;
    }

    .hero-floating-bubble {
        width: 75px !important;
        height: 75px !important;
    }

    .bubble-text {
        font-size: 0.6rem !important;
        padding: 4px 6px !important;
    }

    .mobile-nav-item {
        min-width: 50px;
        padding: 6px 8px;
    }

    .mobile-nav-item i {
        font-size: 1.2rem;
    }

    .mobile-nav-item span {
        font-size: 0.65rem;
    }
}

/* Tablet Adjustments (768px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .hubs-grid,
    .services-grid,
    .products-grid,
    .programs-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px;
    }

    .hero-floating-bubble {
        width: 110px !important;
        height: 110px !important;
    }

    /* Hide mobile bottom nav on tablet */
    .mobile-bottom-nav {
        display: none !important;
    }

    body {
        padding-bottom: 0 !important;
    }
}

/* Print Styles */
@media print {
    .mobile-bottom-nav,
    #advanced-features-fab,
    .scroll-indicator,
    .page-loader {
        display: none !important;
    }

    body {
        padding-bottom: 0 !important;
    }
}
