/* ChemAI Study Portal Styles */
:root {
  --portal-surface: rgba(255,255,255,0.04);
  --portal-border: rgba(255,255,255,0.08);
  --badge-bg: rgba(255,255,255,0.08);
  --badge-active: var(--primary-color,#00B4D8);
  --danger: #ef4444;
  --success: #10b981;
  --focus-ring: 2px solid var(--primary-color,#00B4D8);
}

.study-portal-body { background: linear-gradient(135deg,var(--background-primary,#0A1929),var(--background-secondary,#132F4C)); color: var(--text-primary,#F8FAFC); font-family: 'Inter',system-ui,sans-serif; }

.portal-hero { padding: 130px 0 70px; position: relative; overflow: hidden; }
.portal-hero:before { content: ""; position: absolute; inset:0; background: radial-gradient(circle at 30% 30%, rgba(0,180,216,.2), transparent 70%); pointer-events:none; }
.portal-hero-inner { display:flex; align-items:stretch; justify-content:space-between; gap:4rem; flex-wrap:wrap; }
.portal-hero-text { max-width:680px; }
.portal-hero-text h1 { font-size: clamp(2rem,5vw,3.1rem); font-weight:800; background:linear-gradient(135deg,var(--primary-color,#00B4D8),var(--secondary-color,#FF6B35)); -webkit-background-clip:text; background-clip:text; color:transparent; margin-bottom:1rem; }
.portal-hero-text p { font-size:1.05rem; line-height:1.55; color: var(--text-secondary,#CBD5E1); }
.hero-actions { margin-top:1.5rem; display:flex; gap:.9rem; flex-wrap:wrap; }
.btn.alt-btn { background: var(--background-secondary,#132F4C); border:1px solid var(--portal-border); }
.btn.alt-btn:hover { background: var(--portal-surface); }

.portal-progress-summary { width:160px; text-align:center; background:var(--portal-surface); border:1px solid var(--portal-border); border-radius:1rem; padding:1.25rem .75rem; backdrop-filter: blur(8px); }
.progress-ring { position:relative; width:100px; height:100px; margin:0 auto .5rem; border-radius:50%; background:conic-gradient(var(--primary-color,#00B4D8) 0% 0%, rgba(255,255,255,.15) 0% 100%); display:grid; place-items:center; font-weight:600; }
.progress-ring span { font-size:1.1rem; }
.progress-caption { font-size:.8rem; letter-spacing:.5px; text-transform:uppercase; opacity:.8; }

/* Filters */
.filters-bar { position:sticky; top:64px; z-index:900; background:rgba(10,25,41,.85); backdrop-filter: blur(10px); border-top:1px solid var(--portal-border); border-bottom:1px solid var(--portal-border); padding:.9rem 0; }
.filters-grid { display:grid; grid-template-columns:1fr; gap:.75rem; }
.filter-group { display:flex; flex-wrap:wrap; gap:.5rem; }
.filter-chip { --chip-bg: var(--badge-bg); background:var(--chip-bg); border:1px solid var(--portal-border); color:inherit; padding:.45rem .85rem; border-radius:999px; font-size:.75rem; letter-spacing:.5px; font-weight:600; text-transform:uppercase; cursor:pointer; position:relative; transition:.25s background,color,border-color; }
.filter-chip[data-active="true"] { background:var(--badge-active); border-color:var(--badge-active); color:#fff; }
.filter-chip:focus-visible { outline: var(--focus-ring); }
.filter-group-label { font-size:.65rem; font-weight:600; letter-spacing:1px; opacity:.7; margin-right:.4rem; align-self:center; text-transform:uppercase; }
.btn.small { padding:.5rem .9rem; font-size:.7rem; border-radius:.6rem; }
.btn.muted { background:var(--badge-bg); border:1px solid var(--portal-border); color: var(--text-secondary,#CBD5E1); }
.btn.muted:hover { background:var(--portal-surface); }

/* Media Grids */
.media-section { margin-top:70px; }
.section-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:1.1rem; gap:1rem; }
.section-header h2 { font-size:1.6rem; font-weight:700; }
.section-count { font-size:.75rem; letter-spacing:.5px; opacity:.65; text-transform:uppercase; }
.media-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(250px,1fr)); gap:1.1rem; }
.media-card { background:var(--portal-surface); border:1px solid var(--portal-border); border-radius:1rem; overflow:hidden; display:flex; flex-direction:column; position:relative; transition:.3s box-shadow, transform, border-color; }
.media-card:hover { transform:translateY(-4px); box-shadow:0 6px 18px -6px rgba(0,0,0,.5); border-color:rgba(255,255,255,.25); }
.media-thumb { position:relative; aspect-ratio:16/9; background:#0f2235; overflow:hidden; }
.media-thumb img, .media-thumb video { width:100%; height:100%; object-fit:cover; display:block; }
.badge { position:absolute; top:.5rem; left:.5rem; background:rgba(0,0,0,.55); color:#fff; font-size:.65rem; padding:.3rem .5rem; border-radius:.5rem; font-weight:600; letter-spacing:.5px; text-transform:uppercase; }
.badge.type { left:auto; right:.5rem; }
.media-body { padding:.85rem .9rem 1rem; display:flex; flex-direction:column; gap:.55rem; flex:1; }
.media-title { font-size:.95rem; font-weight:600; line-height:1.25; }
.media-desc { font-size:.75rem; line-height:1.35; opacity:.8; flex:1; }
.meta-row { display:flex; justify-content:space-between; align-items:center; font-size:.65rem; letter-spacing:.5px; opacity:.65; text-transform:uppercase; }
.tag-row { display:flex; flex-wrap:wrap; gap:.35rem; }
.tag { background:var(--badge-bg); color:inherit; font-size:.55rem; padding:.25rem .45rem; border-radius:.45rem; font-weight:600; letter-spacing:.5px; text-transform:uppercase; }
.card-actions { display:flex; gap:.35rem; margin-top:.4rem; }
.card-btn { background:rgba(255,255,255,.06); border:1px solid var(--portal-border); color:inherit; font-size:.65rem; padding:.4rem .55rem; border-radius:.5rem; cursor:pointer; display:inline-flex; align-items:center; gap:.3rem; }
.card-btn:hover { background:rgba(255,255,255,.1); }
.card-btn.complete { border-color:var(--success); color:var(--success); }

/* Scroll Row */
.scroll-row { display:flex; gap:.9rem; overflow-x:auto; padding:.5rem .25rem .25rem; scrollbar-width:thin; }
.scroll-row::-webkit-scrollbar { height:8px; }
.scroll-row::-webkit-scrollbar-track { background:transparent; }
.scroll-row::-webkit-scrollbar-thumb { background:rgba(255,255,255,.2); border-radius:4px; }

/* Playlist Layout */
.podcast-layout { display:grid; grid-template-columns: minmax(240px,320px) 1fr; gap:1.5rem; align-items:start; }
.playlist { display:flex; flex-direction:column; gap:.5rem; max-height:480px; overflow:auto; padding-right:.25rem; }
.playlist-item { background:var(--portal-surface); border:1px solid var(--portal-border); padding:.6rem .7rem .7rem; border-radius:.7rem; cursor:pointer; display:flex; flex-direction:column; gap:.35rem; position:relative; }
.playlist-item:hover { background:rgba(255,255,255,.07); }
.playlist-item[aria-selected='true'] { outline:var(--focus-ring); border-color:var(--primary-color,#00B4D8); }
.playlist-item h3 { font-size:.85rem; font-weight:600; }
.playlist-item p { font-size:.65rem; line-height:1.2; opacity:.75; }
.player-panel { background:var(--portal-surface); border:1px solid var(--portal-border); border-radius:1rem; padding:1rem 1.1rem 1.25rem; min-height:260px; display:flex; flex-direction:column; gap:.85rem; }
.current-meta { font-size:.8rem; line-height:1.4; opacity:.85; }

/* Reference Section */
.reference-section { margin-top:90px; }
.reference-links { list-style:none; padding:0; display:grid; gap:.65rem; grid-template-columns:repeat(auto-fit,minmax(240px,1fr)); }
.reference-links a { display:block; background:var(--portal-surface); border:1px solid var(--portal-border); padding:.75rem .95rem; border-radius:.75rem; font-size:.8rem; font-weight:500; text-decoration:none; color:inherit; }
.reference-links a:hover { background:rgba(255,255,255,.08); }

/* FAQ */
.faq-section { margin-top:100px; }
.faq-section details { background:var(--portal-surface); border:1px solid var(--portal-border); border-radius:.8rem; padding:.9rem 1rem; font-size:.8rem; }
.faq-section details + details { margin-top:.7rem; }
.faq-section summary { cursor:pointer; font-weight:600; }

/* Video Modal */
.video-modal { position:fixed; inset:0; background:rgba(0,0,0,.75); display:none; align-items:center; justify-content:center; padding:2rem 1rem; z-index:1200; }
.video-modal[aria-hidden='false'] { display:flex; }
.video-dialog { width: min(100%,960px); background:#0f1f30; border:1px solid var(--portal-border); border-radius:1.2rem; overflow:hidden; position:relative; display:flex; flex-direction:column; }
.modal-close { position:absolute; top:.35rem; right:.45rem; background:rgba(255,255,255,.1); color:#fff; border:0; width:36px; height:36px; border-radius:.75rem; font-size:1.4rem; cursor:pointer; line-height:1; }
.modal-close:hover { background:rgba(255,255,255,.2); }
.video-frame { aspect-ratio:16/9; background:#000; display:flex; align-items:center; justify-content:center; }
.video-frame iframe { width:100%; height:100%; border:0; }
.video-meta { padding:1rem 1.1rem 1.2rem; font-size:.8rem; line-height:1.5; }

/* Utilities */
.visually-hidden { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; border:0; }

/* Responsive */
@media (max-width: 980px) {
  .portal-hero-inner { flex-direction:column; }
  .podcast-layout { grid-template-columns:1fr; }
  .filters-bar { top:56px; }
}
@media (max-width: 620px) {
  .filters-grid { gap:.55rem; }
  .filter-group { overflow-x:auto; flex-wrap:nowrap; scrollbar-width:none; }
  .filter-group::-webkit-scrollbar { display:none; }
  .portal-hero { padding:110px 0 60px; }
  .portal-progress-summary { width:100%; display:flex; align-items:center; justify-content:space-around; }
  .progress-ring { margin:0; }
  .media-grid { grid-template-columns:repeat(auto-fill,minmax(190px,1fr)); }
}
