/* ==========================================
   MOBILE HUD - GAME-STYLE LAYOUT
   Applies only to screens <= 768px
   ========================================== */

/* DESKTOP: Hide mobile-only elements */
@media (min-width: 769px) {
    .mobile-bottom-nav,
    .mobile-sound-btn,
    .mobile-logout-btn-header,
    .currency-display-mobile {
        display: none !important;
    }
}

/* ==========================================
   MOBILE STYLES
   ========================================== */
@media (max-width: 768px) {
    
    /* FIX: Background image coverage for mobile */
    html,
    body {
        background-size: cover !important;
        background-position: center center !important;
        background-attachment: scroll !important;
        min-height: 100vh !important;
        min-height: -webkit-fill-available !important;
        width: 100% !important;
        animation: none !important;
    }
    
    body::before {
        background-attachment: scroll !important;
    }
    
    /* Ensure full viewport coverage */
    #dashboard-screen,
    #login-screen {
        min-height: 100vh !important;
        min-height: -webkit-fill-available !important;
        width: 100% !important;
    }
    
    /* 1. MOBILE TOP HEADER BAR */
    .top-header {
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center;
        justify-content: flex-start;
        padding: 10px 15px !important;
        background: linear-gradient(180deg, rgba(15, 25, 45, 0.98) 0%, rgba(10, 20, 40, 0.95) 100%);
        border-bottom: 2px solid rgba(79, 195, 247, 0.5);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
        height: auto;
        min-height: 60px;
        gap: 10px;
    }

    .header-left {
        display: flex !important;
        flex-direction: row !important;
        align-items: center;
        gap: 12px;
        flex: 1;
    }

    .header-logo {
        height: 35px !important;
        width: auto;
        flex-shrink: 0;
    }

    .notification-btn {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        min-height: 36px !important;
        max-width: 36px !important;
        max-height: 36px !important;
        font-size: 1rem !important;
        padding: 0 !important;
    }

    .player-info {
        display: flex !important;
        align-items: center;
        gap: 8px;
        padding: 5px 10px !important;
        background: rgba(0, 0, 0, 0.3);
        border-radius: 20px;
        border: 2px solid rgba(79, 195, 247, 0.3);
    }

    .avatar {
        width: 35px !important;
        height: 35px !important;
    }

    .player-name {
        display: none !important;
    }

    .edit-name-btn {
        display: none !important;
    }

    .avatar {
        cursor: pointer !important;
    }

    /* Mobile Currency Display */
    .currency-display-mobile {
        display: flex !important;
        align-items: center;
        gap: 8px;
        padding: 5px 10px !important;
        background: rgba(0, 0, 0, 0.4);
        border-radius: 20px;
        border: 2px solid rgba(79, 195, 247, 0.3);
        flex-shrink: 0;
    }

    .currency-display-mobile .currency {
        display: flex;
        align-items: center;
        gap: 4px;
        font-size: 0.85rem;
        font-weight: 700;
        color: #fff;
    }

    .currency-display-mobile .currency .icon {
        font-size: 1rem;
        filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.6));
    }

    .currency-display-mobile .currency.gems {
        color: #4fc3f7;
    }

    .currency-display-mobile .currency.coins {
        color: #ffd700;
    }

    /* Mobile Sound Button in Header */
    .mobile-sound-btn {
        display: flex !important;
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        min-height: 36px !important;
        max-width: 36px !important;
        max-height: 36px !important;
        background: linear-gradient(135deg, rgba(30, 40, 70, 0.95) 0%, rgba(20, 30, 50, 0.98) 100%);
        border: 2px solid rgba(79, 195, 247, 0.5);
        border-radius: 50%;
        font-size: 1rem;
        cursor: pointer;
        align-items: center;
        justify-content: center;
        color: #4fc3f7;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        flex-shrink: 0;
        padding: 0 !important;
    }

    .mobile-sound-btn:hover,
    .mobile-sound-btn:active {
        background: linear-gradient(135deg, rgba(79, 195, 247, 0.3) 0%, rgba(33, 150, 243, 0.3) 100%);
        border-color: rgba(79, 195, 247, 0.7);
        transform: scale(1.05);
    }

    /* Mobile Logout Button in Header */
    .mobile-logout-btn-header {
        display: flex !important;
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        min-height: 36px !important;
        max-width: 36px !important;
        max-height: 36px !important;
        background: linear-gradient(135deg, rgba(244, 67, 54, 0.3) 0%, rgba(198, 40, 40, 0.4) 100%);
        border: 2px solid rgba(244, 67, 54, 0.5);
        border-radius: 50%;
        font-size: 1rem;
        font-weight: 700;
        cursor: pointer;
        align-items: center;
        justify-content: center;
        color: #ff5252;
        box-shadow: 0 4px 15px rgba(244, 67, 54, 0.3);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        flex-shrink: 0;
        padding: 0 !important;
    }

    .mobile-logout-btn-header:hover,
    .mobile-logout-btn-header:active {
        background: linear-gradient(135deg, #f44336 0%, #c62828 100%);
        border-color: #f44336;
        transform: scale(1.05);
    }

    /* Hide desktop nav and right section */
    .top-nav {
        display: none !important;
    }

    .header-right {
        display: none !important;
    }

    .player-name {
        display: none !important;
    }

    /* 2. BOTTOM NAVIGATION BAR */
    .mobile-bottom-nav {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        height: 70px;
        background: linear-gradient(180deg, rgba(15, 25, 45, 0.98) 0%, rgba(10, 20, 40, 1) 100%);
        border-top: 2px solid rgba(79, 195, 247, 0.5);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.6);
        padding: 0 5px;
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    .mobile-bottom-nav .nav-menu {
        display: flex !important;
        align-items: center;
        justify-content: space-around;
        width: 100%;
        height: 100%;
        list-style: none;
        margin: 0;
        padding: 0;
        background: transparent;
        border: none;
    }

    .mobile-bottom-nav .nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        padding: 8px 4px;
        background: transparent;
        border: none;
        border-radius: 0;
        box-shadow: none;
        transition: all 0.3s ease;
    }

    .mobile-bottom-nav .nav-item::before {
        display: none;
    }

    .mobile-bottom-nav .nav-item .icon {
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        font-size: 1.3rem;
        background: rgba(30, 45, 70, 0.8);
        border: 2px solid rgba(79, 195, 247, 0.3);
        color: rgba(255, 255, 255, 0.7);
        filter: none;
        transition: all 0.3s ease;
    }

    .mobile-bottom-nav .nav-item .label {
        font-size: 0.6rem;
        font-weight: 700;
        color: rgba(255, 255, 255, 0.6);
        text-transform: uppercase;
        display: block !important;
    }

    .mobile-bottom-nav .nav-item.active {
        transform: none;
        background: transparent;
    }

    .mobile-bottom-nav .nav-item.active .icon {
        width: 48px;
        height: 48px;
        background: linear-gradient(135deg, #4fc3f7 0%, #0288d1 100%);
        border-color: #4fc3f7;
        box-shadow: 0 0 20px rgba(79, 195, 247, 0.6), 0 0 40px rgba(79, 195, 247, 0.3);
        color: #fff;
        font-size: 1.4rem;
        transform: translateY(-5px);
    }

    .mobile-bottom-nav .nav-item.active .label {
        color: #4fc3f7;
        font-weight: 800;
    }

    /* 3. MAIN CONTENT ADJUSTMENTS */
    .main-content {
        padding-top: 80px !important;
        padding-bottom: 80px !important;
    }

    .content-area {
        padding: 10px !important;
    }

    .volume-slider {
        display: none !important;
    }

    .notification-dropdown {
        position: fixed !important;
        top: 65px !important;
        left: 10px !important;
        right: 10px !important;
        width: auto !important;
        max-height: 60vh;
        border-radius: 15px;
    }
}

/* EXTRA SMALL DEVICES */
@media (max-width: 400px) {
    .top-header {
        padding: 6px 8px !important;
    }

    .header-logo {
        height: 26px !important;
    }

    .notification-btn {
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
        min-height: 32px !important;
        max-width: 32px !important;
        max-height: 32px !important;
        font-size: 0.9rem !important;
    }

    .header-daily-rewards-btn {
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
        min-height: 32px !important;
        max-width: 32px !important;
        max-height: 32px !important;
        font-size: 0.9rem !important;
    }

    .avatar {
        width: 28px !important;
        height: 28px !important;
    }

    .currency-display-mobile {
        padding: 4px 8px !important;
        gap: 6px !important;
    }

    .currency-display-mobile .currency {
        font-size: 0.75rem !important;
        gap: 3px !important;
    }

    .currency-display-mobile .currency .icon {
        font-size: 0.9rem !important;
    }

    .mobile-side-btn {
        width: 44px;
        height: 44px;
    }

    .mobile-bottom-nav {
        height: 65px;
    }

    .mobile-bottom-nav .nav-item .icon {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }

    .mobile-bottom-nav .nav-item.active .icon {
        width: 42px;
        height: 42px;
    }
}
