/* === Pro-Z brand tokens === */
:root{
  --proz-navy: #0e2a47;
  --proz-navy-2: #143a63;
  --proz-ink: #0b1f37;
  --proz-orange: #ff7a1a;
  --proz-orange-2: #ffa05c;
  --proz-bg: #f5f7fb;
  --proz-card: #ffffff;
  --proz-line: #e3e8ef;
  --proz-text: #15243b;
  --proz-text-muted: #58708e;
  --proz-mark: #fff1c2;
  --shadow-sm: 0 1px 2px rgba(14,42,71,.06);
  --shadow-md: 0 8px 24px rgba(14,42,71,.10);
}
*{box-sizing:border-box}
html,body.proz-app{margin:0;padding:0;background:var(--proz-bg)}
body.proz-app{
  font-family: 'Inter','Segoe UI','Helvetica Neue',Arial,sans-serif;
  color:var(--proz-text);
  -webkit-font-smoothing:antialiased;
  font-size:15px;
  line-height:1.45;
}

/* Topbar */
.proz-topbar{
  background:linear-gradient(135deg,var(--proz-navy) 0%,var(--proz-navy-2) 100%);
  color:#fff;
  padding:14px 22px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  box-shadow:var(--shadow-md);
  position:sticky;top:0;z-index:50;
  border-bottom:none;
  flex-wrap:nowrap;
}
.proz-brand{display:flex;align-items:center;gap:14px;color:#fff;text-decoration:none}
.proz-brand .brand-title{font-weight:700;font-size:15px;letter-spacing:.2px;color:#fff}
.proz-brand .brand-subtitle{font-size:12px;color:#aac0d8;margin-top:2px}
.top-stats{display:flex;gap:18px;font-size:13px;color:#cfdcec}
.top-stats b{color:#fff;font-weight:700}
.proz-nav{display:flex;gap:14px;align-items:center}
.proz-nav a{color:#cfdcec;text-decoration:none;font-size:13px}
.proz-nav a:hover{color:#fff}
@media (max-width:980px){
  .top-stats{display:none}
  .proz-brand .brand-subtitle{display:none}
  .proz-nav a{font-size:12px}
}

/* Access banner */
.proz-banner{
  margin:0;padding:14px 22px;
  background:linear-gradient(135deg,#fff7ed,#fff0e0);
  border-bottom:1px solid var(--proz-line);
  color:var(--proz-navy);font-size:14px;font-weight:600;
  display:flex;align-items:center;gap:14px;justify-content:space-between;
}
.proz-banner.error{background:#fee;color:#a00}
.proz-banner a.btn-buy{
  background:var(--proz-orange);color:#fff;
  padding:9px 16px;border-radius:8px;text-decoration:none;font-weight:700;
  font-size:13px;
}
.proz-banner a.btn-buy:hover{background:#e96a0d}

/* Layout */
.proz-layout{
  display:grid;
  grid-template-columns: minmax(300px,380px) minmax(560px,1fr) minmax(320px,400px);
  gap:0;
  min-height: calc(100vh - 64px - 44px);
}
.proz-layout.no-chat{
  grid-template-columns: minmax(320px,420px) 1fr;
}
@media (max-width:1280px){
  .proz-layout{grid-template-columns: minmax(300px,380px) 1fr}
  .proz-chat-col{position:fixed;right:18px;bottom:18px;top:auto;width:380px;height:520px;max-height:70vh;border-radius:14px;box-shadow:0 18px 50px rgba(14,42,71,.22);border:1px solid var(--proz-line);z-index:80;background:#fff;display:none}
  .proz-chat-col.floating-open{display:flex;flex-direction:column}
  .chat-fab{position:fixed;right:18px;bottom:18px;z-index:79;background:var(--proz-orange);color:#fff;border:none;border-radius:999px;padding:13px 20px;box-shadow:0 8px 24px rgba(255,122,26,.4);font:inherit;font-weight:700;cursor:pointer;font-size:14px;display:flex;align-items:center;gap:8px}
  .chat-fab:hover{background:#e96a0d}
  .chat-fab .chat-fab-badge{background:#fff;color:var(--proz-orange);border-radius:10px;padding:1px 7px;font-size:12px;font-weight:800;min-width:18px;text-align:center}
  .chat-fab .chat-fab-badge:empty{display:none}
}
@media (max-width:980px){
  .proz-layout{grid-template-columns:1fr}
  .proz-chat-col{left:8px;right:8px;width:auto;bottom:8px;max-height:80vh}
}

/* Sidebar */
.proz-sidebar{
  background:#fff;
  border-right:1px solid var(--proz-line);
  display:flex;flex-direction:column;
  min-height:0;
  height: calc(100vh - 64px);
  position:sticky;top:64px;
}
@media (max-width:980px){
  .proz-sidebar{position:static;height:auto;max-height:60vh}
}
.search-wrap{
  padding:14px 16px 10px;
  position:relative;
  border-bottom:1px solid var(--proz-line);
}
.search-wrap input{
  width:100%;
  padding:11px 36px 11px 14px;
  border:1.5px solid var(--proz-line);
  border-radius:10px;
  font-size:14px;
  font-family:inherit;
  background:#f8fafc;
  outline:none;
  transition:.15s border-color, .15s background;
  color:var(--proz-text);
}
.search-wrap input:focus{
  border-color:var(--proz-orange);
  background:#fff;
  box-shadow:0 0 0 3px rgba(255,122,26,.12);
}
#q-clear{
  position:absolute;right:24px;top:50%;transform:translateY(-30%);
  width:24px;height:24px;border:none;background:transparent;
  color:#94a3b8;font-size:22px;cursor:pointer;display:none;
}
#q-clear.visible{display:block}

.tabs{
  display:flex;
  border-bottom:1px solid var(--proz-line);
  background:#fafbfd;
}
.tab{
  flex:1;
  padding:11px 14px;
  background:transparent;border:none;
  font:inherit;font-size:13px;font-weight:600;
  color:var(--proz-text-muted);
  cursor:pointer;
  border-bottom:2px solid transparent;
  display:flex;align-items:center;justify-content:center;gap:8px;
}
.tab.active{color:var(--proz-navy);border-bottom-color:var(--proz-orange)}
.badge{
  display:inline-flex;align-items:center;justify-content:center;
  min-width:22px;height:18px;padding:0 6px;
  background:var(--proz-orange);color:#fff;
  border-radius:9px;font-size:11px;font-weight:700;
}
.badge:empty{display:none}

.pane{
  flex:1;
  overflow:auto;
  padding:6px 6px 16px;
}
.pane.hidden{display:none}

/* TOC */
.module{margin:10px 8px 4px}
.module-title{
  font-size:11px;text-transform:uppercase;letter-spacing:1px;
  color:var(--proz-text-muted);font-weight:700;
  padding:8px 10px 4px;
}
.cat{
  margin:2px 4px 6px;border-radius:8px;
  background:#fafbfd;
  border:1px solid var(--proz-line);
  overflow:hidden;
}
.cat-head{
  display:flex;align-items:center;gap:8px;
  padding:9px 12px;cursor:pointer;
  font-weight:600;font-size:13.5px;
  color:var(--proz-navy);
  user-select:none;
}
.cat-head:hover{background:#f1f5fb}
.cat-head .chev{transition:.2s transform;color:#7a8ea8;font-size:11px}
.cat.open .cat-head .chev{transform:rotate(90deg)}
.cat-count{
  margin-left:auto;
  font-size:11px;color:var(--proz-text-muted);
  background:#eaf0f8;border-radius:8px;padding:2px 8px;font-weight:600;
}
.cat-lessons{display:none;padding:2px 6px 8px}
.cat.open .cat-lessons{display:block}
.lesson-item{
  display:flex;align-items:center;gap:10px;
  padding:8px 10px;border-radius:6px;
  cursor:pointer;font-size:13px;color:var(--proz-text);
  margin:1px 0;
}
.lesson-item:hover{background:#fff;box-shadow:var(--shadow-sm)}
.lesson-item.active{
  background:#fff7ed;color:var(--proz-navy);font-weight:600;
  box-shadow:inset 3px 0 0 var(--proz-orange);
}
.lesson-item .dur{
  margin-left:auto;font-size:11px;color:var(--proz-text-muted);
  font-variant-numeric:tabular-nums;
}
.lesson-item.locked{opacity:.55;cursor:not-allowed}
.lesson-item.locked::before{content:"🔒";font-size:11px;margin-right:2px}
.lesson-item.completed::after{content:"✓";color:#16a34a;font-weight:700;margin-left:6px}

/* Results */
.hint{
  padding:14px 16px;color:var(--proz-text-muted);font-size:13px;
  background:#fafbfd;border-radius:8px;margin:10px;
  line-height:1.5;
}
.result{
  padding:11px 14px;margin:6px 8px;
  border-radius:8px;border:1px solid var(--proz-line);
  background:#fff;cursor:pointer;
  transition:.15s border-color, .15s transform;
}
.result:hover{border-color:var(--proz-orange);transform:translateY(-1px);box-shadow:var(--shadow-sm)}
.result-head{
  display:flex;align-items:center;gap:10px;
  font-size:12.5px;color:var(--proz-navy);font-weight:600;
  margin-bottom:5px;
}
.result-time{
  background:var(--proz-orange);color:#fff;
  font-size:11px;font-weight:700;padding:2px 7px;border-radius:6px;
  font-variant-numeric:tabular-nums;
}
.result-text{font-size:13px;color:#33455e;line-height:1.5}
.result-text mark{background:var(--proz-mark);padding:0 1px;border-radius:2px}
.no-results{padding:22px 18px;text-align:center;color:var(--proz-text-muted);font-size:14px}

/* Player */
.proz-player-col{padding:18px 22px 22px;min-width:0}
.player-shell{
  background:var(--proz-card);
  border-radius:14px;
  box-shadow:var(--shadow-md);
  overflow:hidden;
}
.player-meta{padding:16px 20px 12px;border-bottom:1px solid var(--proz-line);display:flex;align-items:flex-start;justify-content:space-between;gap:16px}
.player-meta-text{min-width:0;flex:1 1 auto}
.player-title{font-size:18px;font-weight:700;color:var(--proz-navy)}
.player-sub{font-size:13px;color:var(--proz-text-muted);margin-top:3px}

/* ---- Admin strip ---- */
.admin-strip{
  background:linear-gradient(90deg,#fef3e6 0%,#fff 100%);
  border-bottom:1px solid #fed7aa;
  padding:8px 24px;display:flex;align-items:center;gap:10px;flex-wrap:wrap;
  font-size:13px;
}
.admin-strip-label{color:#9a3412;font-weight:700}
.admin-strip-btn{
  display:inline-block;padding:5px 12px;border-radius:6px;
  background:#fff;border:1px solid #fed7aa;color:#9a3412;
  text-decoration:none;font-weight:600;font-size:13px;
  transition:all .12s;
}
.admin-strip-btn:hover{background:#fff7ed;border-color:#fb923c;color:#7c2d12}

/* ---- Materials button + popover ---- */
.player-meta-actions{position:relative;flex-shrink:0}
.materials-btn{
  display:inline-flex;align-items:center;gap:8px;
  padding:10px 16px;border-radius:10px;border:0;cursor:pointer;
  background:linear-gradient(135deg,#ff7a1a 0%,#ff5e00 100%);
  color:#fff;font-weight:700;font-size:14px;letter-spacing:.2px;
  box-shadow:0 4px 14px rgba(255,122,26,.35);
  transition:transform .12s ease, box-shadow .15s ease, filter .15s ease;
}
.materials-btn:hover{transform:translateY(-1px);box-shadow:0 6px 18px rgba(255,122,26,.45);filter:brightness(1.04)}
.materials-btn:active{transform:translateY(0)}
.materials-btn svg{flex-shrink:0}
.materials-btn .materials-count{
  display:inline-flex;align-items:center;justify-content:center;
  min-width:22px;height:22px;padding:0 6px;border-radius:11px;
  background:rgba(255,255,255,.25);font-size:12px;font-weight:800;
}
.materials-popover{
  position:absolute;top:calc(100% + 8px);right:0;z-index:30;
  width:380px;max-width:calc(100vw - 32px);
  background:#fff;border:1px solid var(--proz-line);border-radius:12px;
  box-shadow:0 12px 32px rgba(14,42,71,.18);
  flex-direction:column;max-height:60vh;
}
.materials-popover:not([hidden]){display:flex}
.materials-popover[hidden]{display:none !important}
.materials-popover-head{
  display:flex;align-items:center;justify-content:space-between;
  padding:12px 14px;border-bottom:1px solid var(--proz-line);
  font-weight:700;color:var(--proz-navy);
}
.materials-close{
  border:0;background:transparent;font-size:22px;line-height:1;cursor:pointer;color:#64748b;
  padding:0 4px;
}
.materials-close:hover{color:var(--proz-navy)}
.materials-list{padding:6px 0;overflow:auto;flex:1 1 auto}
.materials-hint{padding:18px 16px;color:var(--proz-text-muted);font-size:13px;text-align:center}
.materials-item{
  display:flex;align-items:center;gap:12px;
  padding:10px 14px;text-decoration:none;color:var(--proz-navy);
  border-bottom:1px solid #f1f5f9;transition:background .12s;
}
.materials-item:last-child{border-bottom:0}
.materials-item:hover{background:#fff7ed}
.materials-item-icon{
  width:36px;height:36px;border-radius:8px;flex-shrink:0;
  display:flex;align-items:center;justify-content:center;
  background:#fef3e6;color:#ff7a1a;font-weight:800;font-size:11px;text-transform:uppercase;
}
.materials-item-body{flex:1 1 auto;min-width:0}
.materials-item-title{font-size:14px;font-weight:600;color:var(--proz-navy);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.materials-item-meta{font-size:12px;color:var(--proz-text-muted);margin-top:2px}
.materials-item-del{
  border:0;background:transparent;color:#cbd5e1;font-size:18px;cursor:pointer;padding:4px 8px;border-radius:6px;
}
.materials-item-del:hover{background:#fee2e2;color:#dc2626}
.materials-admin{
  padding:10px 14px;border-top:1px solid var(--proz-line);background:#fafbfc;
  align-items:center;gap:10px;flex-wrap:wrap;
}
.materials-admin:not([hidden]){display:flex}
.materials-admin[hidden]{display:none !important}
.materials-upload-btn{
  display:inline-flex;align-items:center;gap:6px;padding:8px 12px;border-radius:8px;
  background:var(--proz-navy);color:#fff;font-weight:600;font-size:13px;cursor:pointer;
  transition:filter .12s;
}
.materials-upload-btn:hover{filter:brightness(1.1)}
.materials-upload-hint{font-size:12px;color:var(--proz-text-muted)}

@media (max-width:720px){
  .player-meta{flex-direction:column;align-items:stretch}
  .materials-popover{right:auto;left:0;width:100%}
}
.player-frame{
  position:relative;
  aspect-ratio:16/9;
  background:#0b1f37;
}
.player-frame iframe{
  position:absolute;inset:0;width:100%;height:100%;border:0;display:block;
}
.player-placeholder{
  position:absolute;inset:0;display:flex;flex-direction:column;
  align-items:center;justify-content:center;gap:14px;
  color:#94a3b8;text-align:center;line-height:1.5;font-size:14px;
  background:#0b1f37;
  z-index:1;
}
.player-frame.active .player-placeholder{display:none}

/* Lesson actions */
.lesson-extras{padding:14px 20px 22px}
.lesson-actions{
  display:flex;align-items:center;gap:14px;margin-bottom:14px;
}
.proz-btn{
  background:var(--proz-orange);color:#fff;
  border:none;border-radius:8px;padding:9px 16px;
  font:inherit;font-size:13px;font-weight:600;cursor:pointer;
  transition:.15s background;
}
.proz-btn:hover{background:#e96a0d}
.proz-btn[disabled]{background:#16a34a;cursor:default}
.lesson-status{color:var(--proz-text-muted);font-size:13px}

.lesson-extras h3{
  margin:0 0 10px;font-size:14px;color:var(--proz-navy);
  display:flex;align-items:center;gap:10px;
  text-transform:uppercase;letter-spacing:.8px;
}
.copy-btn{
  margin-left:auto;border:1px solid var(--proz-line);
  background:#fff;border-radius:6px;padding:4px 10px;
  font-size:11px;font-weight:600;color:var(--proz-text-muted);
  cursor:pointer;text-transform:uppercase;letter-spacing:.5px;
}
.copy-btn:hover{border-color:var(--proz-orange);color:var(--proz-orange)}
.transcript{
  max-height:300px;overflow:auto;
  font-size:13px;line-height:1.65;color:#33455e;
  background:#fafbfd;border:1px solid var(--proz-line);
  border-radius:8px;padding:12px 14px;
}
.transcript .ts{
  display:inline-block;background:#eaf0f8;color:var(--proz-navy);
  font-size:11px;font-weight:700;padding:1px 6px;border-radius:4px;
  margin-right:6px;cursor:pointer;font-variant-numeric:tabular-nums;
}
.transcript .ts:hover{background:var(--proz-orange);color:#fff}
.transcript p{margin:0 0 8px}

.proz-footer{
  padding:12px 22px;font-size:12px;color:var(--proz-text-muted);
  text-align:center;border-top:1px solid var(--proz-line);
  background:#fff;margin-top:0;
}

/* ====== Chat panel ====== */
.proz-chat-col{
  background:#fff;
  border-left:1px solid var(--proz-line);
  display:flex;flex-direction:column;
  height: calc(100vh - 64px);
  position:sticky;top:64px;
  min-width:0;
}
.chat-head{
  padding:14px 16px;
  border-bottom:1px solid var(--proz-line);
  background:linear-gradient(135deg,#fafbfd,#f4f7fc);
}
.chat-title{
  font-weight:700;color:var(--proz-navy);font-size:15px;
  display:flex;align-items:center;gap:8px;
}
.chat-title::before{
  content:"";display:inline-block;width:8px;height:8px;border-radius:50%;
  background:#22c55e;
}
.chat-subtitle{font-size:12px;color:var(--proz-text-muted);margin-top:3px}
.chat-messages{
  flex:1;overflow:auto;padding:12px 12px 6px;
  display:flex;flex-direction:column;gap:10px;
  background:#fbfcfe;
}
.chat-hint{padding:18px 14px;color:var(--proz-text-muted);font-size:13px;text-align:center;line-height:1.5}
.chat-msg{
  background:#fff;border:1px solid var(--proz-line);border-radius:12px;
  padding:9px 12px;max-width:92%;
  box-shadow:var(--shadow-sm);
  align-self:flex-start;
  font-size:13.5px;line-height:1.45;color:#1d2c44;
  word-wrap:break-word;
}
.chat-msg.own{
  align-self:flex-end;
  background:#fff7ed;border-color:#fed7aa;
}
.chat-msg.admin{border-left:3px solid var(--proz-orange);background:#fffaf3}
.chat-msg.instructor{border-left:3px solid #6366f1;background:#f5f5fe}
.chat-msg-head{
  display:flex;align-items:center;gap:8px;margin-bottom:4px;
  font-size:11.5px;color:var(--proz-text-muted);
}
.chat-msg-author{font-weight:700;color:var(--proz-navy);font-size:12.5px}
.chat-msg-role{
  background:#eaf0f8;color:var(--proz-navy);
  font-size:10px;font-weight:700;
  padding:1px 6px;border-radius:6px;
  text-transform:uppercase;letter-spacing:.4px;
}
.chat-msg-role.admin{background:var(--proz-orange);color:#fff}
.chat-msg-role.instructor{background:#6366f1;color:#fff}
.chat-msg-lesson{
  font-size:11px;color:var(--proz-text-muted);
  font-style:italic;cursor:pointer;
}
.chat-msg-lesson:hover{color:var(--proz-orange);text-decoration:underline}
.chat-msg-time{margin-left:auto;font-size:11px;color:#94a3b8}
.chat-msg-body{white-space:pre-wrap}
.chat-msg-atts{display:flex;flex-direction:column;gap:6px;margin-top:6px}
.chat-att{
  display:flex;align-items:center;gap:8px;
  background:#f1f5fb;border:1px solid var(--proz-line);
  border-radius:8px;padding:6px 10px;font-size:12.5px;color:var(--proz-navy);
  text-decoration:none;
  max-width:100%;
}
.chat-att:hover{background:#fff7ed;border-color:var(--proz-orange);color:var(--proz-orange)}
.chat-att img.thumb{max-width:120px;max-height:90px;border-radius:6px;display:block}
.chat-att .att-icon{font-size:18px}
.chat-att .att-size{font-size:11px;color:var(--proz-text-muted);margin-left:auto}
.chat-pending-files{
  padding:0 14px;display:flex;flex-direction:column;gap:4px;
  font-size:12px;
}
.chat-pending-file{
  display:flex;align-items:center;gap:8px;color:var(--proz-text-muted);
  background:#fafbfd;border:1px dashed var(--proz-line);
  padding:5px 10px;border-radius:6px;
}
.chat-pending-file .rm{margin-left:auto;cursor:pointer;color:#dc2626;font-weight:700}
.chat-form{
  padding:10px 12px 14px;
  border-top:1px solid var(--proz-line);
  background:#fff;
  display:flex;flex-direction:column;gap:8px;
}
.chat-form textarea{
  width:100%;
  border:1px solid var(--proz-line);
  border-radius:10px;
  padding:9px 12px;
  font:inherit;font-size:13.5px;
  resize:vertical;min-height:48px;max-height:160px;
  background:#fafbfd;outline:none;
  color:var(--proz-text);
  font-family:inherit;
}
.chat-form textarea:focus{border-color:var(--proz-orange);background:#fff;box-shadow:0 0 0 3px rgba(255,122,26,.12)}
.chat-actions{display:flex;align-items:center;gap:10px}
.chat-attach-btn{
  background:#fafbfd;border:1px solid var(--proz-line);
  border-radius:8px;width:34px;height:34px;
  display:flex;align-items:center;justify-content:center;
  cursor:pointer;font-size:16px;
}
.chat-attach-btn:hover{border-color:var(--proz-orange);background:#fff7ed}
.chat-attach-hint{flex:1;font-size:11px;color:var(--proz-text-muted)}
.chat-form .proz-btn{padding:8px 16px;font-size:13px}

/* ====== Buy modal ====== */
.buy-modal-backdrop{
  position:fixed;inset:0;background:rgba(14,42,71,.55);
  z-index:90;display:none;align-items:center;justify-content:center;padding:20px;
}
.buy-modal-backdrop.open{display:flex}
.buy-modal{
  background:#fff;border-radius:14px;
  max-width:440px;width:100%;
  box-shadow:0 24px 60px rgba(14,42,71,.25);
  padding:24px 26px;
}
.buy-modal h2{margin:0 0 6px;color:var(--proz-navy);font-size:20px}
.buy-modal .price{font-size:28px;font-weight:800;color:var(--proz-orange);margin:8px 0 14px}
.buy-modal label{display:block;font-size:12px;color:var(--proz-text-muted);font-weight:600;margin:10px 0 4px;text-transform:uppercase;letter-spacing:.5px}
.buy-modal input{
  width:100%;padding:10px 12px;border:1.5px solid var(--proz-line);
  border-radius:9px;font:inherit;font-size:14px;outline:none;
  background:#fafbfd;color:var(--proz-text);
}
.buy-modal input:focus{border-color:var(--proz-orange);background:#fff}
.buy-modal .buy-actions{display:flex;gap:10px;margin-top:18px}
.buy-modal .buy-actions button{flex:1;padding:12px;font-size:14px}
.buy-modal .btn-cancel{
  background:#fff;color:var(--proz-text-muted);
  border:1px solid var(--proz-line);border-radius:9px;cursor:pointer;font:inherit;font-weight:600;
}
.buy-modal .btn-cancel:hover{color:var(--proz-navy);border-color:var(--proz-navy)}
.buy-modal .small{font-size:12px;color:var(--proz-text-muted);margin-top:14px;line-height:1.5}
.buy-modal .error{color:#dc2626;font-size:13px;margin-top:8px;display:none}
.buy-modal .error.visible{display:block}

.pane::-webkit-scrollbar,.transcript::-webkit-scrollbar{width:8px}
.pane::-webkit-scrollbar-thumb,.transcript::-webkit-scrollbar-thumb{background:#cfd8e3;border-radius:4px}
.pane::-webkit-scrollbar-thumb:hover,.transcript::-webkit-scrollbar-thumb:hover{background:#a7b6c7}
