/* BYD LIBRARY – LIVE CLASS SYSTEM Stylesheet */

:root {
  --navy: #0A2540; --navy2: #0d2d4d; --navy3: #051528;
  --gold: #D4AF37; --gold2: #f0cc5a; --gold3: #b8971f;
  --white: #ffffff; --off: #f8f9fc;
  --text: #1a2e42; --muted: #64748b; --border: #e2e8f0;
  --red: #e63946; --redLight: #fee; --green: #10b981;
  --shadow: 0 4px 24px rgba(10,37,64,0.10);
  --shadow2: 0 8px 40px rgba(10,37,64,0.16);
  --radius: 14px;
  --font: 'Poppins','Inter',sans-serif;
  --trans: all 0.35s cubic-bezier(0.4,0,0.2,1);
}

*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
body { font-family: var(--font); color: var(--text); background: var(--off); line-height: 1.6; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; outline: none; }
img, video { max-width: 100%; display: block; }

/* HEADER */
.live-header {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy2) 100%);
  color: white; padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: var(--shadow); position: sticky; top: 0; z-index: 100;
}
.live-header-logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.2rem; letter-spacing: 0.5px; }
.live-header-logo .logo-byd {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold2) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 900;
}
.live-header-logo .logo-text { color: white; font-weight: 500; }
.live-header-logo .live-tag {
  background: var(--red); color: white; padding: 2px 8px; border-radius: 4px;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 1px; margin-left: 8px;
  animation: livePulse 2s infinite;
}
@keyframes livePulse { 0%,100%{opacity:1;} 50%{opacity:0.6;} }
.live-header-user { display: flex; align-items: center; gap: 12px; font-size: 0.9rem; }
.user-chip { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,0.08); padding: 6px 12px; border-radius: 20px; border: 1px solid rgba(212,175,55,0.3); }
.user-chip .avatar { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, var(--gold) 0%, var(--gold3) 100%); display: flex; align-items: center; justify-content: center; color: var(--navy); font-weight: 700; font-size: 0.85rem; }
.btn-logout { background: transparent; border: 1px solid rgba(255,255,255,0.3); color: white; padding: 6px 14px; border-radius: 20px; font-size: 0.85rem; transition: var(--trans); }
.btn-logout:hover { background: rgba(255,255,255,0.1); border-color: var(--gold); }

/* AUTH SCREEN */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: radial-gradient(ellipse at top, rgba(212,175,55,0.15) 0%, transparent 50%), linear-gradient(135deg, var(--navy3) 0%, var(--navy) 60%, var(--navy2) 100%);
  position: relative; overflow: hidden;
}
.auth-wrap::before {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(circle at 20% 80%, rgba(212,175,55,0.08) 0%, transparent 50%), radial-gradient(circle at 80% 20%, rgba(212,175,55,0.05) 0%, transparent 50%);
  pointer-events: none;
}
.auth-card { background: white; border-radius: 20px; box-shadow: 0 30px 80px rgba(0,0,0,0.4); padding: 40px 36px; width: 100%; max-width: 440px; position: relative; z-index: 1; border-top: 4px solid var(--gold); }
.auth-logo { text-align: center; margin-bottom: 8px; }
.auth-logo .logo-byd { font-size: 2.4rem; font-weight: 900; background: linear-gradient(135deg, var(--gold) 0%, var(--gold3) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; letter-spacing: 1px; }
.auth-logo .logo-text { font-size: 2.4rem; font-weight: 300; color: var(--navy); margin-left: 6px; }
.auth-tagline { text-align: center; color: var(--muted); font-size: 0.9rem; margin-bottom: 28px; letter-spacing: 0.5px; }
.auth-tabs { display: flex; background: var(--off); border-radius: 10px; padding: 4px; margin-bottom: 24px; border: 1px solid var(--border); }
.auth-tab { flex: 1; background: transparent; padding: 10px; border-radius: 8px; font-weight: 600; font-size: 0.9rem; color: var(--muted); transition: var(--trans); }
.auth-tab.active { background: var(--navy); color: white; box-shadow: 0 4px 12px rgba(10,37,64,0.2); }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 0.82rem; font-weight: 600; color: var(--navy); letter-spacing: 0.3px; }
.form-group input, .form-group select, .form-group textarea {
  padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 10px; font-size: 0.95rem; font-family: inherit; transition: var(--trans); background: var(--off);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--gold); background: white; box-shadow: 0 0 0 3px rgba(212,175,55,0.15); }
