/* =============================================
   Assignment 1 — Skeleton Visualizer Style
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #f7f6f2;
  --surface:  #ffffff;
  --surface2: #f0eeea;
  --border:   #e4e2dc;
  --accent:   #7c3aed;
  --high:     #16a34a;
  --med:      #d97706;
  --low:      #dc2626;
  --text:     #18181b;
  --text2:    #71717a;
  --text3:    #a1a1aa;
  --shadow:   0 4px 24px rgba(0,0,0,.08);
  --shadow-sm:0 1px 4px rgba(0,0,0,.06);
  --radius:   16px;
  --radius-sm:10px;
}

html, body { height:100%; font-family:'DM Sans',sans-serif; background:var(--bg); color:var(--text); -webkit-font-smoothing:antialiased; }

/* Header */
.app-header { display:flex; align-items:center; justify-content:space-between; padding:0 2rem; height:64px; background:var(--surface); border-bottom:1px solid var(--border); box-shadow:var(--shadow-sm); position:sticky; top:0; z-index:100; }
.header-logo { display:flex; align-items:center; gap:.65rem; }
.logo-icon { font-size:1.4rem; }
.logo-text { font-size:1.05rem; font-weight:600; letter-spacing:-.01em; }
.logo-text em { font-style:normal; color:var(--accent); }
.header-nav { display:flex; gap:.25rem; }
.nav-link { text-decoration:none; color:var(--text2); font-size:.875rem; font-weight:500; padding:.4rem .85rem; border-radius:8px; transition:background .15s, color .15s; }
.nav-link:hover { background:var(--surface2); color:var(--text); }
.nav-link.active { background:var(--accent); color:#fff; }

/* Layout */
.main-content { display:grid; grid-template-columns:1fr 300px; gap:1.5rem; padding:1.5rem 2rem; max-width:1200px; margin:0 auto; min-height:calc(100vh - 64px); }

/* Video */
.video-panel { display:flex; flex-direction:column; align-items:center; gap:1rem; }
.video-container { position:relative; width:100%; max-width:660px; border-radius:var(--radius); overflow:hidden; background:#0f0f1a; box-shadow:0 12px 48px rgba(124,58,237,.15); aspect-ratio:4/3; }
.video-container video, .video-container canvas { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.video-container canvas { z-index:2; }
.video-overlay { position:absolute; inset:0; z-index:10; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:1rem; background:rgba(250,249,246,.92); backdrop-filter:blur(8px); color:var(--text2); font-size:.9rem; font-weight:500; transition:opacity .4s; }
.video-overlay.hidden { opacity:0; pointer-events:none; }
.spinner { width:40px; height:40px; border:3px solid var(--border); border-top-color:var(--accent); border-radius:50%; animation:spin .8s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }
.corner { position:absolute; width:20px; height:20px; z-index:3; pointer-events:none; }
.corner.tl { top:12px; left:12px; border-top:2px solid rgba(255,255,255,.5); border-left:2px solid rgba(255,255,255,.5); border-radius:4px 0 0 0; }
.corner.tr { top:12px; right:12px; border-top:2px solid rgba(255,255,255,.5); border-right:2px solid rgba(255,255,255,.5); border-radius:0 4px 0 0; }
.corner.bl { bottom:12px; left:12px; border-bottom:2px solid rgba(255,255,255,.5); border-left:2px solid rgba(255,255,255,.5); border-radius:0 0 0 4px; }
.corner.br { bottom:12px; right:12px; border-bottom:2px solid rgba(255,255,255,.5); border-right:2px solid rgba(255,255,255,.5); border-radius:0 0 4px 0; }

/* Legend */
.legend-bar { display:flex; gap:1.5rem; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-sm); padding:.65rem 1.2rem; box-shadow:var(--shadow-sm); }
.legend-item { display:flex; align-items:center; gap:.45rem; font-size:.8rem; color:var(--text2); font-weight:500; }
.dot { width:12px; height:12px; border-radius:50%; display:inline-block; }
.dot.high { background:var(--high); }
.dot.med  { background:var(--med); }
.dot.low  { background:var(--low); }

/* Control Panel */
.control-panel { display:flex; flex-direction:column; gap:1rem; }
.stat-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-sm); padding:.9rem 1.1rem; display:flex; flex-direction:column; gap:.25rem; box-shadow:var(--shadow-sm); }
.stat-card.primary { border-left:3px solid var(--accent); }
.stat-label { font-size:.72rem; font-weight:600; letter-spacing:.06em; text-transform:uppercase; color:var(--text3); }
.stat-value { font-size:1.1rem; font-weight:600; color:var(--text); }
.stat-value.mono { font-family:'DM Mono',monospace; }
.stats-grid { display:grid; grid-template-columns:1fr 1fr; gap:.65rem; }

