/* vn-chat/lobby.css */

:root {
    --primary-color: #ff6b6b;
    --secondary-color: #4ecdc4;
    --dark-bg: #1a1a2e;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --text-color: #ffffff;
}

/* [EDIT 1] BODY & HTML */
/* Kita kunci body agar tidak ikut scroll, biar background diam */
body,
html {
    margin: 0;
    padding: 0;
    height: 100vh; /* Ubah 100% jadi 100vh */
    width: 100vw;
    font-family: 'Nunito', sans-serif;
    background-color: var(--dark-bg);
    color: var(--text-color);
    overflow: hidden; /* Matikan scroll di body utama */
}

.lobby-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, #FF6B6B, #556270);
    z-index: -1;
    opacity: 0.8;
}

/* [EDIT 2] LOBBY CONTAINER */
/* Scroll dipindahkan ke sini agar tombol back tetap melayang */
.lobby-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    
    height: 100vh;      /* Paksa tinggi layar penuh */
    overflow-y: auto;   /* Izinkan scroll vertikal DI SINI */
    overflow-x: hidden; /* Sembunyikan scroll horizontal */
    
    display: flex;
    flex-direction: column;
    align-items: center;

    scrollbar-width: none;  
    -ms-overflow-style: none;
}

/* --- KODE DI BAWAH INI TIDAK ADA YANG DIHAPUS (SESUAI ORIGINAL) --- */

.lobby-header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.8s ease-out;
}

.lobby-header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.lobby-header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Grid Layout */
.character-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    width: 100%;
    padding-bottom: 4rem;
}

/* Character Card */
.char-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    position: relative;
    animation: fadeInUp 0.6s ease-out backwards;
}

.char-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
    border-color: var(--primary-color);
}

.char-image-wrapper {
    height: 350px;
    overflow: hidden;
    position: relative;
    background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.5));
}

.char-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    transition: transform 0.5s ease;
}

.char-card:hover .char-image {
    transform: scale(1.05);
}

.char-info {
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.4);
}

.char-name {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0 0 0.5rem 0;
    color: var(--primary-color);
}

.char-desc {
    font-size: 0.95rem;
    line-height: 1.5;
    opacity: 0.9;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.status-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #4cd137;
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.locked {
    filter: grayscale(1);
    cursor: not-allowed;
    opacity: 0.7;
}

.locked:hover {
    transform: none;
    box-shadow: none;
}

/* Buttons */
.btn-home {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid white;
    color: white;
    padding: 10px 20px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
    margin-top: auto;
}

.btn-home:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- GAYA POP-UP MODAL --- */

.overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.overlay.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}

