/* mobile.css - PWA features, mobile controls, and small screen optimizations */

/* --- PWA & UPDATE STYLES --- */
.pwa-install-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin-top: 10px;
}

.update-notification {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #ff9800;
    color: #000;
    padding: 15px;
    z-index: 200;
    text-align: center;
    font-family: 'Press Start 2P', cursive;
}

.notification-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.notification-content p {
    margin: 0;
    font-size: 0.8rem;
}

.offline {
    filter: grayscale(0.3);
}

/* --- MOBILE GAME FEATURES (Quick Actions) --- */
.quick-actions {
    position: fixed;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 45;
}

.quick-action-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 2px solid rgba(255, 215, 0, 0.7);
    background: rgba(0, 0, 0, 0.7);
    color: #ffd700;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.quick-action-btn:hover, .quick-action-btn:active {
    background: rgba(255, 215, 0, 0.2);
    transform: scale(1.1);
}

/* --- NEW MOBILE CONTROLS (D-Pad and Actions) --- */
#mobile-dpad-container, #mobile-actions-container {
    position: fixed;
    bottom: 15px;
    z-index: 50;
    opacity: 0.8;
    transition: opacity 0.2s ease-in-out;
}

#mobile-dpad-container {
    left: 15px;
}

#mobile-actions-container {
    right: 15px;
}

#mobile-dpad-container:hover, #mobile-actions-container:hover {
    opacity: 1.0;
}

.mobile-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.mobile-dpad {
    display: grid;
    grid-template-columns: repeat(3, 50px);
    grid-template-rows: repeat(3, 50px);
    gap: 5px;
}

.mobile-btn, .mobile-dpad-btn {
    font-family: 'Press Start 2P', cursive;
    background-color: rgba(40, 40, 40, 0.8);
    border: 2px solid var(--grey-border);
    color: var(--main-gold);
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    -webkit-tap-highlight-color: transparent;
    transition: var(--button-transition); /* Restored */
    box-shadow: 0 2px 0 #333; /* Restored */
}

/* Active State (Restored) */
.mobile-btn:active, .mobile-dpad-btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #333;
}

.mobile-btn {
    font-size: 0.7rem;
    padding: 10px 5px;
}

#mobile-action-map {
    font-size: 1.2rem;
}

.mobile-dpad-btn {
    font-size: 1.5rem;
}

#mobile-dpad-up { grid-area: 1 / 2 / 2 / 3; }
#mobile-dpad-left { grid-area: 2 / 1 / 3 / 2; }
#mobile-dpad-center { grid-area: 2 / 2 / 3 / 3; }
#mobile-dpad-right { grid-area: 2 / 3 / 3 / 4; }
#mobile-dpad-down { grid-area: 3 / 2 / 4 / 3; }

/* Hide quick actions in landscape mode on mobile (Restored) */
body.layout-landscape .quick-actions {
    display: none;
}

/* --- Safe Area Support for Notched Devices (Restored) --- */
@supports (padding: max(0px)) {
    /* Body padding handled in layout.css */
    #mobile-actions-container {
        right: max(15px, env(safe-area-inset-right));
        bottom: max(15px, env(safe-area-inset-bottom));
    }
    #mobile-dpad-container {
        left: max(15px, env(safe-area-inset-left));
        bottom: max(15px, env(safe-area-inset-bottom));
    }
}

/* Responsive adjustments for class selection (Restored) */
@media (max-width: 480px) {
    .sprite-selection-container {
        gap: 10px;
    }

    .sprite-selector {
        padding: 8px;
        min-width: 70px;
    }

    .sprite-placeholder {
        width: 40px;
        height: 40px;
        font-size: 2rem;
    }

    .sprite-label {
        font-size: 0.6rem;
    }

    #class-description {
        font-size: 0.7rem;
    }
}

/* --- Responsive adjustments for very small screens --- */
@media (max-height: 600px) and (orientation: landscape) {
    .game-toast {
        top: 10px;
        font-size: 0.6rem;
        padding: 5px 15px;
    }

    .achievement-popup {
        top: 10px;
        right: -300px;
        max-width: 250px;
    }

    .quick-actions {
        right: 5px;
        gap: 5px;
    }

    .quick-action-btn {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
}

/* --- Mobile optimizations (Small portrait screens) --- */
@media (max-width: 480px) {
    .dialog-content {
        padding: 15px;
        width: 95vw;
        max-width: none;
        overflow-x: hidden !important;
    }

    .game-button {
        font-size: 0.8rem;
        padding: 12px 20px;
    }

    .achievements-grid {
        grid-template-columns: 1fr;
    }

    .achievement-item {
        padding: 6px;
    }

    .achievement-info strong {
        font-size: 0.7rem;
    }

    .achievement-info small {
        font-size: 0.5rem;
    }

    #shop-screen .dialog-content {
        width: 95vw;
        height: 85vh;
        max-height: 85vh;
    }

    .shop-panels-container {
        gap: 15px;
    }

    .shop-list {
        max-height: 150px;
    }

    .settings-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}
