:root { --primary-blue: #0ea5e9; --primary-cyan: #00f2ff; --bg-page: #f8fafc; --bg-surface: #ffffff; --text-main: #0f172a; --text-muted: #64748b; --border: #e2e8f0; --danger: #ef4444; }
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Montserrat', sans-serif; background: var(--bg-page); color: var(--text-main); margin:0; padding:0; overflow-x: hidden;}

/* GLOBAL GRAPHICS & GLASSMORPHISM */
.teacher-theme { background: linear-gradient(135deg, #e0f2fe, #bae6fd); position: relative; min-height: 100vh;}
.graphic-circle { position: fixed; width: 500px; height: 500px; border-radius: 50%; background: linear-gradient(135deg, rgba(14, 165, 233, 0.15), rgba(2, 132, 199, 0.05)); top: -100px; right: -100px; pointer-events: none; z-index: 0;}
.graphic-circle.small { width: 300px; height: 300px; bottom: 50px; left: -100px; z-index: 0;}

/* CUSTOM MODAL SYSTEM */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.7); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 9999; padding: 20px;}
.modal-card { background: white; padding: 30px; border-radius: 12px; max-width: 400px; width: 100%; text-align: center; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1); animation: popIn 0.3s ease-out; display:flex; flex-direction:column; align-items:center;}
.modal-card h3 { margin-bottom: 10px; color: var(--text-main); }
.modal-card p { font-size: 14px; color: var(--text-muted); margin-bottom: 25px; line-height: 1.5; }
.modern-input { width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 8px; font-family: inherit; font-size:14px; margin-top:5px; outline:none;}
.modern-input:focus { border-color: var(--primary-blue); }
.modal-actions { display: flex; gap: 10px; justify-content: center; width:100%;}
@keyframes popIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* AUTH */
.auth-wrapper { display: flex; height: 100vh; position: relative; z-index: 1;}
.auth-graphic-side { flex: 1; background: transparent; display: flex; flex-direction: column; justify-content: center; padding: 60px; }
.auth-graphic-side h2 { font-size: 3rem; color: var(--text-main); margin-bottom: 10px;}
.auth-graphic-side p { font-size: 1.2rem; color: var(--text-muted);}
.auth-form-side { flex: 1; background: rgba(255,255,255,0.8); backdrop-filter: blur(20px); display: flex; flex-direction: column; justify-content: center; padding: 80px; max-width: 500px; border-left: 1px solid rgba(255,255,255,0.5); }
.auth-logo { width: 150px; margin-bottom: 40px; }
.input-group { margin-bottom: 20px; width: 100%; }
.input-group label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 8px; color: var(--text-muted); text-transform: uppercase; }
.input-group input { width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 8px; font-family: inherit; outline:none;}

