/* GASPOL - Game Asyik Pembelajaran Online */
/* Tema: United Tractors */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #1C1C1C 0%, #2C2C2C 50%, #3a3a3a 100%);
    min-height: 100vh;
    color: #333;
}

.container { max-width: 1200px; margin: 0 auto; padding: 20px; }

/* Navbar - Tema UT */
.navbar {
    background: linear-gradient(135deg, #FFC425 0%, #FFB800 100%);
    color: #1C1C1C;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 15px rgba(255, 196, 37, 0.3);
}

.nav-brand {
    font-size: 28px;
    font-weight: bold;
    color: #1C1C1C;
    text-shadow: 2px 2px 0px rgba(0,0,0,0.1);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 15px;
    color: #1C1C1C;
    font-weight: 600;
}

.nav-role {
    background: #1C1C1C;
    color: #FFC425;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: bold;
}

.btn-logout {
    background: #1C1C1C;
    color: #FFC425;
    padding: 8px 15px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s;
    border: 2px solid #1C1C1C;
}

.btn-logout:hover {
    background: transparent;
    color: #1C1C1C;
}

/* Login & Install - Tema UT */
.login-container, .install-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box, .install-box {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 450px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    border-top: 8px solid #FFC425;
}

.login-header, .install-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1, .install-header h1 {
    font-size: 42px;
    background: linear-gradient(135deg, #FFC425 0%, #FFB800 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    font-weight: bold;
}

.tagline {
    color: #666;
    font-size: 14px;
    margin-bottom: 5px;
}

.school {
    color: #1C1C1C;
    font-weight: 600;
    font-size: 14px;
}

/* Form */
.form-group { margin-bottom: 20px; }

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #1C1C1C;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #FFC425;
    box-shadow: 0 0 0 3px rgba(255, 196, 37, 0.2);
}

/* Buttons - Tema UT */
.btn-login, .btn-primary {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #FFC425 0%, #FFB800 100%);
    color: #1C1C1C;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    box-shadow: 0 4px 15px rgba(255, 196, 37, 0.3);
}

.btn-login:hover, .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 196, 37, 0.5);
}

.btn-secondary {
    display: inline-block;
    padding: 12px 25px;
    background: #1C1C1C;
    color: #FFC425;
    text-decoration: none;
    border-radius: 10px;
    font-weight: bold;
    transition: all 0.3s;
    border: 2px solid #1C1C1C;
}

.btn-secondary:hover {
    background: transparent;
    color: #1C1C1C;
}

