/* PrimezStudy — shared styles */
:root{
  --bg:#0B0D10;
  --panel:#14171C;
  --panel-2:#1B1F26;
  --line:#262B33;
  --text:#EDEFF2;
  --text-muted:#8A919C;
  --accent:#FFB35A;
  --accent-2:#FF8A5A;
  --live:#FF4D4D;
  --good:#4ADE80;
  --font-display:'Fraunces', serif;
  --font-body:'Inter', sans-serif;
  --font-mono:'JetBrains Mono', monospace;
  --radius:14px;
}
*{box-sizing:border-box;}
html,body{margin:0;padding:0;}
body{
  background:var(--bg); color:var(--text);
  font-family:var(--font-body);
  -webkit-font-smoothing:antialiased;
}
a{color:inherit;}
button,input,textarea,select{font-family:inherit; color:inherit;}
h1,h2,h3,h4{font-family:var(--font-display); font-weight:600; margin:0;}
::selection{background:var(--accent); color:#1a1200;}

/* ---------- Topbar ---------- */
.topbar{
  display:flex; align-items:center; justify-content:space-between;
  padding:16px 28px; border-bottom:1px solid var(--line);
  position:sticky; top:0; background:rgba(11,13,16,.9); backdrop-filter:blur(8px);
  z-index:50;
}
.brand{display:flex; align-items:center; gap:10px; font-family:var(--font-display); font-weight:600; font-size:19px;}
.brand-mark svg{width:26px; height:26px; display:block;}
.topbar-right{display:flex; align-items:center; gap:14px;}
.btn-ghost{
  background:transparent; border:1px solid var(--line); color:var(--text);
  padding:8px 14px; border-radius:10px; font-size:14px; cursor:pointer;
  text-decoration:none; transition:.15s;
}
.btn-ghost:hover{border-color:var(--accent); color:var(--accent);}
.user-chip{display:flex; align-items:center; gap:8px; font-size:14px; color:var(--text-muted);}
.user-chip img{width:26px; height:26px; border-radius:50%; background:var(--panel-2); object-fit:cover;}

/* ---------- Buttons / form basics ---------- */
.btn-primary{
  background:var(--accent); color:#241300; border:none; font-weight:600;
  padding:11px 18px; border-radius:10px; cursor:pointer; font-size:14.5px;
  transition:.15s; text-decoration:none; display:inline-block;
}
.btn-primary:hover{background:var(--accent-2);}
.btn-primary:disabled{opacity:.5; cursor:not-allowed;}
.btn-danger{
  background:#3A1414; color:#FF8A8A; border:1px solid #5A1F1F;
  padding:11px 18px; border-radius:10px; cursor:pointer; font-weight:600; font-size:14.5px;
}
.btn-danger:hover{background:#4A1818;}
.field{margin-bottom:14px; display:flex; flex-direction:column; gap:6px;}
.field label{font-size:13px; color:var(--text-muted);}
.field input, .field textarea{
  background:var(--panel-2); border:1px solid var(--line); color:var(--text);
  padding:11px 12px; border-radius:10px; font-size:14.5px; outline:none;
}
.field input:focus, .field textarea:focus{border-color:var(--accent);}
.form-msg{font-size:13.5px; color:var(--text-muted); min-height:18px; margin:6px 0;}
.form-msg.error{color:#FF8A8A;}
.form-msg.ok{color:var(--good);}

/* ---------- Auth page ---------- */
.auth-shell{display:grid; grid-template-columns:1.1fr 1fr; min-height:100vh;}
.auth-visual{
  position:relative; background:radial-gradient(circle at 30% 30%, #1A1400, var(--bg) 60%);
  display:flex; flex-direction:column; justify-content:center; padding:60px; overflow:hidden;
}
.rings{position:absolute; top:50%; left:10%; transform:translateY(-50%); width:640px; height:640px; opacity:.5;}
.rings circle{fill:none; stroke:#3A2A10; stroke-width:1;}
.rings .live{stroke:var(--accent); stroke-dasharray:6 10; animation:spin 40s linear infinite;}
.rings .live.rev{animation-direction:reverse; animation-duration:60s; opacity:.6;}
@keyframes spin{to{transform:rotate(360deg);}}
.auth-copy{position:relative; max-width:480px;}
.eyebrow{display:flex; align-items:center; gap:8px; color:var(--accent); font-family:var(--font-mono); font-size:12.5px; letter-spacing:.04em; text-transform:uppercase; margin-bottom:18px;}
.eyebrow .dot{width:7px; height:7px; border-radius:50%; background:var(--good); box-shadow:0 0 0 4px rgba(74,222,128,.15);}
.auth-copy h1{font-size:40px; line-height:1.15; margin-bottom:16px;}
.auth-copy p{color:var(--text-muted); font-size:15.5px; line-height:1.6;}
.auth-foot{position:relative; display:flex; gap:26px; margin-top:44px; flex-wrap:wrap;}
.auth-foot div{display:flex; flex-direction:column; gap:2px; font-size:13px; color:var(--text-muted);}
.auth-foot b{color:var(--text); font-family:var(--font-display); font-size:15px;}
.auth-form-side{display:flex; align-items:center; justify-content:center; padding:40px;}
.auth-card{width:100%; max-width:380px;}
.auth-card .brand{margin-bottom:28px;}
.tab-switch{display:flex; background:var(--panel-2); border-radius:10px; padding:4px; margin-bottom:20px;}
.tab-switch button{
  flex:1; background:transparent; border:none; padding:9px; border-radius:8px;
  color:var(--text-muted); cursor:pointer; font-weight:600; font-size:14px;
}
.tab-switch button.active{background:var(--accent); color:#241300;}
.divider{text-align:center; color:var(--text-muted); font-size:11.5px; letter-spacing:.06em; margin:18px 0; position:relative;}
.divider::before,.divider::after{content:""; position:absolute; top:50%; width:38%; height:1px; background:var(--line);}
.divider::before{left:0;} .divider::after{right:0;}
.btn-google{
  width:100%; display:flex; align-items:center; justify-content:center; gap:10px;
  background:#fff; color:#1a1a1a; border:none; padding:11px; border-radius:10px;
  font-weight:600; cursor:pointer; font-size:14.5px;
}
.btn-google svg{width:18px; height:18px;}
.fine-print{font-size:12px; color:var(--text-muted); margin-top:18px; line-height:1.5;}
.auth-note{font-size:12.5px; color:var(--text-muted); margin-top:10px;}

/* ---------- Page shell / dashboard ---------- */
.page-shell{max-width:1180px; margin:0 auto; padding:36px 28px 80px;}
.page-head{display:flex; justify-content:space-between; align-items:flex-end; margin-bottom:30px; gap:16px; flex-wrap:wrap;}
.page-head h1{font-size:30px;}
.page-head p{color:var(--text-muted); margin-top:6px; font-size:14.5px;}
.section-label{font-family:var(--font-mono); font-size:12px; letter-spacing:.08em; text-transform:uppercase; color:var(--text-muted); margin:30px 0 14px;}
.class-grid{display:grid; grid-template-columns:repeat(auto-fill, minmax(280px,1fr)); gap:16px;}
.skeleton{height:170px; border-radius:var(--radius); background:linear-gradient(100deg, var(--panel) 30%, var(--panel-2) 50%, var(--panel) 70%); background-size:200% 100%; animation:shimmer 1.4s infinite;}
@keyframes shimmer{to{background-position:-200% 0;}}
.class-card{
  background:var(--panel); border:1px solid var(--line); border-radius:var(--radius);
  padding:18px; display:flex; flex-direction:column; gap:10px; text-decoration:none; color:var(--text);
  transition:.15s;
}
.class-card:hover{border-color:var(--accent);}
.class-card h3{font-size:17px;}
.class-card .instr{color:var(--text-muted); font-size:13.5px;}
.class-card .meta-row{display:flex; justify-content:space-between; align-items:center; margin-top:auto; font-size:12.5px; color:var(--text-muted);}
.empty-note{color:var(--text-muted); font-size:14px; padding:20px 0;}

.badge{display:inline-flex; align-items:center; gap:6px; font-family:var(--font-mono); font-size:11.5px; text-transform:uppercase; letter-spacing:.05em; padding:4px 10px; border-radius:20px; width:fit-content;}
.badge.scheduled{background:var(--panel-2); color:var(--text-muted); border:1px solid var(--line);}
.badge.live{background:rgba(255,77,77,.12); color:var(--live); border:1px solid rgba(255,77,77,.3);}
.badge.live::before{content:""; width:6px; height:6px; border-radius:50%; background:var(--live); animation:pulse 1.4s infinite;}
.badge.ended{background:rgba(74,222,128,.08); color:var(--good); border:1px solid rgba(74,222,128,.25);}
@keyframes pulse{50%{opacity:.3;}}

/* ---------- Player (class.html) ---------- */
.player-shell{max-width:1180px; margin:0 auto; padding:26px 28px 80px;}
.player-top{color:var(--text-muted); font-size:13.5px; margin-bottom:16px;}
.player-top a{text-decoration:none; color:var(--text-muted);}
.player-top a:hover{color:var(--accent);}
.player-grid{display:grid; grid-template-columns:1fr 300px; gap:22px;}
.video-wrap{
  aspect-ratio:16/9; background:#000; border-radius:var(--radius); overflow:hidden;
  position:relative; border:1px solid var(--line);
}
.video-wrap video{width:100%; height:100%; object-fit:contain; background:#000;}
.video-placeholder{
  position:absolute; inset:0; display:flex; align-items:center; justify-content:center;
  gap:10px; color:var(--text-muted); font-size:14.5px;
}
.video-placeholder .dot{width:8px; height:8px; border-radius:50%; background:var(--accent); animation:pulse 1s infinite;}
.class-info{margin-top:18px;}
.class-info .desc{color:var(--text-muted); font-size:14.5px; line-height:1.6; margin-top:10px;}
.class-meta{color:var(--text-muted); font-size:14px; margin-top:4px;}
.class-meta .instr{color:var(--text); font-weight:600;}
.side-panel{background:var(--panel); border:1px solid var(--line); border-radius:var(--radius); padding:18px;}
.side-panel h4{font-size:13px; text-transform:uppercase; letter-spacing:.05em; color:var(--text-muted); font-family:var(--font-mono); margin-bottom:14px;}
.side-row{display:flex; justify-content:space-between; font-size:14px; padding:8px 0; border-bottom:1px solid var(--line);}
.side-row:last-child{border-bottom:none;}
.side-row span:first-child{color:var(--text-muted);}
.recording-note{font-size:13px; color:var(--text-muted); text-align:center; padding:14px; background:var(--panel-2); border-radius:10px;}

/* ---------- Chat panel ---------- */
.chat-panel{display:flex; flex-direction:column; height:420px; margin-top:18px;}
.chat-log{flex:1; overflow-y:auto; display:flex; flex-direction:column; gap:10px; padding-right:4px;}
.chat-msg{font-size:13.5px; line-height:1.4;}
.chat-msg .who{font-weight:700; margin-right:6px;}
.chat-msg .who.instructor{color:var(--accent);}
.chat-msg .file-chip{
  display:inline-flex; align-items:center; gap:6px; margin-top:4px; padding:6px 10px;
  background:var(--panel-2); border:1px solid var(--line); border-radius:8px; text-decoration:none; font-size:12.5px;
}
.chat-input-row{display:flex; gap:8px; margin-top:12px;}
.chat-input-row input[type=text]{flex:1; background:var(--panel-2); border:1px solid var(--line); border-radius:10px; padding:10px 12px; outline:none;}
.chat-input-row input[type=text]:focus{border-color:var(--accent);}
.chat-icon-btn{background:var(--panel-2); border:1px solid var(--line); border-radius:10px; width:40px; cursor:pointer; font-size:16px;}
.chat-icon-btn:hover{border-color:var(--accent);}
.name-gate{display:flex; gap:8px;}
.name-gate input{flex:1;}

/* ---------- Poll panel ---------- */
.poll-panel{margin-top:18px;}
.poll-option-row{margin-bottom:8px;}
.poll-btn{
  width:100%; text-align:left; background:var(--panel-2); border:1px solid var(--line);
  border-radius:10px; padding:10px 12px; cursor:pointer; position:relative; overflow:hidden;
  font-size:13.5px; color:var(--text);
}
.poll-btn .fill{position:absolute; inset:0; background:rgba(255,179,90,.15); width:0%; transition:width .3s; z-index:0;}
.poll-btn .label{position:relative; z-index:1; display:flex; justify-content:space-between;}
.poll-btn:hover{border-color:var(--accent);}
.poll-btn.voted{border-color:var(--accent);}
.poll-total{font-size:12px; color:var(--text-muted); margin-top:6px;}
.poll-closed-tag{font-family:var(--font-mono); font-size:11px; color:var(--text-muted); text-transform:uppercase;}

/* ---------- Instructor management rows ---------- */
.row-badge{display:inline-block;}
.row-meta{margin-top:2px;}

/* ---------- Studio ---------- */
.studio-body{margin:0; height:100vh; display:flex; flex-direction:column; overflow:hidden;}
.studio-top{
  display:flex; align-items:center; justify-content:space-between; padding:12px 20px;
  border-bottom:1px solid var(--line); gap:16px; flex-shrink:0;
}
.studio-title{display:flex; align-items:center; gap:12px; font-family:var(--font-display); font-size:17px; flex:1; justify-content:center;}
.live-pill{
  display:inline-flex; align-items:center; gap:8px; background:rgba(255,77,77,.12); color:var(--live);
  border:1px solid rgba(255,77,77,.3); padding:4px 10px; border-radius:20px; font-family:var(--font-mono); font-size:12px;
}
.live-pill::before{content:""; width:6px; height:6px; border-radius:50%; background:var(--live); animation:pulse 1.4s infinite;}
.studio-viewers{color:var(--text-muted); font-size:13px; font-family:var(--font-mono);}

.studio-main{flex:1; display:grid; grid-template-columns:1fr 300px; overflow:hidden;}
.studio-stage-area{position:relative; background:#000; display:flex; align-items:center; justify-content:center; overflow:hidden;}
.stage-container{position:relative; width:100%; height:100%; background:#0f1216;}
.stage-container canvas#ink{position:absolute; inset:0; width:100%; height:100%; cursor:crosshair; touch-action:none;}
#screen-video{position:absolute; inset:0; width:100%; height:100%; object-fit:contain; background:#000;}
.stage-placeholder{position:absolute; inset:0; display:flex; align-items:center; justify-content:center; color:var(--text-muted); font-size:14.5px; text-align:center; padding:40px; pointer-events:none;}
.pip{position:absolute; bottom:16px; right:16px; width:190px; aspect-ratio:4/3; border-radius:10px; overflow:hidden; border:2px solid var(--accent); cursor:grab; box-shadow:0 6px 24px rgba(0,0,0,.5);}
.pip video{width:100%; height:100%; object-fit:cover; transform:scaleX(-1);}
.pip-handle{position:absolute; inset:0;}

.pages-strip{display:flex; gap:8px; padding:10px 14px; border-top:1px solid var(--line); overflow-x:auto; background:var(--panel); flex-shrink:0;}
.page-thumb{
  flex-shrink:0; width:70px; height:44px; border-radius:6px; border:2px solid var(--line);
  background:#111; cursor:pointer; position:relative; overflow:hidden;
}
.page-thumb canvas{width:100%; height:100%;}
.page-thumb.active{border-color:var(--accent);}
.page-thumb .num{position:absolute; bottom:1px; right:3px; font-size:9px; color:var(--text-muted); font-family:var(--font-mono);}
.page-add{flex-shrink:0; width:70px; height:44px; border-radius:6px; border:2px dashed var(--line); background:transparent; color:var(--text-muted); cursor:pointer; font-size:18px;}
.page-add:hover{border-color:var(--accent); color:var(--accent);}

.studio-side{border-left:1px solid var(--line); display:flex; flex-direction:column; overflow:hidden;}
.side-tabs{display:flex; border-bottom:1px solid var(--line); flex-shrink:0;}
.side-tabs button{flex:1; background:transparent; border:none; padding:12px; color:var(--text-muted); cursor:pointer; font-size:13px; font-weight:600; border-bottom:2px solid transparent;}
.side-tabs button.active{color:var(--accent); border-bottom-color:var(--accent);}
.side-tab-panel{flex:1; overflow-y:auto; padding:16px; display:none;}
.side-tab-panel.active{display:flex; flex-direction:column;}

.dock{display:flex; align-items:center; gap:14px; padding:12px 18px; border-top:1px solid var(--line); background:var(--panel); flex-wrap:wrap; flex-shrink:0;}
.dock-group{display:flex; align-items:center; gap:6px;}
.dock-group.segmented{background:var(--panel-2); border-radius:10px; padding:3px;}
.seg-btn{background:transparent; border:none; color:var(--text-muted); padding:7px 12px; border-radius:8px; cursor:pointer; font-size:13px; font-weight:600;}
.seg-btn.active{background:var(--accent); color:#241300;}
.dock-btn{
  background:var(--panel-2); border:1px solid var(--line); color:var(--text); width:38px; height:38px;
  border-radius:9px; cursor:pointer; font-size:15px; display:flex; align-items:center; justify-content:center;
}
.dock-btn:hover{border-color:var(--accent);}
.dock-btn.active,.dock-btn.tool.active{background:var(--accent); color:#241300; border-color:var(--accent);}
.dock-btn.recording{background:var(--live); border-color:var(--live); color:#fff; animation:pulse 1.2s infinite;}
.dock-btn.off{opacity:.45;}
#pen-color{width:32px; height:32px; padding:0; border:1px solid var(--line); border-radius:8px; background:none; cursor:pointer;}
#pen-size{width:80px;}
.dock-cta{padding:10px 18px;}

.file-menu{position:relative;}
.file-dropdown{
  position:absolute; bottom:46px; left:0; background:var(--panel); border:1px solid var(--line); border-radius:10px;
  padding:6px; display:none; flex-direction:column; min-width:180px; box-shadow:0 8px 24px rgba(0,0,0,.4); z-index:10;
}
.file-dropdown.open{display:flex;}
.file-dropdown button{background:transparent; border:none; color:var(--text); text-align:left; padding:9px 10px; border-radius:6px; cursor:pointer; font-size:13.5px;}
.file-dropdown button:hover{background:var(--panel-2); color:var(--accent);}

.poll-create input,.poll-create .opt-row{margin-bottom:8px;}
.opt-row{display:flex; gap:6px;}
.opt-row input{flex:1;}
.opt-remove{background:transparent; border:none; color:var(--text-muted); cursor:pointer; font-size:16px;}
.small-link{background:transparent; border:none; color:var(--accent); cursor:pointer; font-size:12.5px; padding:0; text-decoration:underline;}

@media (max-width:900px){
  .player-grid{grid-template-columns:1fr;}
  .auth-shell{grid-template-columns:1fr;}
  .auth-visual{display:none;}
  .studio-main{grid-template-columns:1fr;}
  .studio-side{border-left:none; border-top:1px solid var(--line); max-height:260px;}
}
