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

:root {
    --bg-dark: #090d16;
    --bg-panel: rgba(15, 23, 42, 0.75);
    --glass-border: rgba(255, 255, 255, 0.12);
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --accent: #ec4899;
    --accent-hover: #db2777;
    --text-main: #f8fafc;
    --text-secondary: #94a3b8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Glassmorphism utility */
.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
}

.logo {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #a855f7, #ec4899, #6366f1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Auth Page Layout (Login & Register) */
.auth-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.5rem;
    background: radial-gradient(circle at top right, rgba(99, 102, 241, 0.15), transparent 40%),
                radial-gradient(circle at bottom left, rgba(236, 72, 153, 0.15), transparent 40%);
}

.auth-card {
    width: 100%;
    max-width: 440px;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.tab-container {
    display: flex;
    background: rgba(15, 23, 42, 0.6);
    border-radius: 10px;
    padding: 4px;
    border: 1px solid var(--glass-border);
    margin-bottom: 0.5rem;
}

.tab-btn {
    flex: 1;
    padding: 0.6rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Buttons */
.btn {
    padding: 0.7rem 1.4rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease-in-out;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
}

.btn-primary:hover {
    opacity: 0.92;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.18);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

/* Form inputs */
.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    background: rgba(15, 23, 42, 0.6);
    color: white;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

/* Dashboard Grid & Layout */
.dashboard-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1.5rem;
    width: 100%;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.class-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.class-card {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1rem;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-live {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.badge-active {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.badge-inactive {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.4);
}

/* Student Roster Table */
.roster-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.roster-table th, .roster-table td {
    padding: 0.8rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
    font-size: 0.88rem;
}

.roster-table th {
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

/* Classroom Fullscreen UI */
.classroom-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: #030712;
}

.classroom-topbar {
    height: 56px;
    padding: 0 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(15, 23, 42, 0.9);
}

.classroom-main {
    flex: 1 1 auto;
    display: flex;
    overflow: hidden;
    position: relative;
    min-height: 0;
}

.video-section {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    position: relative;
    padding: 0.75rem;
    overflow: hidden;
    min-height: 0;
    width: 100%;
}

.video-grid {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 1rem;
    align-items: center;
    justify-content: center;
    min-height: 0;
    width: 100%;
}

/* Student Spotlight Mode (Instructor 100% Full Screen) */
.video-grid.student-spotlight-mode {
    display: flex !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    padding: 0 !important;
}

.instructor-spotlight-card {
    flex: 1 1 auto !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: 100% !important;
    border-radius: 12px !important;
}

.instructor-spotlight-card video {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
}

.video-card {
    background: #0b0f19;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--glass-border);
    aspect-ratio: 16/9;
}

.video-card video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.video-overlay-name {
    position: absolute;
    bottom: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.65);
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    color: white;
    backdrop-filter: blur(4px);
}

.avatar-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    color: white;
}

/* Interactive Controls Toolbar */
.classroom-controls {
    height: 65px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    border-top: 1px solid var(--glass-border);
    background: rgba(15, 23, 42, 0.95);
    z-index: 20;
}

.control-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.15rem;
    transition: all 0.2s;
    text-decoration: none;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.control-btn.active-off {
    background: var(--danger);
}

/* Sidebar Chat Panel */
.sidebar-panel {
    width: 320px;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--glass-border);
    border-radius: 0;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(16px);
    transition: transform 0.3s ease-in-out, width 0.3s ease-in-out;
}

.sidebar-panel.collapsed {
    display: none !important;
}

.chat-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.chat-bubble {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.7rem 0.9rem;
    border-radius: 8px;
    font-size: 0.85rem;
}

.chat-bubble .sender {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.2rem;
    font-size: 0.75rem;
}

/* Interactive Whiteboard Canvas Container */
.whiteboard-container {
    position: absolute;
    top: 1rem;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    background: #ffffff;
    border-radius: 12px;
    display: none;
    flex-direction: column;
    z-index: 10;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.whiteboard-container.active {
    display: flex;
}

.whiteboard-toolbar {
    background: #0f172a;
    padding: 0.6rem 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

canvas#whiteboardCanvas {
    flex: 1;
    cursor: crosshair;
}

/* Android Mobile Screen UX Optimizations (< 768px) */
@media (max-width: 768px) {
    .classroom-topbar {
        padding: 0 0.8rem;
        height: 48px;
    }

    .classroom-topbar h3 {
        font-size: 0.95rem;
    }

    .video-section {
        padding: 0.2rem !important;
    }

    .sidebar-panel {
        position: fixed !important;
        top: 0;
        right: 0;
        bottom: 0;
        width: 85% !important;
        max-width: 340px !important;
        z-index: 100 !important;
        transform: translateX(100%);
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.7);
    }

    .sidebar-panel.mobile-open {
        transform: translateX(0) !important;
    }

    .classroom-controls {
        height: 58px;
        gap: 0.5rem;
    }

    .control-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
}

/* Floating Overlay Controls in Pure Fullscreen Mode */
.fullscreen-floating-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: none;
    gap: 12px;
    z-index: 9999;
}

/* Hide Top Bar, Bottom Toolbar & In-Class Chat completely in Fullscreen Mode across Windows PC & Android */
.classroom-container:fullscreen .classroom-topbar,
.classroom-container:-webkit-full-screen .classroom-topbar,
.classroom-container.fullscreen-active .classroom-topbar,
.classroom-container:fullscreen .classroom-controls,
.classroom-container:-webkit-full-screen .classroom-controls,
.classroom-container.fullscreen-active .classroom-controls,
.classroom-container:fullscreen .sidebar-panel,
.classroom-container:-webkit-full-screen .sidebar-panel,
.classroom-container.fullscreen-active .sidebar-panel {
    display: none !important;
}

/* Optional Overlay Chat drawer in Fullscreen Mode */
.classroom-container:fullscreen .sidebar-panel.fullscreen-chat-open,
.classroom-container:-webkit-full-screen .sidebar-panel.fullscreen-chat-open,
.classroom-container.fullscreen-active .sidebar-panel.fullscreen-chat-open {
    display: flex !important;
    position: fixed !important;
    top: 0;
    right: 0;
    bottom: 0;
    width: 340px !important;
    z-index: 10000 !important;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.8);
    transform: none !important;
}

/* In Fullscreen Mode, Video Section & Video Card fill 100vw and 100vh Edge-to-Edge */
.classroom-container:fullscreen .classroom-main,
.classroom-container:-webkit-full-screen .classroom-main,
.classroom-container.fullscreen-active .classroom-main {
    height: 100vh !important;
}

.classroom-container:fullscreen .video-section,
.classroom-container:-webkit-full-screen .video-section,
.classroom-container.fullscreen-active .video-section {
    padding: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
}

.classroom-container:fullscreen .video-card,
.classroom-container:-webkit-full-screen .video-card,
.classroom-container.fullscreen-active .video-card {
    border-radius: 0 !important;
    border: none !important;
    height: 100vh !important;
    max-height: 100vh !important;
}

.classroom-container:fullscreen .fullscreen-floating-controls,
.classroom-container:-webkit-full-screen .fullscreen-floating-controls,
.classroom-container.fullscreen-active .fullscreen-floating-controls {
    display: flex !important;
}