/* Alerts */
.alert {
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.alert-error {
    background: #ffe0e0;
    color: #d63447;
    border: 1px solid #f5576c;
}

.alert-success {
    background: #e0ffe0;
    color: #2d8a4e;
    border: 1px solid #51cf66;
}

.alert-warning {
    background: #fff3e0;
    color: #e67e22;
    border: 1px solid #f39c12;
}

/* Login Footer */
.login-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.login-footer a {
    color: #FFC425;
    text-decoration: none;
    font-weight: bold;
    background: linear-gradient(135deg, #FFC425 0%, #FFB800 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Dashboard - Tema UT */
.dashboard { padding: 20px 0; }

.dashboard-header {
    background: white;
    padding: 30px;
    border-radius: 20px;
    margin-bottom: 30px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    border-left: 8px solid #FFC425;
}

.dashboard-header h1 {
    color: #1C1C1C;
    margin-bottom: 10px;
    font-size: 28px;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s;
    border-top: 5px solid #FFC425;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon { font-size: 48px; }

.stat-info h3 {
    color: #666;
    font-size: 14px;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 28px;
    font-weight: bold;
    background: linear-gradient(135deg, #FFC425 0%, #FFB800 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.dashboard-section {
    background: white;
    padding: 30px;
    border-radius: 20px;
    margin-bottom: 20px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.dashboard-section h2 {
    margin-bottom: 20px;
    color: #1C1C1C;
    border-bottom: 3px solid #FFC425;
    padding-bottom: 10px;
}

.class-list { display: grid; gap: 15px; }

.class-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    padding: 20px;
    border-radius: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 2px solid #e0e0e0;
    transition: all 0.3s;
}

.class-card:hover {
    border-color: #FFC425;
    box-shadow: 0 5px 20px rgba(255, 196, 37, 0.2);
}

.class-info h3 {
    color: #1C1C1C;
    margin-bottom: 5px;
    font-size: 20px;
}

.class-info p {
    color: #666;
    font-size: 14px;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #999;
}

/* Game */
.game-container { padding: 20px 0; }

.game-header {
    background: white;
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-left: 8px solid #FFC425;
}

.game-header h1 {
    color: #1C1C1C;
    margin-bottom: 10px;
}

.game-canvas {
    background: white;
    border-radius: 15px;
    padding: 40px;
    text-align: center;
    min-height: 500px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.game-placeholder h2 {
    color: #FFC425;
    margin-bottom: 15px;
    font-size: 32px;
}

.loading-text { color: #999; margin-top: 10px; }

.game-controls { margin-top: 20px; text-align: center; }

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    color: rgba(255,255,255,0.8);
    font-size: 14px;
    margin-top: 40px;
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 10px;
        padding: 15px;
    }
    
    .nav-user {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .dashboard-stats {
        grid-template-columns: 1fr;
    }
    
    .class-card {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .login-box, .install-box {
        padding: 25px;
    }
    /* ===== GAME SPECIFIC STYLES ===== */
    .game-wrapper { padding: 10px 0; }
    .game-canvas-container {
        position: relative;
        width: 100%;
        max-width: 800px;
        margin: 0 auto;
        border-radius: 15px;
        overflow: hidden;
        box-shadow: 0 10px 30px rgba(0,0,0,0.3);
        border: 4px solid #FFC425;
        background: #2d5016;
    }

    #phaser-game {
        width: 100%;
        height: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    /* Mobile D-Pad */
    .mobile-controls {
        position: absolute;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 100;
        display: none; /* Muncul hanya di layar kecil via media query */
    }

    @media (max-width: 768px) {
        .mobile-controls { display: block; }
    }

    .dpad {
        display: grid;
        grid-template-columns: 60px 60px 60px;
        grid-template-rows: 60px 60px 60px;
        gap: 5px;
    }

    .dpad-btn {
        background: rgba(28, 28, 28, 0.7);
        border: 2px solid #FFC425;
        border-radius: 12px;
        color: #FFC425;
        font-size: 24px;
        font-weight: bold;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        touch-action: manipulation;
        user-select: none;
    }

    .dpad-btn:active { background: #FFC425; color: #1C1C1C; }
    .dpad-up { grid-column: 2; grid-row: 1; }
    .dpad-left { grid-column: 1; grid-row: 2; }
    .dpad-right { grid-column: 3; grid-row: 2; }
    .dpad-down { grid-column: 2; grid-row: 3; }
    .dpad-action { 
        grid-column: 2; grid-row: 2;
        background: rgba(231, 76, 60, 0.8);
        border-color: #e74c3c;
        color: white;
        font-size: 14px;
    }

    /* Mission Modal Overlay */
    .mission-modal {
        position: fixed;
        top: 0; left: 0;
        width: 100%; height: 100%;
        background: rgba(28, 28, 28, 0.9);
        display: none;
        z-index: 1000;
        overflow-y: auto;
        padding: 20px;
    }
    .mission-modal.show { display: flex; align-items: center; justify-content: center; }

    .mission-content {
        background: white;
        border-radius: 20px;
        padding: 25px;
        max-width: 500px;
        width: 100%;
        border-top: 8px solid #FFC425;
        box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    }

    .mission-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 20px;
        padding-bottom: 15px;
        border-bottom: 2px solid #f0f0f0;
    }

    .mission-header h2 { color: #1C1C1C; font-size: 20px; }
    .mission-reward { background: #FFC425; color: #1C1C1C; padding: 5px 12px; border-radius: 15px; font-weight: bold; font-size: 14px; }

    .mission-body {
        background: #f8f9fa;
        padding: 15px;
        border-radius: 10px;
        margin-bottom: 20px;
        border-left: 4px solid #FFC425;
        line-height: 1.6;
    }

    .answer-input {
        width: 100%;
        padding: 15px;
        border: 2px solid #e0e0e0;
        border-radius: 10px;
        font-size: 18px;
        font-weight: bold;
        margin-bottom: 15px;
        text-align: center;
    }
    .answer-input:focus { outline: none; border-color: #FFC425; }

    /* Notification Toast */
    .notification {
        position: fixed;
        top: 80px;
        left: 50%;
        transform: translateX(-50%);
        background: #1C1C1C;
        color: #FFC425;
        padding: 12px 25px;
        border-radius: 10px;
        font-weight: bold;
        box-shadow: 0 5px 20px rgba(0,0,0,0.3);
        z-index: 2000;
        display: none;
        border: 2px solid #FFC425;
    }
    .notification.show { display: block; animation: slideDown 0.4s ease-out; }

    @keyframes slideDown {
        from { transform: translateX(-50%) translateY(-30px); opacity: 0; }
        to { transform: translateX(-50%) translateY(0); opacity: 1; }
    }
    /* ===== GAME LANDSCAPE MODE ===== */
    .game-wrapper { padding: 10px; }

    .game-header-compact {
        background: linear-gradient(135deg, #FFC425 0%, #FFB800 100%);
        padding: 12px 20px;
        border-radius: 12px;
        margin-bottom: 15px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        gap: 10px;
        box-shadow: 0 4px 15px rgba(255, 196, 37, 0.3);
    }

    .game-title-area { display: flex; align-items: center; gap: 15px; flex-wrap: wrap; }
    .game-title-area h1 { font-size: 20px; color: #1C1C1C; margin: 0; }

    .player-stats { display: flex; gap: 10px; }
    .stat-badge {
        background: #1C1C1C;
        color: #FFC425;
        padding: 5px 12px;
        border-radius: 15px;
        font-size: 13px;
        font-weight: bold;
    }
    .coin-badge { background: #FFC425; color: #1C1C1C; }

    .game-actions { display: flex; gap: 10px; align-items: center; }
    .btn-icon {
        background: #1C1C1C;
        color: #FFC425;
        border: 2px solid #1C1C1C;
        width: 40px;
        height: 40px;
        border-radius: 8px;
        font-size: 20px;
        cursor: pointer;
        transition: all 0.3s;
    }
    .btn-icon:hover { background: transparent; color: #1C1C1C; }
    .btn-secondary.small { padding: 8px 15px; font-size: 13px; }

    /* Game Canvas Container - Landscape */
    .game-canvas-container {
        position: relative;
        width: 100%;
        max-width: 960px;
        margin: 0 auto;
        border-radius: 15px;
        overflow: hidden;
        box-shadow: 0 10px 30px rgba(0,0,0,0.5);
        border: 4px solid #FFC425;
        background: #2d5016;
        aspect-ratio: 16/9;
    }

    #phaser-game {
        width: 100%;
        height: 100%;
    }

    #phaser-game canvas {
        width: 100% !important;
        height: 100% !important;
        display: block;
    }

    /* Mobile Controls - LEFT (D-Pad) */
    .mobile-controls-left {
        position: absolute;
        bottom: 15px;
        left: 15px;
        z-index: 1000;
        pointer-events: none;
    }

    .mobile-controls-left .dpad {
        pointer-events: auto;
        display: grid;
        grid-template-columns: 65px 65px 65px;
        grid-template-rows: 65px 65px 65px;
        gap: 6px;
    }

    .mobile-controls-left .dpad-btn {
        background: rgba(28, 28, 28, 0.85);
        border: 3px solid #FFC425;
        border-radius: 12px;
        color: #FFC425;
        font-size: 26px;
        font-weight: bold;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        touch-action: manipulation;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
        transition: all 0.1s;
    }

    .mobile-controls-left .dpad-btn:active {
        background: #FFC425;
        color: #1C1C1C;
        transform: scale(0.95);
    }

    .dpad-up { grid-column: 2; grid-row: 1; }
    .dpad-left { grid-column: 1; grid-row: 2; }
    .dpad-center { 
        grid-column: 2; grid-row: 2;
        background: rgba(231, 76, 60, 0.9);
        border-color: #e74c3c;
        color: white;
        font-size: 22px;
    }
    .dpad-right { grid-column: 3; grid-row: 2; }
    .dpad-down { grid-column: 2; grid-row: 3; }

    /* Mobile Controls - RIGHT (Action Buttons) */
    .mobile-controls-right {
        position: absolute;
        bottom: 15px;
        right: 15px;
        z-index: 1000;
        pointer-events: none;
    }

    .action-buttons {
        pointer-events: auto;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .action-btn {
        background: linear-gradient(135deg, #FFC425 0%, #FFB800 100%);
        color: #1C1C1C;
        border: 3px solid #1C1C1C;
        padding: 15px 20px;
        border-radius: 12px;
        font-size: 16px;
        font-weight: bold;
        cursor: pointer;
        touch-action: manipulation;
        box-shadow: 0 4px 10px rgba(0,0,0,0.3);
        transition: all 0.1s;
    }

    .action-btn:active {
        transform: scale(0.95);
        box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    }

    /* Mission Modal - Improved */
    .mission-modal {
        position: fixed;
        top: 0; left: 0;
        width: 100%; height: 100%;
        background: rgba(28, 28, 28, 0.92);
        display: none;
        z-index: 2000;
        overflow-y: auto;
        padding: 20px;
        align-items: center;
        justify-content: center;
    }
    .mission-modal.show { display: flex; }

    .mission-content {
        background: white;
        border-radius: 20px;
        padding: 25px;
        max-width: 500px;
        width: 100%;
        border-top: 8px solid #FFC425;
        box-shadow: 0 20px 60px rgba(0,0,0,0.5);
        animation: popIn 0.3s ease-out;
    }

    @keyframes popIn {
        from { transform: scale(0.8); opacity: 0; }
        to { transform: scale(1); opacity: 1; }
    }

    .mission-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 20px;
        padding-bottom: 15px;
        border-bottom: 2px solid #f0f0f0;
    }

    .mission-header h2 { color: #1C1C1C; font-size: 20px; margin: 0; }
    .mission-reward { background: #FFC425; color: #1C1C1C; padding: 5px 12px; border-radius: 15px; font-weight: bold; font-size: 14px; }

    .mission-body {
        background: #f8f9fa;
        padding: 15px;
        border-radius: 10px;
        margin-bottom: 20px;
        border-left: 4px solid #FFC425;
        line-height: 1.6;
    }

    .answer-input {
        width: 100%;
        padding: 15px;
        border: 2px solid #e0e0e0;
        border-radius: 10px;
        font-size: 18px;
        font-weight: bold;
        margin-bottom: 15px;
        text-align: center;
    }
    .answer-input:focus { outline: none; border-color: #FFC425; }

    /* Notification */
    .notification {
        position: fixed;
        top: 80px;
        left: 50%;
        transform: translateX(-50%);
        background: #1C1C1C;
        color: #FFC425;
        padding: 12px 25px;
        border-radius: 10px;
        font-weight: bold;
        box-shadow: 0 5px 20px rgba(0,0,0,0.5);
        z-index: 3000;
        display: none;
        border: 2px solid #FFC425;
        font-size: 14px;
    }
    .notification.show { display: block; animation: slideDown 0.4s ease-out; }

    @keyframes slideDown {
        from { transform: translateX(-50%) translateY(-30px); opacity: 0; }
        to { transform: translateX(-50%) translateY(0); opacity: 1; }
    }

    /* Responsive untuk HP */
    @media (max-width: 768px) {
        .game-header-compact {
            flex-direction: column;
            align-items: flex-start;
        }
        
        .game-title-area h1 { font-size: 16px; }
        .stat-badge { font-size: 11px; padding: 4px 8px; }
        
        .mobile-controls-left .dpad {
            grid-template-columns: 55px 55px 55px;
            grid-template-rows: 55px 55px 55px;
            gap: 4px;
        }
        
        .mobile-controls-left .dpad-btn {
            font-size: 22px;
            border-width: 2px;
        }
        
        .action-btn {
            padding: 12px 15px;
            font-size: 14px;
        }
        
        .mission-content { padding: 20px; }
        .mission-header h2 { font-size: 18px; }
    }

    @media (max-width: 480px) {
        .mobile-controls-left .dpad {
            grid-template-columns: 50px 50px 50px;
            grid-template-rows: 50px 50px 50px;
        }
        
        .mobile-controls-left .dpad-btn { font-size: 20px; }
        .action-btn { padding: 10px 12px; font-size: 13px; }
    }
    /* ===== GAME LOADING & ERROR STATES ===== */
    .game-loading {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: linear-gradient(135deg, #1C1C1C 0%, #2C2C2C 100%);
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        color: #FFC425;
        z-index: 100;
    }

    .game-loading .loader {
        border: 5px solid #333;
        border-top: 5px solid #FFC425;
        border-radius: 50%;
        width: 60px;
        height: 60px;
        animation: spin 1s linear infinite;
        margin-bottom: 20px;
    }

    @keyframes spin {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
    }

    .game-loading p {
        font-size: 18px;
        font-weight: bold;
        margin: 0;
    }

    .game-error {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: linear-gradient(135deg, #1C1C1C 0%, #2C2C2C 100%);
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        color: white;
        z-index: 100;
        padding: 30px;
        text-align: center;
    }

    .game-error h3 {
        color: #FFC425;
        font-size: 24px;
        margin-bottom: 15px;
    }

    .game-error p {
        font-size: 16px;
        margin-bottom: 20px;
        color: #cccccc;
    }

    #phaser-game {
        width: 100%;
        height: 100%;
        position: relative;
    }

    #phaser-game canvas {
        display: block;
        width: 100% !important;
        height: 100% !important;
    }
}