/* ========================================
   MOBILE OPTIMIZATION - APP-LIKE EXPERIENCE
   Cloud Above Platform
   ======================================== */

/* Mobile-First Touch Optimizations */
@media (max-width: 768px) {
    
    /* Improve tap targets - minimum 44x44px for touch */
    button, 
    a,
    .nav-links a,
    .hero-floating-bubble,
    .hub-card,
    .product-card {
        min-height: 44px;
        min-width: 44px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    /* Remove hover effects on touch devices */
    * {
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }

    /* Allow text selection in content areas */
    p, 
    h1, h2, h3, h4, h5, h6,
    span,
    .content-text {
        -webkit-user-select: text;
        user-select: text;
    }

    /* Smooth scrolling for mobile */
    html {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }

    body {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
        padding-bottom: 80px; /* Space for bottom nav */
    }
}

/* ========================================
   BOTTOM NAVIGATION BAR (APP-STYLE)
   ======================================== */

.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 999;
    background: rgba(26, 42, 58, 0.98);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(212, 175, 55, 0.3);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    padding: 8px 0 12px 0;
    padding-bottom: calc(12px + env(safe-area-inset-bottom)); /* iOS safe area */
    transform: translateY(0);
    transition: transform 0.3s ease;
}

.mobile-bottom-nav.hidden {
    transform: translateY(100%);
}

.mobile-bottom-nav-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 10px;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    transition: all 0.3s ease;
    border-radius: 12px;
    min-width: 60px;
    position: relative;
}

.mobile-nav-item i {
    font-size: 20px;
    transition: all 0.3s ease;
}

.mobile-nav-item span {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.mobile-nav-item.active {
    color: #D4AF37;
    background: rgba(212, 175, 55, 0.1);
}

.mobile-nav-item.active i {
    transform: scale(1.1);
}

.mobile-nav-item:active {
    transform: scale(0.95);
}

/* Notification badge */
.mobile-nav-item .badge {
    position: absolute;
    top: 4px;
    right: 8px;
    background: #ff3b30;
    color: white;
    font-size: 9px;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
}

@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: block;
    }

    /* Hide desktop navigation on mobile */
    .minimal-nav .nav-links {
        display: none;
    }

    /* Adjust nav container padding */
    .nav-container {
        padding: 1.5rem 1.5rem !important;
    }
}

/* ========================================
   MOBILE MENU TOGGLE (HAMBURGER)
   ======================================== */

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #D4AF37;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    z-index: 1001;
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }
}

/* ========================================
   MOBILE DRAWER MENU
   ======================================== */

.mobile-drawer {
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 400px;
    height: 100vh;
    background: rgba(26, 42, 58, 0.98);
    backdrop-filter: blur(20px);
    z-index: 1002;
    transition: right 0.3s ease;
    overflow-y: auto;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.5);
}

.mobile-drawer.open {
    right: 0;
}

.mobile-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1001;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-drawer-overlay.show {
    display: block;
    opacity: 1;
}

.mobile-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.3);
}

.mobile-drawer-close {
    background: none;
    border: none;
    color: #D4AF37;
    font-size: 24px;
    cursor: pointer;
}

.mobile-drawer-content {
    padding: 20px;
}