.btn-primary-gold {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold3) 100%);
  color: var(--navy); padding: 14px; border-radius: 10px; font-weight: 700; font-size: 1rem; letter-spacing: 0.5px; transition: var(--trans); box-shadow: 0 6px 20px rgba(212,175,55,0.3);
}
.btn-primary-gold:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(212,175,55,0.45); }
.btn-primary-gold:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-google { display: flex; align-items: center; justify-content: center; gap: 10px; background: white; border: 1.5px solid var(--border); padding: 12px; border-radius: 10px; font-weight: 600; color: var(--text); transition: var(--trans); }
.btn-google:hover { border-color: var(--navy); background: var(--off); }
.btn-google img { width: 20px; height: 20px; }
.auth-divider { text-align: center; position: relative; margin: 8px 0; color: var(--muted); font-size: 0.85rem; }
.auth-divider::before, .auth-divider::after { content: ''; position: absolute; top: 50%; width: 35%; height: 1px; background: var(--border); }
.auth-divider::before { left: 0; }
.auth-divider::after { right: 0; }
.auth-error { background: var(--redLight); color: var(--red); padding: 10px 14px; border-radius: 8px; font-size: 0.85rem; border-left: 3px solid var(--red); display: none; }
.auth-error.show { display: block; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 0.85rem; color: var(--muted); }
.auth-footer a { color: var(--navy); font-weight: 600; }

