/* static/css/style.css (Responsive Version) */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;700;900&display=swap');

/* === GAYA DASAR & HALAMAN GAME === */
body {
    font-family: 'Nunito', sans-serif;
    margin: 0;
    overflow: hidden;
    background-color: #1a1a1a;
}

/* GAYA KHUSUS UNTUK BODY HALAMAN GAME UTAMA */
.game-body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

/* === GAYA HALAMAN AUTENTIKASI === */
.auth-body {
    background-image: url('/static/img/latar_login.png');
    background-size: cover;
    background-position: center;
    height: 100vh;
}
.auth-container {
    position: absolute; top: 40px; right: 40px; width: 320px; padding: 25px 30px;
    background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(15px);
    border-radius: 15px; box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    border: 1px solid rgba(255, 255, 255, 0.2); text-align: center;
    opacity: 0; animation: fadeInForm 0.8s forwards ease-out;
}
@keyframes fadeInForm { to { opacity: 1; } }
.auth-container h1 { margin-bottom: 10px; font-size: 24px; color: #333; }
.auth-subtitle { font-size: 14px; color: #777; margin-top: 0; margin-bottom: 25px; }
.auth-container input { width: 100%; padding: 12px; margin-bottom: 15px; border: 1px solid #ddd; border-radius: 8px; font-family: 'Nunito', sans-serif; font-size: 14px; box-sizing: border-box; }
.auth-container button { width: 100%; padding: 12px; border: none; border-radius: 8px; background-color: #56ab2f; color: white; font-size: 16px; font-weight: 700; cursor: pointer; transition: background-color 0.3s ease; }
.auth-container button:hover { background-color: #6bc23b; }
.auth-footer { margin-top: 20px; font-size: 13px; }
.auth-footer a { color: #56ab2f; text-decoration: none; font-weight: 700; }

/* === GAYA SPLASH SCREEN & LOADING === */
#splash-screen, #loading-screen { 
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: #1a1a1a; display: flex; flex-direction: column;
    justify-content: center; align-items: center; z-index: 9999;
    opacity: 1; transition: opacity 0.5s ease-out, visibility 0.5s;
}
#splash-screen.hidden, #loading-screen.hidden { opacity: 0; visibility: hidden; pointer-events: none;}
#splash-screen p, #loading-screen p { color: white; margin-top: 20px; font-size: 18px; }
.splash-content { text-align: center; transform: translateY(20px); opacity: 0; animation: contentFadeIn 1s forwards ease-out; }
.splash-title { font-size: 6vw; font-weight: 900; color: white; margin: 0; letter-spacing: 5px; text-shadow: 0 0 20px rgba(168, 224, 99, 0.5); }
.splash-logo { width: 100px; height: 100px; margin-top: 20px; opacity: 0; animation: logoFadeIn 1s forwards 0.5s; }
#loading-text { color: #ccc; margin-top: 30px; font-size: 18px; opacity: 0; animation: logoFadeIn 1s forwards 0.8s; transition: opacity 0.5s; }
#start-button { padding: 15px 40px; font-size: 20px; color: white; background-color: #56ab2f; border: none; border-radius: 10px; cursor: pointer; margin-top: 30px; opacity: 0; visibility: hidden; transform: translateY(20px); transition: all 0.5s ease 0.2s; }
#splash-screen.ready #loading-text { opacity: 0; visibility: hidden; }
#splash-screen.ready #start-button { opacity: 1; visibility: visible; transform: translateY(0); }
#start-button:hover { background-color: #6bc23b; transform: scale(1.05); }
@keyframes contentFadeIn { to { transform: translateY(0); opacity: 1; } }
@keyframes logoFadeIn { to { opacity: 1; } }
.spinner { width: 50px; height: 50px; border: 5px solid rgba(255, 255, 255, 0.3); border-top-color: #a8e063; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* === GAYA UNTUK GAME UTAMA (TAMPILAN DESKTOP) === */
#game-container { position: relative; width: 800px; height: 600px; background-size: cover; border: 5px solid #664229; border-radius: 15px; box-shadow: 0 10px 20px rgba(0,0,0,0.3); transition: background-image 1.5s ease-in-out; }
.theme-pagi { background-image: url('/static/img/latar_belakang_pagi.png'); }
.theme-siang { background-image: url('/static/img/latar_belakang_kebun.png'); }
.theme-sore { background-image: url('/static/img/latar_belakang_sore.png'); }
.theme-malam { background-image: url('/static/img/latar_belakang_malam.png'); }
#weather-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; transition: background-color 1.5s ease-in-out, opacity 1.5s ease; opacity: 0; }
.cuaca-mendung #weather-overlay { background-color: rgba(0, 0, 0, 0.3); opacity: 1; }
.event-heatwave #weather-overlay { background: radial-gradient(circle, rgba(255,165,0,0.2) 0%, rgba(255,69,0,0.3) 100%); animation: heatwave-shimmer 5s infinite alternate; opacity: 1; }
@keyframes heatwave-shimmer { from { opacity: 0.6; } to { opacity: 0.9; } }
#petani { position: absolute; bottom: 50px; left: 150px; width: 300px; z-index: 5; transition: left 1s ease-in-out, bottom 1s ease-in-out; }
.tanaman-bayam { position: absolute; width: 150px; transition: transform 0.3s ease; z-index: 10; }
#tanaman1 { bottom: 0px; left: 50px; } #tanaman2 { bottom: 0px; left: 325px; } #tanaman3 { bottom: 0px; left: 550px; }
.tanaman-bayam:hover { transform: scale(1.1); }
#info-panel { position: absolute; top: 20px; left: 20px; width: 280px; background-color: rgba(25, 25, 30, 0.75); color: #f0f0f0; padding: 10px; border-radius: 15px; border: 1px solid rgba(255, 255, 255, 0.2); backdrop-filter: blur(10px); box-shadow: 0 4px 20px rgba(0,0,0,0.4); }
.stats-section { width: 100%; }
.player-name { text-align: center; font-size: 14px; color: #fff; margin-bottom: 10px; padding: 5px; background-color: rgba(0,0,0,0.3); border-radius: 5px; }
.player-level { display: flex; justify-content: space-between; align-items: center; font-size: 20px; font-weight: 700; margin-bottom: 10px; color: #f1c40f; text-shadow: 1px 1px 2px rgba(0,0,0,0.5); }
.xp-bar-container { width: 100%; height: 12px; background-color: rgba(0, 0, 0, 0.5); border-radius: 6px; overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.2); }
#xp-bar-fill { width: 0%; height: 100%; background: linear-gradient(90deg, #3498db, #5dade2); border-radius: 6px; transition: width 0.5s ease-out; }
.xp-text { text-align: right; font-size: 12px; margin-top: 4px; color: #bdc3c7; }
.divider { border: none; height: 1px; background-color: rgba(255, 255, 255, 0.2); margin: 10px 0; }
.sensor-item { display: flex; justify-content: space-between; align-items: center; padding: 2px 0; font-size: 14px; }
.sensor-label { opacity: 0.9; }
.sensor-value { font-weight: 700; color: #ffffff; }
#action-buttons { position: absolute; bottom: 20px; right: 20px; display: flex; flex-direction: column; align-items: center; }
#tombol-logout { display: block; margin-bottom: 10px; background-color: #c0392b; color: white; padding: 8px 15px; border-radius: 8px; font-size: 14px; text-decoration: none; text-align: center; transition: background-color 0.2s ease; }
#tombol-logout:hover { background-color: #e74c3c; }
#action-buttons button { padding: 15px 25px; font-family: 'Nunito', sans-serif; font-size: 17px; font-weight: 500; color: white; background-color: #27ae60; border: none; border-radius: 12px; box-shadow: 0 4px 6px rgba(0,0,0,0.2); cursor: pointer; transition: all 0.2s ease; }
#action-buttons button:hover { background-color: #2ecc71; transform: translateY(-2px); box-shadow: 0 6px 8px rgba(0,0,0,0.2); }
#action-buttons button:active { transform: translateY(1px); box-shadow: 0 2px 3px rgba(0,0,0,0.2); }
#tombol-mute { margin-top: 10px; background-color: #f39c12; width: 100px; height: 50px; padding: 0; border-radius: 50%; font-size: 22px; }
#tombol-mute:hover { background-color: #e67e22; }
#reward-popup { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0.5); background: linear-gradient(45deg, #f1c40f, #f39c12); color: white; padding: 30px 40px; border-radius: 20px; border: 4px solid white; box-shadow: 0 10px 30px rgba(0,0,0,0.4); text-align: center; font-size: 24px; font-weight: 700; text-shadow: 2px 2px 4px rgba(0,0,0,0.5); z-index: 100; opacity: 0; visibility: hidden; transition: all 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55); }
#reward-popup.show { opacity: 1; visibility: visible; transform: translate(-50%, -50%) scale(1); }

/* ======================================================= */
/* === BLOK BARU: GAYA RESPONSIVE UNTUK MOBILE === */
/* ======================================================= */
@media (max-width: 800px) {

    /* Atur ulang body untuk mobile */
    .game-body {
        display: block; 
    }

    /* Buat game container sesuai lebar layar */
    #game-container {
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        border: none;
        box-shadow: none;
    }

    /* Pindahkan dan sesuaikan ukuran HUD */
    #info-panel {
        width: 90%;
        left: 5%;
        top: 10px;
        padding: 8px;
        backdrop-filter: blur(5px);
    }
    .player-level { font-size: 16px; margin-bottom: 5px; }
    .xp-text { font-size: 11px; }
    .sensor-item { padding: 1px 0; font-size: 12px; }

    /* Sesuaikan ukuran dan posisi aset game dengan persentase */
    #petani {
        width: 40vw; /* Lebar relatif terhadap viewport */
        max-width: 200px; /* Batas atas ukuran petani */
        left: 10%;
        bottom: 5%;
    }

    .tanaman-bayam {
        width: 22vw; /* Lebar relatif */
        max-width: 100px;
        bottom: 0%;
    }
    #tanaman1 { left: 5%; }
    #tanaman2 { left: 38%; }
    #tanaman3 { left: 70%; }

    /* Sesuaikan tombol aksi */
    #action-buttons {
        bottom: 15px;
        right: 15px;
    }
    #action-buttons button { padding: 12px 20px; font-size: 15px; }
    #tombol-mute { width: 45px; height: 45px; font-size: 20px; }
    #tombol-logout { padding: 6px 12px; font-size: 12px; }

    /* Perkecil pop-up reward */
    #reward-popup { width: 80%; padding: 20px; font-size: 18px; }

    /* Penyesuaian untuk halaman auth di mobile */
    .auth-container {
        width: 85%;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        right: auto;
    }
    .splash-title { font-size: 12vw; }
}