.mobile-drawer-links {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.mobile-drawer-links a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 16px;
    font-weight: 400;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.mobile-drawer-links a i {
    font-size: 18px;
    color: #D4AF37;
    width: 24px;
}

.mobile-drawer-links a:active {
    background: rgba(212, 175, 55, 0.1);
    transform: translateX(4px);
}

/* ========================================
   PULL-TO-REFRESH
   ======================================== */

.pull-to-refresh {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(26, 42, 58, 0.95);
    transform: translateY(-100%);
    transition: transform 0.3s ease;
    z-index: 998;
}

.pull-to-refresh.pulling {
    transform: translateY(0);
}

.pull-to-refresh.refreshing {
    transform: translateY(0);
}

.pull-to-refresh-icon {
    color: #D4AF37;
    font-size: 24px;
    animation: spin 1s linear infinite;
}

.pull-to-refresh.refreshing .pull-to-refresh-icon {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ========================================
   MOBILE-OPTIMIZED HERO SECTION
   ======================================== */

@media (max-width: 768px) {
    .hero-section {
        min-height: 70vh;
        padding: 100px 20px 60px 20px;
    }

    .hero-content h1 {
        font-size: 2rem !important;
        line-height: 1.2;
    }

    .hero-tagline {
        font-size: 0.9rem !important;
        padding: 0 10px;
    }

    /* Make floating bubbles visible but smaller on mobile */
    .hero-floating-bubble {
        display: flex !important;
        width: 80px !important;
        height: 80px !important;
    }

    .bubble-text {
        font-size: 9px !important;
    }

    .bubble-image {
        width: 40px !important;
        height: 40px !important;
    }
}

/* ========================================
   MOBILE-OPTIMIZED CARDS
   ======================================== */

@media (max-width: 768px) {
    .hub-grid,
    .product-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
        padding: 20px !important;
    }

    .hub-card,
    .product-card {
        margin: 0 auto;
        max-width: 100%;
    }

    .hub-card {
        padding: 20px !important;
    }

    .hub-card-title {
        font-size: 1.3rem !important;
    }

    .hub-card-description {
        font-size: 0.9rem !important;
    }
}

/* ========================================
   SWIPE GESTURE INDICATORS
   ======================================== */

.swipe-indicator {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(26, 42, 58, 0.9);
    border-radius: 20px;
    color: #D4AF37;
    font-size: 12px;
    z-index: 100;
    animation: swipeHint 2s ease-in-out infinite;
}

@keyframes swipeHint {
    0%, 100% { transform: translateX(-50%) translateX(0); }
    50% { transform: translateX(-50%) translateX(10px); }
}

@media (max-width: 768px) {
    .swipe-indicator.show {
        display: flex;
    }
}

/* ========================================
   MOBILE-OPTIMIZED FORMS
   ======================================== */

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

    button[type="submit"] {
        padding: 16px 24px !important;
        font-size: 16px !important;
        border-radius: 12px !important;
        width: 100%;
    }
}

/* ========================================
   MOBILE LOADING SKELETON
   ======================================== */

.skeleton {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.1) 25%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0.1) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 8px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ========================================
   MOBILE TOAST NOTIFICATIONS
   ======================================== */

.mobile-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(26, 42, 58, 0.95);
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    min-width: 200px;
    max-width: 90%;
    text-align: center;
    transition: transform 0.3s ease;
}

.mobile-toast.show {
    transform: translateX(-50%) translateY(0);
}

.mobile-toast.success {
    border-left: 4px solid #4CAF50;
}

.mobile-toast.error {
    border-left: 4px solid #f44336;
}

.mobile-toast.info {
    border-left: 4px solid #D4AF37;
}

/* ========================================
   MOBILE FAB (Floating Action Button)
   ======================================== */

.mobile-fab {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #D4AF37, #B8860B);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    color: #1a1410;
    font-size: 24px;
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 998;
}

.mobile-fab:active {
    transform: scale(0.9);
}

@media (max-width: 768px) {
    .mobile-fab {
        display: flex;
    }
}

/* ========================================
   SMOOTH SCROLL SNAP (OPTIONAL)
   ======================================== */

@media (max-width: 768px) {
    .scroll-snap-container {
        scroll-snap-type: y proximity;
        -webkit-overflow-scrolling: touch;
    }

    .scroll-snap-section {
        scroll-snap-align: start;
        scroll-snap-stop: normal;
    }
}

/* ========================================
   iOS SAFE AREA SUPPORT
   ======================================== */

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

/* ========================================
   ANDROID STATUS BAR COLOR
   ======================================== */

@media (max-width: 768px) {
    body {
        padding-top: env(safe-area-inset-top);
    }
}

/* ========================================
   PERFORMANCE OPTIMIZATIONS
   ======================================== */

@media (max-width: 768px) {
    * {
        will-change: transform;
    }
    
    .mobile-nav-item,
    .mobile-drawer,
    .mobile-fab {
        will-change: transform;
    }
}
