/* style.css - Final GitHub Dark Theme + Fixed Layout */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* GitHub Dark Dimmed Palette */
    --bg-app: #0d1117;       /* Main Background */
    --bg-panel: #161b22;     /* Sidebar/Cards */
    --bg-input: #010409;     /* Input fields */
    --border: #30363d;       /* Borders */
    
    --primary: #1f6feb;      /* Blue */
    --btn-primary: #238636;  /* Green Button */
    --btn-hover: #2ea043;
    
    --danger: #da3633;       /* Red */
    --danger-hover: #b62324;
    
    --text-main: #c9d1d9;    /* White/Grey */
    --text-muted: #8b949e;   /* Gray */
    
    --radius-lg: 12px;
    --radius-md: 8px;
    --radius-pill: 50px;
}

* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Helvetica, Arial, sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
    margin: 0;
    /* FIX: Allow scrolling by default for Admin/Dashboard */
    min-height: 100vh;
    overflow-y: auto; 
}

/* --- ROOM LAYOUT FIX --- */
/* This ensures ONLY the video room stays locked to the screen size */
.app-container {
    position: fixed; /* Force it to stay put */
    top: 0; 
    left: 0;
    width: 100%; 
    height: 100%; 
    overflow: hidden; /* Disable body scroll inside the room */
    display: flex;
}

/* ========================================= */
/*           SHARED UI COMPONENTS            */
/* ========================================= */

a { text-decoration: none; color: inherit; transition: color 0.2s; }
a:hover { color: var(--primary); }

