/* =========================================================
   RDA LIVE ROOM - PREMIUM WEBINAR / MEETING UI
   Modern Dark Slate Theme (Absolute Viewport Lock)
========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg-main: #020617;         
    --bg-panel: #0f172a;        
    --bg-chat: #0b1121;         
    --text-primary: #f8fafc;
    --text-muted: #94a3b8;
    --accent-blue: #3b82f6;
    --accent-hover: #2563eb;
    --danger-red: #ef4444;
    --border-color: #1e293b;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* --- 1. STRICT FULL-SCREEN APP LAYOUT (NO VH/DVH USED) --- */
html, body.rda-live-body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    
    /* 🚀 THE ULTIMATE FIX: Pinned exactly to the 4 corners of the screen */
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; 
    margin: 0;
    padding: 0;
}

.rda-app-container {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
}

/* --- 2. VIDEO SECTION --- */
.rda-video-section {
    flex: 0 0 auto; /* Won't grow or shrink */
    position: relative;
    width: 100%;
    background-color: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    aspect-ratio: 16 / 9;
    max-height: 35%; /* Based on container percentage now */
    z-index: 10;
}

.rda-video-container {
    width: 100%;
    height: 100%;
    position: relative;
}

#rdaPlayerFrame {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0; left: 0;
}

#rdaPlayerFrame iframe {
    width: 100%;
    height: 100%;
    border: none;
    pointer-events: none; 
}

/* --- 3. BADGES --- */
.rda-top-badges {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    z-index: 10;
    pointer-events: none;
}

.rda-badge {
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #fff;
    border: 1px solid rgba(255,255,255,0.1);
}

.rda-live-badge {
    background: rgba(220, 38, 38, 0.85);
    border-color: rgba(220, 38, 38, 0.5);
    animation: livePulse 2s infinite;
}

.rda-dot {
    width: 6px;
    height: 6px;
    background: #fff;
    border-radius: 50%;
}

@keyframes livePulse {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

/* --- 4. SCREENS (Countdown / Ended) --- */
.rda-countdown-screen, .rda-ended-screen {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--bg-panel), var(--bg-main));
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 5;
}

.rda-timer {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--accent-blue);
    margin: 10px 0;
}

.rda-countdown-title { font-size: 0.9rem; color: var(--text-muted); }
.rda-course-wait-name { font-size: 0.9rem; color: #fff; margin-top: 10px; font-weight: 500; }

/* --- 5. CONTENT SECTION --- */
.rda-content-section {
    flex: 1 1 0; /* Takes all remaining space */
    min-height: 0; /* Prevents overflow */
    display: flex;
    flex-direction: column;
    background: var(--bg-panel);
}

.rda-class-info {
    flex: 0 0 auto;
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
}

.rda-class-title {
    margin: 0 0 6px 0;
    font-size: 1rem;
    font-weight: 600;
}

.rda-class-meta {
    display: flex;
    flex-wrap: wrap;
    column-gap: 12px;
    row-gap: 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.rda-class-meta strong { color: var(--text-primary); }

/* --- 6. CHAT INTERFACE --- */
.rda-chat-section {
    flex: 1 1 0; 
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-chat);
}

.rda-chat-header {
    flex: 0 0 auto;
    padding: 8px 15px;
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-muted);
}

.rda-chat-messages {
    flex: 1 1 0; /* Scrollable area */
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rda-announcement {
    background: rgba(59, 130, 246, 0.1);
    border-left: 3px solid var(--accent-blue);
    padding: 10px;
    border-radius: 0 6px 6px 0;
    font-size: 0.8rem;
    line-height: 1.4;
    color: #e2e8f0;
}

.rda-chat-msg {
    background: var(--bg-panel);
    padding: 10px 12px;
    border-radius: 10px;
    border-top-left-radius: 2px;
    font-size: 0.85rem;
    align-self: flex-start;
    max-width: 85%;
    line-height: 1.4;
    border: 1px solid var(--border-color);
}

.rda-chat-msg.mine {
    background: var(--accent-blue);
    color: #fff;
    border-color: var(--accent-blue);
    align-self: flex-end;
    border-top-left-radius: 10px;
    border-top-right-radius: 2px;
}

.rda-chat-input-area {
    flex: 0 0 auto;
    display: flex;
    padding: 10px 15px;
    background: var(--bg-panel);
    border-top: 1px solid var(--border-color);
    gap: 10px;
}

#rdaChatInput {
    flex: 1;
    background: var(--bg-chat);
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 10px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    outline: none;
}
#rdaChatInput:focus { border-color: var(--accent-blue); }

#rdaSendChat {
    background: var(--accent-blue);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 0 15px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
}

/* =========================================================
   7. BOTTOM CONTROLS (BULLETPROOF PLACEMENT) 
========================================================= */
.rda-bottom-controls {
    flex: 0 0 auto; /* Never shrink, never grow, exact size */
    display: flex;
    justify-content: space-evenly; 
    align-items: center;
    width: 100%;
    background: var(--bg-panel);
    border-top: 1px solid var(--border-color);
    padding: 12px 10px;
    z-index: 20;
}

.rda-control-btn {
    background: transparent;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    width: 70px;
    gap: 4px;
}

.rda-control-btn .icon {
    width: 42px;
    height: 42px;
    border-radius: 50%; 
    background: #1e293b;
    color: #f8fafc;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.1rem;
    transition: 0.2s;
}

.rda-control-btn .label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
}

.rda-control-btn:active .icon { background: #334155; }
.rda-leave-btn .icon { background: rgba(239, 68, 68, 0.15); color: var(--danger-red); }
.rda-leave-btn:active .icon { background: var(--danger-red); color: #fff; }

/* --- 8. REACTIONS --- */
#rdaReactionsContainer {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 50px;
    height: 250px;
    pointer-events: none;
    z-index: 100;
}

.rda-reaction {
    position: absolute;
    bottom: 0;
    font-size: 1.6rem;
    animation: floatUp 2.5s ease-out forwards;
}
@keyframes floatUp {
    0% { transform: translateY(0) scale(0.5); opacity: 0; }
    20% { transform: translateY(-30px) scale(1.2); opacity: 1; }
    80% { transform: translateY(-150px) scale(1); opacity: 0.8; }
    100% { transform: translateY(-200px) scale(0.8); opacity: 0; }
}

/* --- 9. DESKTOP / LAPTOP LAYOUT --- */
@media (min-width: 992px) {
    .rda-app-container {
        flex-direction: row;
        flex-wrap: wrap;
    }
    .rda-video-section {
        width: 70%;
        height: calc(100% - 80px); 
        max-height: none;
    }
    .rda-content-section {
        width: 30%;
        height: calc(100% - 80px);
        border-left: 1px solid var(--border-color);
    }
    .rda-class-info { order: -1; padding: 20px; }

    .rda-bottom-controls {
        width: 100%;
        height: 80px;
        padding: 0 30px;
        justify-content: flex-start;
        gap: 15px;
    }
    .rda-leave-btn {
        margin-left: auto; 
        flex-direction: row;
        background: rgba(239, 68, 68, 0.1);
        border: 1px solid rgba(239, 68, 68, 0.3);
        padding: 0 20px;
        height: 40px;
        border-radius: 20px;
        width: auto;
    }
    .rda-leave-btn .icon {
        background: transparent;
        width: auto; height: auto;
        color: var(--danger-red);
    }
}