/* --- 1. THEME VARIABLES (Fresh & Professional) --- */
:root {
    --brand: #ffd60a;       /* Electric Yellow */
    --accent: #2563eb;      /* Messenger Blue */
    --danger: #ef4444;      /* Soft Red */
    --dark-bg: #0f172a;     /* Deep Navy (For Video Area) */
    --light-bg: #ffffff;    /* Pure White (For Chat) */
    --text-main: #1e293b;
    --shadow: 0 4px 20px rgba(0,0,0,0.15);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; -webkit-tap-highlight-color: transparent; }

body {
    background: var(--dark-bg); /* Dark background makes video pop */
    color: white;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* --- 2. HEADER (Floating) --- */
.brand-header {
    position: absolute; top: 20px; left: 20px; z-index: 50;
    display: flex; align-items: center; gap: 10px; pointer-events: none;
}
/* --- LOGO DESIGN --- */
.logo {
    font-weight: 900; 
    font-size: 1.4rem; 
    color: white;
    letter-spacing: -0.5px;
    display: flex; 
    align-items: center; 
    gap: 8px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
    text-decoration: none; /* Removes underline if it's a link */
}

/* The Yellow Circle behind the Bolt */
.logo-icon { 
    color: #111; /* Dark bolt */
    background: var(--brand); /* Electric Yellow background */
    width: 35px; 
    height: 35px;
    display: flex; 
    align-items: center; 
    justify-content: center;
    border-radius: 50%; /* Makes it a perfect circle */
    font-size: 1.2rem;
    box-shadow: 0 0 15px rgba(255, 214, 10, 0.6); /* Glowing Yellow Effect */
}

/* --- 3. MAIN LAYOUT --- */
#main-container { display: flex; height: 100%; width: 100%; }

/* --- 4. VIDEO AREA (CINEMA MODE) --- */
#video-section {
    flex: 1;
    position: relative;
    background: black;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#video-grid {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    gap: 10px; /* Small gap between videos */
    padding: 10px;
}

/* THE MAGIC: Maximize Video Size */
.video-wrapper {
    flex: 1; /* Grow to fill space */
    height: 100%;
    max-height: 90vh; /* Keep some space */
    position: relative;
    background: #222;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

video {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Zoom to fill (No Black Bars) */
    transform: scaleX(-1); /* Mirror effect */
}

/* Floating Labels (You/Stranger) */
.video-label {
    position: absolute; bottom: 15px; left: 15px;
    background: rgba(0,0,0,0.6); color: white;
    padding: 6px 14px; border-radius: 20px;
    font-size: 0.85rem; font-weight: 600;
    backdrop-filter: blur(4px); z-index: 10;
}

/* --- 5. CONTROLS (Floating Overlay) --- */
.controls {
    position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%);
    display: flex; align-items: center; gap: 15px; 
    z-index: 3000; /* FORCE ON TOP */
    background: rgba(0,0,0,0.3); /* Glass effect behind buttons */
    padding: 10px 20px; border-radius: 40px;
    backdrop-filter: blur(10px);
}

.icon-btn {
    width: 45px; height: 45px; border-radius: 50%; border: none;
    background: rgba(255,255,255,0.2); color: white;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: 0.2s;
}
.icon-btn:hover { background: white; color: black; }
.warning:hover { background: var(--danger); color: white; }

.pill-btn {
    height: 50px; padding: 0 35px; border-radius: 25px; border: none;
    background: var(--accent); color: white;
    font-size: 1rem; font-weight: 700;
    display: flex; align-items: center; gap: 8px; cursor: pointer;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
    transition: transform 0.2s;
}
.pill-btn:hover { transform: scale(1.05); background: #1d4ed8; }
.pill-btn:active { transform: scale(0.95); }

/* --- 6. CHAT SECTION (Clean Light Theme) --- */
#chat-section {
    width: 380px; background: var(--light-bg);
    display: flex; flex-direction: column;
    border-left: 1px solid #e2e8f0;
}

.chat-header {
    padding: 18px 25px; border-bottom: 1px solid #f1f5f9;
    color: var(--text-main); font-weight: 700; font-size: 1.1rem;
    display: flex; justify-content: space-between; align-items: center;
}
.close-icon { color: #94a3b8; cursor: pointer; }

#message-container {
    flex: 1; overflow-y: auto; padding: 20px;
    display: flex; flex-direction: column; gap: 10px;
    background: #f8fafc;
}

.message {
    padding: 10px 16px; border-radius: 18px; font-size: 0.95rem;
    max-width: 85%; line-height: 1.5; word-wrap: break-word;
}
.you {
    background: var(--accent); color: white;
    align-self: flex-end; border-bottom-right-radius: 4px;
}
.stranger {
    background: white; color: var(--text-main);
    align-self: flex-start; border-bottom-left-radius: 4px;
    border: 1px solid #e2e8f0;
}

#send-container {
    padding: 20px; background: white;
    border-top: 1px solid #f1f5f9; display: flex; gap: 10px;
}
#message-input {
    flex: 1; background: #f1f5f9; border: none;
    padding: 12px 20px; border-radius: 25px; font-size: 1rem; outline: none;
}
#send-btn {
    width: 45px; height: 45px; border-radius: 50%;
    background: var(--accent); color: white; border: none;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: 0.2s;
}
#send-btn:hover { transform: rotate(-10deg) scale(1.1); }

/* --- 7. MOBILE RESPONSIVE --- */
.mobile-only { display: none; }

@media (max-width: 900px) {
    #main-container { flex-direction: column; }
    
    /* Stack videos vertically on phone */
    #video-grid { flex-direction: column; padding: 0; gap: 2px; }
    
    .video-wrapper {
        width: 100%;
        height: 50%; /* Each video takes exactly half */
        border-radius: 0; /* Remove corners for edge-to-edge look */
    }

    /* Move buttons up slightly */
    .controls { bottom: 20px; width: 90%; justify-content: space-between; padding: 10px 20px; }
    .pill-btn { flex: 1; justify-content: center; }
    .mobile-only { display: flex; }

    /* Hidden Chat Drawer */
    #chat-section {
        position: fixed; bottom: 0; left: 0; width: 100%; height: 80vh;
        border-radius: 25px 25px 0 0; 
        z-index: 4000; /* Higher than controls */
        transform: translateY(110%); /* Hidden by default */
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 -10px 40px rgba(0,0,0,0.2);
    }
    
    /* THE MISSING PART THAT FIXES IT: */
    #chat-section.active { 
        transform: translateY(0); /* Slide up when active class is added */
    }
}

/* --- 8. PRO NOTIFICATIONS (Toasts) --- */
#toast-container {
    position: fixed;
    top: 80px; /* Below header */
    left: 50%;
    transform: translateX(-50%);
    z-index: 5000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none; /* Let clicks pass through */
}

.toast {
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideDown 0.3s ease-out;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.1);
}

.toast.info { border-left: 4px solid var(--accent); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.success { border-left: 4px solid var(--brand); }

@keyframes slideDown {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* --- PERMISSION BLOCKED OVERLAY --- */
#permission-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: #0f172a; z-index: 9999;
    display: none; /* Hidden by default */
    flex-direction: column; justify-content: center; align-items: center;
    text-align: center; padding: 20px;
}
#permission-overlay h2 { margin-bottom: 10px; color: var(--brand); }
#permission-overlay p { color: #cbd5e1; max-width: 400px; margin-bottom: 20px; line-height: 1.6; }