:root {
    /* === Warna Sidebar (Tetap Gelap Hijau) === */
    --bg-sidebar: #0d2218;
    --primary: #10ac84;
    --primary-glow: rgba(16, 172, 132, 0.4);
    --accent: #55efc4;

    /* === Warna Konten Utama (Terang) === */
    --bg-main: #f2f7f4;
    --bg-darker: #ffffff;
    --text-main: #1a2e22;
    --text-dim: #5a7a68;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(16, 172, 132, 0.15);
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);

    /* Warna Badge Kesulitan */
    --color-easy: #10ac84;
    --color-normal: #27ae60;
    --color-hard: #c0392b;
    --color-danger: #e63946;

    /* Tipografi */
    --font-main: 'Outfit', sans-serif;

    /* Tema Admin */
    --indigo: #283095;
    --border-light: #e8ebf3;
    --text-dark: #333d47;
    --text-muted: #8292a2;
}

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

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-main);
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Layout */
.dashboard {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
    transition: grid-template-columns 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.dashboard.compact-sidebar { grid-template-columns: 80px 1fr; }
.dashboard.sidebar-hidden  { grid-template-columns: 1fr; }

/* ============================================
   SIDEBAR — Hijau Tua
============================================ */
.sidebar {
    background: linear-gradient(180deg, #0f523f 0%, #063124 100%);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    border-right: none;
    gap: 0.5rem;
    overflow-x: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.12);
}
.dashboard.sidebar-hidden .sidebar { display: none; }

/* Compact Sidebar */
.sidebar.compact { padding: 1.5rem 0.5rem; align-items: center; }
.sidebar.compact .sidebar-profile-info,
.sidebar.compact .nav-label,
.sidebar.compact .nav-text,
.sidebar.compact .submenu { display: none; }
.sidebar.compact .sidebar-profile { padding: 0.5rem; justify-content: center; }
.sidebar.compact .nav-link {
    justify-content: center;
    padding: 1rem 0;
    width: 50px; height: 50px;
    margin: 0 auto;
    position: relative;
}
.sidebar.compact .nav-link:hover::after {
    content: attr(data-label);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%; transform: translateY(-50%);
    background: rgba(16, 172, 132, 0.95);
    color: white; font-size: 0.75rem; font-weight: 600;
    padding: 5px 10px; border-radius: 8px;
    white-space: nowrap; pointer-events: none;
    z-index: 9999; backdrop-filter: blur(10px);
}
.sidebar.compact .logo { padding: 0 !important; display: flex; justify-content: center; }

/* Nav Labels */
.nav-label {
    padding: 2rem 1.5rem 0.8rem;
    font-size: 0.62rem; font-weight: 800;
    text-transform: uppercase; letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.5);
}

/* Nav Links */
.nav-link {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 20px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none; font-weight: 500; font-size: 0.88rem;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    border-radius: 0 8px 8px 0;
}
.nav-link i { width: 20px; text-align: center; font-size: 1rem; opacity: 0.8; flex-shrink: 0; }
.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-left-color: rgba(255, 255, 255, 0.5);
}
.nav-link.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-weight: 700;
    border-left-color: white;
}

/* Submenu */
.submenu { padding-left: 1.5rem; display: flex; flex-direction: column; gap: 0.3rem; margin-top: 0.3rem; }
.submenu-link { font-size: 0.85rem; padding: 0.6rem 1rem; border-left: 1px solid rgba(255,255,255,0.1); border-radius: 0 10px 10px 0; }
.submenu-link:hover, .submenu-link.active { background: rgba(16, 172, 132, 0.12); color: var(--accent); border-left-color: var(--primary); }

/* ============================================
   KONTEN UTAMA — Terang
============================================ */
.main-content {
    display: flex;
    flex-direction: column;
    background: var(--bg-main);
}

/* Tombol */
.btn {
    padding: 12px 24px; border-radius: 12px; border: none; cursor: pointer;
    font-weight: 600; font-family: var(--font-main);
    text-transform: uppercase; letter-spacing: 1px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: #0d9070; transform: translateY(-1px); box-shadow: 0 8px 20px rgba(16, 172, 132, 0.35); }
.btn-glass {
    background: rgba(255, 255, 255, 0.7);
    color: var(--text-main);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(8px);
}
.btn-glass:hover { background: rgba(255, 255, 255, 0.9); border-color: var(--primary); }

/* Badge */
.badge { padding: 4px 10px; border-radius: 8px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; color: white; }
.badge-easy   { background: var(--color-easy); }
.badge-normal { background: var(--color-normal); }
.badge-hard   { background: var(--color-hard); }

/* Kotak Info & Search */
.stats-card {
    background: var(--glass-bg);
    padding: 8px 16px; border-radius: 10px; font-size: 0.9rem;
    border: 1px solid var(--glass-border);
    color: var(--text-main);
}
.search-box {
    background: var(--glass-bg); border: 1px solid var(--glass-border);
    padding: 0.8rem 1.5rem; border-radius: 12px;
    color: var(--text-main); width: 300px; transition: 0.3s;
}
.search-box:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(16,172,132,0.1); }
.search-box::placeholder { color: var(--text-dim); }

/* Kontainer Halaman & Game Stage */
.page-container {
    flex: 1; padding: 1.5rem;
    display: flex; justify-content: center; align-items: flex-start;
}
.dashboard.sidebar-hidden .page-container { padding: 0; }

.game-stage {
    background: var(--bg-darker);
    border-radius: 20px;
    width: 100%; max-width: 1000px;
    min-height: calc(100vh - 3rem);
    box-shadow: var(--shadow);
    border: 1px solid var(--glass-border);
    position: relative; overflow: hidden;
    display: flex; flex-direction: column;
    transition: all 0.4s ease;
}
.dashboard.sidebar-hidden .game-stage {
    max-width: 100%; min-height: 100vh;
    border-radius: 0; border: none;
}