/* Buttons */
.btn {
    padding: 10px 18px;
    border-radius: 6px;
    border: 1px solid rgba(240, 246, 252, 0.1);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-primary { background: var(--btn-primary); color: white; border-color: rgba(240, 246, 252, 0.1); }
.btn-primary:hover { background: var(--btn-hover); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-outline { background: var(--bg-panel); border-color: var(--border); color: var(--text-main); }
.btn-outline:hover { background: #21262d; border-color: #8b949e; }

/* Inputs */
.input-group { margin-bottom: 15px; width: 100%; }
.input-group label { display: block; margin-bottom: 6px; color: var(--text-muted); font-size: 0.85rem; }
.form-control {
    width: 100%; padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-main); font-size: 0.95rem; outline: none;
    transition: border 0.2s;
}
.form-control:focus { border-color: var(--primary); }

/* Generic Card */
.card {
    background: var(--bg-panel); border-radius: var(--radius-lg);
    padding: 24px; border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Scrollbars */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #6e7681; }

/* ========================================= */
/*            LOGIN & DASHBOARD              */
/* ========================================= */

.auth-wrapper {
    height: 100vh; display: flex; justify-content: center; align-items: center;
    background: var(--bg-app);
}
.auth-box { width: 100%; max-width: 380px; text-align: center; }
.brand-logo { color: var(--text-main); font-size: 3rem; margin-bottom: 20px; }

.nav-bar {
    background: var(--bg-panel); padding: 16px 32px;
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid var(--border);
}
.nav-logo { font-weight: 700; font-size: 1.1rem; color: var(--text-main); }
.user-info { display: flex; align-items: center; gap: 15px; font-size: 0.9rem; color: var(--text-muted); }

.container { max-width: 960px; margin: 40px auto; padding: 20px; }
.dash-header { text-align: center; margin-bottom: 40px; border-bottom: 1px solid var(--border); padding-bottom: 20px; }
.dash-header h2 { font-weight: 600; color: var(--text-main); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }

/* Admin Tables */
.table-responsive { overflow-x: auto; border: 1px solid var(--border); border-radius: 6px; }
.modern-table { width: 100%; border-collapse: collapse; background: var(--bg-input); }
.modern-table th { text-align: left; padding: 12px 16px; color: var(--text-muted); font-size: 0.85rem; border-bottom: 1px solid var(--border); background: var(--bg-panel); }
.modern-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.modern-table tr:last-child td { border-bottom: none; }
.status-badge { padding: 4px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: bold; }
.status-active { background: rgba(46, 213, 115, 0.15); color: #2ed573; }
.status-closed { background: rgba(255, 71, 87, 0.15); color: #ff4757; }

/* ========================================= */
/*            VIDEO ROOM LAYOUT              */
/* ========================================= */

.app-container { display: flex; width: 100%; height: 100vh; overflow: hidden; }

/* --- LEFT: VIDEO STAGE --- */
.stage-section {
    flex: 1; display: flex; flex-direction: column; position: relative;
    padding: 16px; gap: 16px; background: var(--bg-app);
    background-image: radial-gradient(#21262d 1px, transparent 1px);
    background-size: 30px 30px;
    min-width: 0;
}

/* SPOTLIGHT VIDEO */
.spotlight-wrapper {
    flex: 1;
    background: #010409;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden; position: relative;
    display: flex; justify-content: center; align-items: center;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
.spotlight-wrapper video { width: 100%; height: 100%; object-fit: contain; }

/* FLOATING CONTROLS */
.controls-floating {
    position: absolute; bottom: 170px; left: 50%; transform: translateX(-50%);
    background: #161b22;
    padding: 8px 12px; border-radius: var(--radius-pill);
    display: flex; gap: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 100;
}
.btn-ctrl {
    width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border);
    font-size: 1.1rem; cursor: pointer; background: #21262d; color: var(--text-main);
    display: flex; align-items: center; justify-content: center; transition: all 0.2s;
}
.btn-ctrl:hover { background: #30363d; border-color: #8b949e; }
.btn-ctrl.blue { color: #58a6ff; border-color: rgba(88, 166, 255, 0.3); }
.btn-ctrl.red { color: #f85149; border-color: rgba(248, 81, 73, 0.3); }

/* --- PARTICIPANTS STRIP (FIXED SIZE - FORCE) --- */
.participants-strip {
    height: 140px;
    min-height: 140px;
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 5px;
    width: 100%;
    
    /* IMPORTANT: Align items to the left, don't stretch them */
    justify-content: flex-start !important; 
}

.small-card {
    /* STRICT RULES: Do not grow, Do not shrink, Stay 240px */
    flex: 0 0 240px !important; 
    width: 240px !important;
    max-width: 240px !important;
    
    height: 100%;
    background: #010409;
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border);
}

/* Ensure video fills the 240px box exactly */
.small-card video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.name-tag {
    position: absolute; bottom: 8px; left: 8px;
    background: rgba(13, 17, 23, 0.85); border: 1px solid var(--border);
    padding: 4px 10px; border-radius: 6px; font-size: 0.8rem; font-weight: 600; color: var(--text-main);
}
.away-badge {
    position: absolute; top: 8px; right: 8px;
    background: var(--danger); color: white; padding: 4px 8px;
    border-radius: 4px; font-size: 0.75rem; font-weight: bold;
    display: none; animation: pulse 2s infinite;
}
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.6; } 100% { opacity: 1; } }


/* --- RIGHT: SIDEBAR --- */
.sidebar {
    width: 340px; background: var(--bg-panel);
    border-left: 1px solid var(--border);
    display: flex; flex-direction: column; z-index: 50;
}

/* CHAT */
.chat-container {
    flex: 1; display: flex; flex-direction: column; background: var(--bg-panel);
    min-height: 0;
}
.panel-header {
    padding: 16px; border-bottom: 1px solid var(--border);
    font-weight: 600; font-size: 0.9rem;
    display: flex; align-items: center; gap: 10px; color: var(--text-main); background: var(--bg-panel);
}
.chat-messages {
    flex: 1; padding: 16px; overflow-y: auto;
    display: flex; flex-direction: column; gap: 12px;
}
.message { max-width: 85%; display: flex; flex-direction: column; align-self: flex-start; }
.message .msg-sender { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 4px; margin-left: 4px; }
.message .msg-bubble {
    background: #21262d; border: 1px solid var(--border); color: var(--text-main);
    padding: 10px 14px; border-radius: 12px; border-top-left-radius: 2px;
    font-size: 0.95rem; line-height: 1.5;
}
.message.my-msg { align-self: flex-end; }
.message.my-msg .msg-bubble {
    background: #1f6feb; color: white; border-color: #1f6feb;
    border-radius: 12px; border-top-right-radius: 2px;
}
.chat-input {
    padding: 16px; background: var(--bg-panel); border-top: 1px solid var(--border);
    display: flex; gap: 10px;
}
.chat-input input {
    flex: 1; background: #0d1117; border: 1px solid var(--border);
    padding: 10px 16px; border-radius: 20px; color: var(--text-main); outline: none;
}
.chat-input input:focus { border-color: #58a6ff; }
.chat-input button {
    background: var(--btn-primary); border: 1px solid rgba(255,255,255,0.1);
    width: 38px; height: 38px; border-radius: 50%; color: white; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.chat-input button:hover { background: var(--btn-hover); }


/* REPORT AREA */
.report-container {
    height: 35%; display: flex; flex-direction: column; background: #0d1117; border-top: 1px solid var(--border);
}
.stats-list { flex: 1; overflow-y: auto; padding: 0; }
.stat-item {
    padding: 12px 16px; border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
}
.stat-name { font-weight: 600; font-size: 0.9rem; color: var(--text-main); display: block; }
.stat-join { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.stat-val { font-family: monospace; font-size: 0.95rem; font-weight: bold; color: #3fb950; }
.stat-val.bad { color: #f85149; }

/* Toast */
.toast-notification {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%) translateY(-50px);
    background: #238636; color: white; padding: 8px 16px;
    border-radius: 30px; font-weight: 600; font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3); opacity: 0; transition: all 0.3s; z-index: 999;
}
.toast-notification.show { transform: translateX(-50%) translateY(0); opacity: 1; }


/* ========================================= */
/*           RESPONSIVE (MOBILE)             */
/* ========================================= */

@media (max-width: 900px) {
    /* 1. ENABLE SCROLLING */
    body {
        overflow-y: auto;
        height: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    
    @media (max-width: 900px) {
    .participants-strip { height: 120px; min-height: 120px; }
    .small-card { 
        flex: 0 0 160px !important; 
        width: 160px !important; 
    }
}

    /* 2. STACK LAYOUT */
    .app-container {
        flex-direction: column;
        height: auto;
    }
    
    /* 3. VIDEO TOP (Fixed Height) */
    .stage-section {
        height: 60vh; 
        width: 100%;
        padding: 10px;
    }
    
    .controls-floating { bottom: 155px; }

    /* 4. STUDENTS STRIP (Always Visible) */
    .participants-strip {
        height: 120px;
        min-height: 120px;
    }
    
    /* On mobile, cards are slightly smaller */
    .small-card { width: 160px; } 
    
    /* 5. SIDEBAR BOTTOM */
    .sidebar {
        width: 100%;
        height: auto;
        border-left: none;
        border-top: 1px solid var(--border);
    }
    
    /* Fixed Heights for Content blocks to allow scrolling inside them */
    .chat-container {
        height: 400px;
        min-height: 400px;
    }
    .report-container {
        height: 300px;
        min-height: 300px;
    }
}

@media (max-width: 400px) {
    .stage-section { height: 50vh; }
    .controls-floating { bottom: 140px; }
}