/* BUTTONS */
.btn-primary { padding: 12px 24px; background: var(--primary-blue); color: white; border: none; border-radius: 8px; font-weight: 700; cursor: pointer; transition: 0.2s; display:inline-block; text-align:center;}
.btn-primary:hover { background: #0284c7; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary { background: white; border: 1px solid var(--border); padding: 12px 24px; border-radius: 8px; font-weight: 600; cursor: pointer; color: var(--text-main); display:inline-block; text-align:center; transition: 0.2s;}
.btn-secondary:hover { background: #f8fafc; }
.btn-danger { background: white; border: 1px solid var(--danger); color: var(--danger); padding: 8px 16px; border-radius: 8px; font-weight: 600; cursor: pointer; transition: 0.2s; }
.btn-danger:hover { background: var(--danger); color: white; }
.btn-danger-text { background:none; border:none; color:var(--danger); font-size:16px; cursor:pointer; padding:0 5px; font-weight:bold; }
.btn-danger-text:hover { opacity:0.7; }
.action-group { display: flex; gap: 10px; flex-wrap: wrap;}

/* DASHBOARD */
.dashboard-layout { display: flex; height: 100vh; position: relative; z-index: 1; background: rgba(255,255,255,0.7); backdrop-filter: blur(20px);}
.sidebar { width: 260px; background: rgba(255,255,255,0.5); border-right: 1px solid rgba(0,0,0,0.05); display: flex; flex-direction: column; padding: 30px 20px; }
.sidebar-logo { width: 120px; margin-bottom: 40px; }
.sidebar-footer { margin-top: auto; border-top: 1px solid rgba(0,0,0,0.05); padding-top: 20px; }
.btn-text { background: none; border: none; color: var(--text-muted); font-weight: 600; cursor: pointer; }
.page-view { display: none; }
.page-view.active-page { display: flex; }
.nav-item { width: 100%; display: block; padding: 12px 15px; color: var(--text-muted); font-weight: 600; border-radius: 8px; margin-bottom: 5px; text-align: left; background: none; border: none; font-size: 14px; cursor: pointer; transition: 0.2s; }
.nav-item:hover { background: rgba(255,255,255,0.8); }
.nav-item.active { background: white; color: var(--primary-blue); box-shadow: 0 2px 4px rgba(0,0,0,0.02);}

/* WORKSPACE */
.main-workspace { flex: 1; flex-direction: column; padding: 40px; overflow-y: auto; }
.top-header { display: flex; justify-content: space-between; margin-bottom: 30px; align-items: center; flex-wrap: wrap; gap: 15px;}
.breadcrumb { font-size: 12px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; display: block; }
.studio-grid { display: grid; grid-template-columns: 1fr 380px; gap: 30px; align-items: start;}
.recording-card, .ai-card { background: white; border-radius: 16px; border: 1px solid var(--border); box-shadow: 0 10px 25px -5px rgba(0,0,0,0.05); display: flex; flex-direction: column; overflow: hidden;}
.card-header { padding: 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap:10px;}
.card-header.solid-bg { background: #f8fafc; }
.flex-align { display: flex; align-items: center; gap: 10px;}

/* FOLDERS & LIBRARY */
.library-layout { display: flex; gap: 30px; align-items: flex-start; }
.folder-sidebar { width: 220px; flex-shrink: 0; background: white; border-radius: 12px; padding: 20px; border: 1px solid var(--border); box-shadow: 0 4px 6px rgba(0,0,0,0.02);}
.folder-list { list-style: none; }
.folder-item { padding: 10px 15px; border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--text-muted); cursor: pointer; margin-bottom: 5px; transition: 0.2s; display:flex; justify-content:space-between; align-items:center; border:2px solid transparent;}
.folder-item:hover { background: #f1f5f9; }
.folder-item.active { background: var(--text-main); color: white; }
.folder-item.drag-over { background: #e2e8f0; border:2px dashed var(--primary-blue); color:var(--text-main); }
.lesson-title-edit { border: 1px solid transparent; background: transparent; font-size: 28px; font-weight: 700; color: var(--text-main); outline: none; margin-top: 5px; width: 100%; transition: 0.2s; border-radius: 4px; padding: 4px; }
.lesson-title-edit:focus { border-bottom: 2px solid var(--primary-blue); background: white; }
.lesson-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; align-items:start;}
.lesson-card { background: white; border: 1px solid var(--border); border-radius: 12px; padding: 20px; transition: transform 0.2s, box-shadow 0.2s; display: flex; flex-direction: column; cursor:grab; box-shadow: 0 4px 6px rgba(0,0,0,0.02);}
.lesson-card:active { cursor:grabbing; }
.lesson-card:hover { transform: translateY(-4px); box-shadow: 0 15px 25px -5px rgba(0,0,0,0.1); }
.lesson-card h4 { margin-bottom: 10px; color: var(--text-main); line-height: 1.3;}
.lesson-card p { font-size: 13px; color: var(--text-muted); margin-bottom: 15px; }
.card-actions { margin-top: auto; display: flex; gap: 10px; }
.stats-row { display:flex; justify-content:space-between; align-items:center; margin-bottom:15px; padding-bottom:10px; border-bottom:1px solid #f1f5f9; font-size:12px; font-weight:600; color:var(--text-muted); }

/* INBOX & SETTINGS */
.inbox-container { display: flex; flex-direction: column; gap: 15px; }
.message-card { background: white; border: 1px solid var(--border); border-radius: 12px; padding: 20px; display: flex; justify-content: space-between; align-items: flex-start; box-shadow: 0 4px 6px rgba(0,0,0,0.02);}
.message-card h5 { color: var(--primary-blue); margin-bottom: 5px; font-size: 16px; }
.message-card p { color: var(--text-main); font-size: 14px; margin-bottom: 10px; }
.message-context { font-size: 12px; color: var(--text-muted); background: #f8fafc; padding: 10px; border-radius: 6px; }
.settings-container { display:flex; flex-direction:column; gap:20px; }
.settings-card { background: white; border: 1px solid var(--border); border-radius: 12px; padding: 30px; box-shadow: 0 4px 6px rgba(0,0,0,0.02);}

/* MEDIA & UI */
.monitor-area { padding: 40px 20px; text-align: center; flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; background: #f8fafc; }
.video-container { width: 100%; max-width: 600px; margin-bottom: 20px; border-radius: 12px; overflow: hidden; box-shadow: 0 15px 30px -5px rgba(0,0,0,0.2); background: #000; }
#videoPreview { width: 100%; display: block; object-fit: cover; }
.time-display { font-size: 56px; font-weight: 300; font-variant-numeric: tabular-nums; color: var(--text-main); margin-top: 10px; }
.chapter-pill { background:var(--primary-blue); color:white; font-size:12px; font-weight:600; padding:6px 12px; border-radius:20px; box-shadow:0 2px 4px rgba(0,0,0,0.1);}
.controls-area { padding: 20px; text-align: center; border-top: 1px solid var(--border); background: white;}
.btn-record { background: var(--danger); color: white; border: none; padding: 16px 40px; border-radius: 50px; font-weight: 700; font-size: 16px; cursor: pointer; transition: 0.3s; box-shadow: 0 8px 15px rgba(239, 68, 68, 0.3); }
.btn-record:hover { transform: translateY(-2px); box-shadow: 0 12px 20px rgba(239, 68, 68, 0.4); }
.btn-record.active { background: var(--text-main); box-shadow: 0 8px 15px rgba(15, 23, 42, 0.3); }
.error-text { color: var(--danger); font-size: 13px; margin-top: 10px; font-weight: 600; }
.sound-wave-graphic { display: flex; gap: 4px; align-items: flex-end; height: 60px; margin: 20px 0; justify-content: center;}
.sound-wave-graphic .bar { width: 8px; background: var(--primary-blue); opacity: 0.7; border-radius: 4px; height: 10px; transition: height 0.05s ease; }
.toggle-label { font-size: 13px; font-weight: 600; color: var(--text-muted); margin-right: 12px; text-transform: uppercase; }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #cbd5e1; transition: .3s; }
.slider.round { border-radius: 34px; }
.slider.round:before { border-radius: 50%; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .3s; }
input:checked + .slider { background-color: var(--primary-blue); }
input:checked + .slider:before { transform: translateX(20px); }
.setting-group { margin-bottom: 15px; }
.setting-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; text-transform: uppercase; }
.modern-select { width: 100%; padding: 10px; border-radius: 8px; border: 1px solid var(--border); font-family: inherit; font-size: 14px; background: #f8fafc; outline:none;}
.modern-select:focus { border-color: var(--primary-blue); }
.ai-results-area { padding: 20px; flex: 1; background: #f8fafc; overflow-y: auto; max-height: 400px; }
.empty-state { text-align: center; color: var(--text-muted); font-size: 13px; padding: 40px 20px; }


/* =========================================
   PROFESSIONAL STUDENT LMS THEME
   ========================================= */
.student-theme { background: #0f172a; color: #f8fafc; height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.student-theme .graphic-circle { position: absolute; width: 600px; height: 600px; border-radius: 50%; background: radial-gradient(circle, rgba(14, 165, 233, 0.15) 0%, rgba(2, 132, 199, 0) 70%); top: -150px; right: -150px; z-index: 0; pointer-events:none;}
.student-theme .graphic-circle.small { width: 400px; height: 400px; bottom: -50px; left: -100px; pointer-events:none; z-index: 0;}
.student-workspace { position: relative; z-index: 1; width: 100%; max-width: 1400px; display: flex; gap:30px; padding: 30px; height:100vh; align-items:center; justify-content: center;}

/* MODIFIED FOR INNER-OVERLAYS */
.player-container { background: #1e293b; border-radius: 12px; overflow: hidden; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5); border: 1px solid #334155; flex:1; display:flex; flex-direction:column; position: relative; width: 100%;}
.sidebar-panel { width:320px; background: #1e293b; border-radius: 12px; border: 1px solid #334155; padding:25px; display:flex; flex-direction:column; gap:20px; overflow-y:auto; max-height:calc(100vh - 60px); box-shadow: 0 10px 25px -5px rgba(0,0,0,0.3); flex-shrink: 0;}
.main-video { width: 100%; display: block; background: #000; max-height: 65vh; object-fit: contain; }
.caption-display { background: #0f172a; border-top: 1px solid #334155; padding: 20px 30px; min-height: 140px; max-height: 200px; overflow-y: auto; position:relative; scroll-behavior: smooth;}
.caption-history-item { font-size: 16px; color: #64748b; margin-bottom:10px; line-height: 1.5; display: block;}
.caption-history-item.active { font-size: 22px; font-weight: 600; color: #f8fafc; }
.upcoming-toast { position:absolute; top: -45px; right:20px; background:var(--primary-cyan); color:#000; font-size:13px; font-weight:700; padding:8px 16px; border-radius:20px; opacity:0; transition:0.3s; transform:translateY(10px);}
.upcoming-toast.show { opacity:1; transform:translateY(0); }
.student-action-bar { background: #1e293b; padding: 20px 30px; display: flex; justify-content: space-between; align-items: center; border-top:1px solid #334155; flex-wrap: wrap; gap: 15px;}

/* Hardcoded to ensure perfect rendering */
.btn-raise-hand { background: #ef4444; color: #ffffff; border: none; padding: 12px 24px; border-radius: 8px; font-size: 15px; font-weight: 700; cursor: pointer; transition: all 0.2s ease; box-shadow: 0 4px 10px rgba(239, 68, 68, 0.4); text-align: center; }
.btn-raise-hand:hover { background: #dc2626; box-shadow: 0 6px 15px rgba(239, 68, 68, 0.6); transform: translateY(-2px); }

.full-page-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: #0f172a; display: none; flex-direction: column; align-items: center; justify-content: center; z-index: 100; padding: 20px;}
.interaction-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.85); backdrop-filter:blur(5px); display: none; flex-direction: column; align-items: center; justify-content: center; z-index: 10; border-radius: 12px; padding: 20px;}
.interaction-card { background: #1e293b; border-radius: 12px; padding: 40px; width: 100%; max-width: 500px; text-align: center; display: flex; flex-direction: column; color: #f8fafc; box-shadow: 0 20px 40px rgba(0,0,0,0.5); border: 1px solid #334155;}
.question-text { font-size: 22px; font-weight: 700; margin-bottom: 30px; color: #f8fafc; }
.options-grid { display: grid; gap: 15px; width: 100%; }
.option-btn { background: #0f172a; border: 1px solid #334155; color: #e2e8f0; padding: 15px; font-size: 16px; font-weight: 600; border-radius: 8px; cursor: pointer; transition: 0.2s; outline: none; }
.option-btn:hover { background: #334155; border-color: #475569; }
.option-btn.correct { background: #064e3b; border-color: #10b981; color: #34d399; }
.option-btn.wrong { background: #7f1d1d; border-color: #ef4444; color: #fca5a5; }
.resource-link { display:block; padding:12px; background:#0f172a; color:var(--primary-cyan); text-decoration:none; border-radius:8px; font-size:13px; font-weight:600; margin-bottom:10px; border:1px solid #334155; transition:0.2s; cursor:pointer;}
.resource-link:hover { background:#334155; }


/* =========================================
   MOBILE RESPONSIVENESS
   ========================================= */
@media (max-width: 900px) {
    /* Teacher Portal Mobile */
    .auth-wrapper { flex-direction: column; }
    .auth-graphic-side { padding: 40px 20px; text-align: center;}
    .auth-graphic-side h2 { font-size: 2rem; }
    .auth-form-side { padding: 40px 20px; border-left: none; border-top: 1px solid rgba(255,255,255,0.5); width: 100%; max-width: none;}
    
    .dashboard-layout { flex-direction: column; overflow-y: auto;}
    .sidebar { width: 100%; padding: 15px 20px; border-right: none; border-bottom: 1px solid rgba(0,0,0,0.05); flex-direction: row; flex-wrap: wrap; justify-content: space-between; align-items: center;}
    .sidebar-logo { width: 100px; margin-bottom: 0; }
    .sidebar-nav { display: flex; flex-direction: row; gap: 8px; width: 100%; overflow-x: auto; margin-top: 15px; padding-bottom: 5px;}
    .nav-item { width: auto; margin-bottom: 0; white-space: nowrap;}
    .sidebar-footer { display: none; } /* Hide signout on tiny screens or move to settings */
    
    .main-workspace { padding: 20px; overflow-y: visible;}
    .studio-grid { grid-template-columns: 1fr; gap: 20px; }
    
    .library-layout { flex-direction: column; }
    .folder-sidebar { width: 100%; padding: 15px;}
    .folder-list { display: flex; flex-direction: row; overflow-x: auto; gap: 10px; padding-bottom: 5px;}
    .folder-item { margin-bottom: 0; white-space: nowrap;}
    .desktop-only { display: none; }
    
    /* Student Portal Mobile */
    .student-workspace { flex-direction: column; padding: 15px; height: auto; align-items: stretch; justify-content: flex-start;}
    .sidebar-panel { width: 100%; max-height: none; }
    .btn-raise-hand { width: 100%; }
    .student-action-bar { flex-direction: column; align-items: flex-start; }
    
    .interaction-card { padding: 25px 20px; }
    .question-text { font-size: 18px; margin-bottom: 20px;}
    .option-btn { font-size: 14px; padding: 12px;}
}