/* ============================================
   Tema Admin (Indigo + Putih — tidak berubah)
============================================ */
.admin-theme {
    --bg-main: #f8fafc;
    --text-main: var(--text-dark);
    --glass-bg: rgba(255, 255, 255, 0.9);
    --glass-border: #e8ebf3;
}
.admin-theme .sidebar {
    box-shadow: 4px 0 24px rgba(0,0,0,0.15);
}
.admin-theme .main-content { background: #f8fafc; }
.admin-theme .game-stage { border-radius: 0; border: none; box-shadow: none; min-height: 100vh; background: transparent; max-width: 100%; }
.admin-theme .page-container { padding: 0; align-items: stretch; }

/* Kartu & Tabel Admin */
.worksuite-card {
    background: white; border-radius: 12px;
    border: 1px solid var(--border-light);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    overflow: hidden;
}
.worksuite-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.worksuite-table th {
    background: #fcfcfd; padding: 1rem 1.5rem;
    color: var(--text-muted); font-weight: 600;
    text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-light);
}
.worksuite-table td { padding: 0.75rem 1.5rem; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
.worksuite-table tr:hover { background: #f9fafb; }

.avatar-preview { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 2px solid white; box-shadow: 0 0 0 1px var(--border-light); }

.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.status-online  { background: #22c55e; }
.status-offline { background: #94a3b8; }

.action-btn-circle {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; transition: 0.2s;
    color: var(--text-muted); cursor: pointer;
    border: none; background: transparent;
}
.action-btn-circle:hover { background: #eee; color: var(--text-dark); }

/* Tab & Filter Bar Admin */
.filter-bar { display: flex; align-items: center; gap: 1rem; padding: 1rem 0; margin-bottom: 1rem; border-bottom: 1px solid var(--border-light); }
.admin-tabs { display: flex; gap: 2rem; margin-bottom: 1.5rem; border-bottom: 1px solid var(--border-light); }
.admin-tab-item {
    padding: 0.8rem 0; font-size: 0.8rem; font-weight: 700;
    color: var(--text-muted); cursor: pointer;
    position: relative; text-transform: uppercase; letter-spacing: 0.5px;
    transition: color 0.2s;
}
.admin-tab-item:hover { color: var(--indigo); }
.admin-tab-item.active { color: var(--indigo); }
.admin-tab-item.active::after {
    content: ''; position: absolute; bottom: -1px; left: 0;
    width: 100%; height: 2px;
    background: var(--indigo); border-radius: 2px 2px 0 0;
}

/* Utilities */
@keyframes spin {
    to { transform: rotate(360deg); }
}
.spinner {
    display: inline-block;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.premium-save-btn {
    width: 38px; height: 38px;
    background: #f8fafc; border: 1px solid #e2e8f0;
    cursor: pointer; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
}
.premium-save-btn:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 6px 14px rgba(0,0,0,0.08);
    background: white;
}

/* Menyembunyikan Mobile Header di layar laptop (PC) */
.mobile-only-header { display: none !important; }

/* ============================================
   RESPONSIVE (MOBILE VIEW / HP)
============================================ */
@media (max-width: 768px) {
    /* Tampilkan kembali Mobile Header jika layar sempit */
    .mobile-only-header { display: flex !important; }

    /* Layout Utama Menjadi Tumpukan (Stack) Satu Kolom */
    .dashboard {
        grid-template-columns: 1fr !important;
        display: flex;
        flex-direction: column;
    }

    /* Modifikasi Sidebar Menjadi Off-Canvas (Geser dari kiri) */
    .sidebar {
        position: fixed;
        left: -300px; /* Tersembunyi di luar layar */
        top: 0;
        bottom: 0;
        width: 280px;
        z-index: 99999;
        transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        padding: 2rem 1.5rem;
    }
    
    /* Mengaktifkan kemunculan sidebar dari JS */
    .sidebar.mobile-open {
        left: 0;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
    }

    /* Tombol Teks Profil Sidebar Disembunyikan (Biar tidak aneh) */
    .sidebar-profile {
        flex-direction: column;
        text-align: center;
    }

    /* Penyesuaian Ruang Konten Utama */
    .page-container {
        padding: 1rem 0.5rem;
    }

    /* Halaman Beranda (Welcome) */
    div[style*="grid-template-columns: repeat(3, 1fr)"] {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }

    h1[style*="font-size: 3.5rem"] {
        font-size: 2.2rem !important;
        margin-bottom: 2rem !important;
    }

    /* Permainan Tebak/Cari/Puzzle */
    .game-stage {
        border-radius: 12px;
        min-height: calc(100vh - 4rem);
    }
    
    /* Tombol Kembali / Header Internal Game */
    div[style*="padding: 1rem 1.5rem; border-bottom: 1px"] {
        padding: 1rem !important;
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.5rem;
    }
    .stats-card {
        width: 100%;
        text-align: center;
    }

    /* Tabel Dasbor Admin */
    .worksuite-card {
        padding: 1rem !important;
        border-radius: 8px;
    }
    .worksuite-table {
        min-width: 600px; /* Memaksa scroll horizontal jika isi terlalu panjang */
    }
    .table-responsive-wrapper {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Grid Form Kahoot Admin */
    form div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    /* Layar Utama & Pemain Kahoot */
    .kahoot-host-answers {
        grid-template-columns: 1fr !important;
        grid-template-rows: repeat(4, 1fr) !important;
        height: auto !important;
    }
    .kahoot-player-grid {
        grid-template-columns: 1fr !important;
        grid-template-rows: repeat(4, 1fr) !important;
    }
}