.modal-box {
    background: white;
    padding: 25px;
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-title {
    margin: 0 0 10px;
    color: #2d3436;
    font-size: 1.5rem;
}

.modal-desc {
    color: #636e72;
    margin-bottom: 20px;
}

.mode-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.mode-btn {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-align: left;
}

.mode-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.mode-btn .icon { font-size: 2rem; }
.mode-btn .text { display: flex; flex-direction: column; }
.mode-btn strong { font-size: 1.1rem; display: block; margin-bottom: 3px; }
.mode-btn small { font-size: 0.85rem; opacity: 0.8; }

/* Warna Tombol */
.free-mode {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    color: #444;
}

.story-mode {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-cancel {
    background: transparent;
    border: none;
    color: #b2bec3;
    margin-top: 20px;
    cursor: pointer;
    font-weight: bold;
}
.btn-cancel:hover { color: #636e72; }

/* --- TOMBOL NAVIGASI BARU --- */

.floating-back-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 45px;
    height: 45px;
    background: rgba(0, 0, 0, 0.4); 
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.floating-back-btn:hover {
    background: rgba(255, 107, 107, 0.8);
    color: white;
    transform: scale(1.15) rotate(-10deg);
    box-shadow: 0 6px 15px rgba(255, 107, 107, 0.5);
    border-color: #fff;
}

@media (max-width: 600px) {
    .floating-back-btn {
        top: 15px; left: 15px; width: 40px; height: 40px; font-size: 1rem;
    }
}

.change-mode-pill {
    margin-top: 15px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #fff;
    padding: 8px 20px;
    border-radius: 50px;
    font-family: inherit;
    font-weight: bold;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    backdrop-filter: blur(4px);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.change-mode-pill:hover {
    background: white;
    color: var(--dark-bg);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* --- PILL BACK BTN (Biar seragam) --- */
.pill-back-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 100;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    padding: 10px 20px;
    border-radius: 30px;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.pill-back-btn:hover {
    background: var(--primary-color);
    border-color: rgba(255, 255, 255, 0.8);
    transform: translateX(-5px);
    box-shadow: 0 6px 12px rgba(255, 107, 107, 0.4);
}

@media (max-width: 600px) {
    .pill-back-btn {
        top: 15px; left: 15px; padding: 8px 16px; font-size: 0.85rem;
    }
}

/* --- STYLING BRIEFING MODAL (Tambahan Baru) --- */
.briefing-box {
    background: #1e1e2f;
    width: 90%;
    max-width: 800px;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255,255,255,0.1);
}

.briefing-content {
    display: flex;
    flex-wrap: wrap;
    height: 100%;
}

.briefing-left {
    flex: 1;
    min-width: 300px;
    background: #151525;
    padding: 20px;
    text-align: center;
    border-right: 1px solid rgba(255,255,255,0.05);
}

.briefing-img-wrapper {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin: 0 auto 15px;
    overflow: hidden;
    border: 3px solid #667eea;
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.5);
}

.briefing-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#briefing-name { color: white; margin: 0 0 5px; font-size: 1.5rem; }
#briefing-desc { color: #aaa; font-size: 0.9rem; line-height: 1.4; margin-bottom: 15px; }

.mission-badge {
    background: rgba(255, 193, 7, 0.1);
    color: #ffc107;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.briefing-right {
    flex: 1.5;
    min-width: 300px;
    padding: 20px;
    background: #1e1e2f;
}

.briefing-right h3 {
    color: white;
    margin-top: 0;
    border-bottom: 2px solid #333;
    padding-bottom: 10px;
}

.chapter-scroll {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 5px;
}

.chapter-item {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.05);
    margin-bottom: 10px;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.chapter-item:hover {
    background: rgba(255,255,255,0.1);
    transform: translateX(5px);
}

.chapter-item.locked {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(0,0,0,0.2);
}

.chapter-info { flex: 1; }
.chapter-title { display: block; color: white; font-weight: bold; font-size: 0.95rem; }
.chapter-desc { font-size: 0.8rem; color: #888; }

.chapter-status { font-size: 1.2rem; margin-left: 10px; }

.close-icon {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    z-index: 10;
}

@media (max-width: 600px) {
    .briefing-content { flex-direction: column; }
    .briefing-left { border-right: none; border-bottom: 1px solid rgba(255,255,255,0.1); }
    .briefing-box { width: 95%; max-height: 90vh; overflow-y: auto; }
}

/* Sembunyikan scrollbar di area chapter list & profil */
.briefing-left, 
.briefing-right, 
.chapter-scroll {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.briefing-left::-webkit-scrollbar, 
.briefing-right::-webkit-scrollbar, 
.chapter-scroll::-webkit-scrollbar {
    display: none;
}

/* --- GLOBAL LOADING OVERLAY --- */
.loading-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(255, 255, 255, 0.9); /* Latar putih transparan */
    z-index: 9999; /* Paling depan */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #e0e0e0;
    border-top: 5px solid var(--primary-color, #667eea);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

.loading-text {
    font-family: 'Inter', sans-serif;
    color: #555;
    font-weight: 600;
    letter-spacing: 1px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