/* LIVE STREAM */
.live-layout { display: grid; grid-template-columns: 1fr 360px; gap: 16px; padding: 16px; max-width: 1500px; margin: 0 auto; }
@media (max-width: 1024px) { .live-layout { grid-template-columns: 1fr; } }
.live-main { background: white; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.video-wrap { position: relative; width: 100%; aspect-ratio: 16/9; background: #000; overflow: hidden; }
.video-wrap iframe { width: 100%; height: 100%; border: 0; }
.no-stream { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; color: white; text-align: center; padding: 20px; background: linear-gradient(135deg, var(--navy3), var(--navy)); }
.no-stream .icon { font-size: 3rem; color: var(--gold); margin-bottom: 12px; opacity: 0.6; }
.no-stream h3 { font-size: 1.4rem; margin-bottom: 8px; }
.no-stream p { color: rgba(255,255,255,0.7); max-width: 400px; }
.live-info { padding: 20px 24px; border-top: 1px solid var(--border); }
.live-info-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 10px; }
.live-status-row { display: flex; align-items: center; gap: 10px; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 0 rgba(230,57,70,0.7); animation: liveDot 1.6s infinite; }
@keyframes liveDot { 0%{box-shadow: 0 0 0 0 rgba(230,57,70,0.7);} 70%{box-shadow: 0 0 0 12px rgba(230,57,70,0);} 100%{box-shadow: 0 0 0 0 rgba(230,57,70,0);} }
.live-status-row.offline .live-dot { background: var(--muted); animation: none; box-shadow: none; }
.status-text { text-transform: uppercase; font-size: 0.78rem; font-weight: 700; letter-spacing: 1px; color: var(--red); }
.live-status-row.offline .status-text { color: var(--muted); }
.viewer-count { display: flex; align-items: center; gap: 6px; background: var(--off); padding: 6px 12px; border-radius: 20px; font-size: 0.85rem; font-weight: 600; color: var(--navy); }
.viewer-count i { color: var(--red); }
.live-title { font-size: 1.5rem; font-weight: 700; color: var(--navy); margin-bottom: 6px; }
.live-meta { color: var(--muted); font-size: 0.9rem; display: flex; flex-wrap: wrap; gap: 16px; }
.live-meta span i { color: var(--gold); margin-right: 4px; }

/* DOUBT / Q&A */
.live-side { display: flex; flex-direction: column; gap: 16px; max-height: calc(100vh - 100px); }
.side-card { background: white; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.side-card-head { background: var(--navy); color: white; padding: 14px 18px; font-weight: 700; font-size: 0.95rem; display: flex; align-items: center; justify-content: space-between; }
.side-card-head .badge { background: var(--gold); color: var(--navy); padding: 2px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 800; }
.side-card-body { padding: 16px; overflow-y: auto; flex: 1; max-height: 400px; }
.doubt-form { padding: 14px 16px; border-top: 1px solid var(--border); background: var(--off); }
.doubt-form textarea { width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 8px; resize: none; font-family: inherit; font-size: 0.9rem; min-height: 60px; }
.doubt-form button { margin-top: 8px; width: 100%; background: var(--navy); color: white; padding: 10px; border-radius: 8px; font-weight: 600; transition: var(--trans); }
.doubt-form button:hover { background: var(--navy2); }
.doubt-item { background: var(--off); border-left: 3px solid var(--gold); padding: 10px 12px; border-radius: 6px; margin-bottom: 10px; font-size: 0.88rem; }
.doubt-item.answered { border-left-color: var(--green); opacity: 0.7; }
.doubt-meta { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--muted); margin-bottom: 4px; }
.doubt-status { background: var(--gold); color: var(--navy); padding: 1px 8px; border-radius: 10px; font-weight: 700; }
.doubt-status.answered { background: var(--green); color: white; }

/* ADMIN */
.admin-shell { display: grid; grid-template-columns: 240px 1fr; min-height: calc(100vh - 60px); }
@media (max-width: 768px) { .admin-shell { grid-template-columns: 1fr; } }
.admin-side { background: var(--navy); color: white; padding: 20px 0; border-right: 3px solid var(--gold); }
.admin-side-link { display: flex; align-items: center; gap: 12px; padding: 12px 24px; color: rgba(255,255,255,0.75); font-weight: 500; transition: var(--trans); border-left: 3px solid transparent; cursor: pointer; }
.admin-side-link i { width: 18px; color: var(--gold); }
.admin-side-link:hover { background: rgba(255,255,255,0.05); color: white; }
.admin-side-link.active { background: rgba(212,175,55,0.1); color: var(--gold); border-left-color: var(--gold); }
.admin-main { padding: 28px; background: var(--off); }
.admin-card { background: white; border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; margin-bottom: 20px; }
.admin-card h2 { color: var(--navy); font-size: 1.3rem; margin-bottom: 6px; display: flex; align-items: center; gap: 10px; }
.admin-card h2 i { color: var(--gold); }
.admin-card .subtitle { color: var(--muted); font-size: 0.9rem; margin-bottom: 20px; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-tile { background: linear-gradient(135deg, white, var(--off)); border-radius: 12px; padding: 18px; border-left: 4px solid var(--gold); box-shadow: var(--shadow); }
.stat-tile .num { font-size: 1.8rem; font-weight: 800; color: var(--navy); line-height: 1; }
.stat-tile .lbl { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 4px; font-weight: 600; }

/* TABLES */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.tbl th { background: var(--navy); color: white; padding: 10px 14px; text-align: left; font-weight: 600; font-size: 0.82rem; letter-spacing: 0.4px; text-transform: uppercase; }
table.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--border); }
table.tbl tr:hover td { background: var(--off); }
.role-pill { padding: 3px 10px; border-radius: 12px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; }
.role-superadmin { background: var(--gold); color: var(--navy); }
.role-admin { background: #fef3c7; color: #92400e; }
.role-faculty { background: #dbeafe; color: #1e3a8a; }
.role-student { background: #d1fae5; color: #065f46; }

.btn-sm { padding: 6px 12px; border-radius: 6px; font-size: 0.82rem; font-weight: 600; transition: var(--trans); }
.btn-go-live { background: var(--red); color: white; }
.btn-end-live { background: var(--muted); color: white; }
.btn-edit { background: var(--navy); color: white; }
.btn-delete { background: var(--red); color: white; }
.btn-toggle { background: var(--gold); color: var(--navy); }

/* TOAST */
.byd-toast { position: fixed; bottom: 30px; left: 50%; transform: translate(-50%, 100px); background: var(--navy); color: white; padding: 12px 24px; border-radius: 30px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); font-size: 0.9rem; font-weight: 500; z-index: 99999; transition: transform 0.3s ease; max-width: 90vw; }
.byd-toast.show { transform: translate(-50%, 0); }
.byd-toast-success { border-left: 4px solid var(--green); }
.byd-toast-error { border-left: 4px solid var(--red); }

/* MODAL */
.modal-back { position: fixed; inset: 0; background: rgba(10,37,64,0.6); display: flex; align-items: center; justify-content: center; z-index: 9000; padding: 20px; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from {opacity:0;} to {opacity:1;} }
.modal-box { background: white; border-radius: 16px; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; box-shadow: 0 30px 80px rgba(0,0,0,0.3); border-top: 4px solid var(--gold); }
.modal-head { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { color: var(--navy); font-size: 1.15rem; }
.modal-close { background: var(--off); border-radius: 50%; width: 32px; height: 32px; font-size: 1.1rem; color: var(--muted); }
.modal-body { padding: 22px 24px; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* SESSIONS */
.session-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.session-card { background: white; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); transition: var(--trans); border: 1px solid var(--border); }
.session-card:hover { transform: translateY(-4px); box-shadow: var(--shadow2); border-color: var(--gold); }
.session-card .thumb { aspect-ratio: 16/9; background: var(--navy); position: relative; overflow: hidden; }
.session-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.session-card .thumb .play-icon { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 50px; height: 50px; background: rgba(212,175,55,0.95); color: var(--navy); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.session-card .info { padding: 14px; }
.session-card .subj-tag { display: inline-block; background: var(--off); color: var(--navy); padding: 3px 10px; border-radius: 12px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.3px; text-transform: uppercase; margin-bottom: 6px; }
.session-card .ttl { font-weight: 700; color: var(--navy); font-size: 0.95rem; margin-bottom: 6px; line-height: 1.3; }
.session-card .meta { font-size: 0.78rem; color: var(--muted); display: flex; justify-content: space-between; }

/* SPINNER */
.spinner { border: 3px solid var(--off); border-top: 3px solid var(--gold); border-radius: 50%; width: 36px; height: 36px; animation: spin 1s linear infinite; margin: 30px auto; }
@keyframes spin { 0%{transform:rotate(0deg);} 100%{transform:rotate(360deg);} }
.empty-state { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty-state i { font-size: 2.5rem; color: var(--gold); margin-bottom: 12px; opacity: 0.6; }
.empty-state h4 { color: var(--navy); margin-bottom: 6px; }

/* FALLBACK */
.fallback-player { position: relative; width: 100%; aspect-ratio: 16/9; }
.fallback-label { position: absolute; top: 14px; left: 14px; background: rgba(0,0,0,0.7); color: var(--gold); padding: 4px 10px; border-radius: 6px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.5px; z-index: 2; }