/* Toggles */
.toggle-group { display:flex; align-items:center; justify-content:space-between; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-sm); padding:.7rem 1rem; box-shadow:var(--shadow-sm); }
.toggle-label { font-size:.875rem; font-weight:500; color:var(--text); }
.switch { position:relative; display:inline-block; width:44px; height:24px; cursor:pointer; }
.switch input { opacity:0; width:0; height:0; }
.track { position:absolute; inset:0; background:var(--border); border-radius:99px; transition:background .2s; }
.track::before { content:''; position:absolute; width:18px; height:18px; left:3px; top:3px; background:#fff; border-radius:50%; transition:transform .2s; box-shadow:0 1px 4px rgba(0,0,0,.15); }
.switch input:checked + .track { background:var(--accent); }
.switch input:checked + .track::before { transform:translateX(20px); }

/* Sliders & Buttons */
.control-group { display:flex; flex-direction:column; gap:.5rem; }
.control-label { font-size:.78rem; font-weight:600; letter-spacing:.04em; text-transform:uppercase; color:var(--text2); }
.slider-row { display:flex; align-items:center; gap:.75rem; }
input[type=range] { flex:1; -webkit-appearance:none; height:5px; background:var(--border); border-radius:99px; outline:none; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance:none; width:18px; height:18px; background:var(--accent); border-radius:50%; cursor:pointer; box-shadow:0 0 0 3px rgba(124,58,237,.15); transition:box-shadow .2s; }
input[type=range]::-webkit-slider-thumb:hover { box-shadow:0 0 0 5px rgba(124,58,237,.2); }
.slider-val { font-family:'DM Mono',monospace; font-size:.82rem; font-weight:500; color:var(--accent); min-width:28px; text-align:right; }
.btn { width:100%; padding:.7rem 1rem; border:none; border-radius:var(--radius-sm); font-family:'DM Sans',sans-serif; font-size:.9rem; font-weight:600; cursor:pointer; transition:all .18s; }
.btn-primary { background:var(--accent); color:#fff; }
.btn-primary:hover { background:#6d28d9; transform:translateY(-1px); box-shadow:0 4px 16px rgba(124,58,237,.3); }

/* Segment card */
.segment-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-sm); padding:1rem; box-shadow:var(--shadow-sm); flex:1; overflow-y:auto; max-height:300px; }
.list-title { font-size:.78rem; font-weight:700; letter-spacing:.05em; text-transform:uppercase; color:var(--text2); margin-bottom:.75rem; }
.segment-list { display:flex; flex-direction:column; gap:.4rem; }
.seg-item { display:flex; justify-content:space-between; align-items:center; padding:.4rem .65rem; background:var(--surface2); border-radius:7px; font-size:.8rem; }
.seg-name { font-weight:600; color:var(--text); }
.seg-bar-wrap { flex:1; margin:0 .75rem; height:5px; background:var(--border); border-radius:99px; overflow:hidden; }
.seg-bar { height:100%; border-radius:99px; background:var(--accent); transition:width .3s; }
.seg-score { font-family:'DM Mono',monospace; font-weight:500; color:var(--text2); min-width:36px; text-align:right; }

@media (max-width:860px) {
  .main-content { grid-template-columns:1fr; }
  .legend-bar { justify-content:center; }
}
@media (max-width:540px) {
  .app-header { padding:0 1rem; }
  .main-content { padding:1rem; }
  .header-nav .nav-link { font-size:.75rem; padding:.3rem .55rem; }
}
