/* 강의영상 · 로그인 · 관리자 화면 공통 스타일 (메인 index.html 과 같은 색) */
:root {
  --night: #1b1a20;
  --night-2: #2b2835;
  --sky: #7aaad8;
  --lav: #6a71aa;
  --paper: #ffffff;
  --mist: #f3f4f8;
  --ink: #1f1e26;
  --muted: #646778;
  --line: #e2e4ec;
  --danger: #c2373b;
  --grad: linear-gradient(90deg, var(--sky), var(--lav));
  --font-display: "Black Han Sans", "IBM Plex Sans KR", sans-serif;
  --font-body: "IBM Plex Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--mist); color: var(--ink); font-family: var(--font-body); font-size: 16px; line-height: 1.6; word-break: keep-all; overflow-wrap: anywhere; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--lav); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; margin: 0; line-height: 1.2; text-wrap: balance; }
.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sr { position: absolute; left: -9999px; }

/* 헤더 */
header.app { background: var(--night); color: #fff; }
.bar { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 16px; flex-wrap: wrap; }
.logo { font-family: var(--font-display); font-size: 22px; text-decoration: none; }
.who { display: flex; align-items: center; gap: 14px; font-size: 14px; color: #d9dbe6; flex-wrap: wrap; }
.who a, .who button { color: #d9dbe6; text-decoration: none; background: none; border: 0; cursor: pointer; padding: 0; font-size: 14px; }
.who a:hover, .who button:hover { color: #fff; }
.who .admin-link { border: 1px solid #4a4658; border-radius: 999px; padding: 4px 12px; }

.top { background: var(--night); color: #fff; padding: 28px 0 0; }
.top h1 { font-size: clamp(32px, 5vw, 48px); }
.top p { margin: 6px 0 0; color: #b9bccb; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip-s { font-size: 13px; padding: 3px 10px; border-radius: 999px; background: var(--night-2); color: #c5c9f0; border: 1px solid #3d3950; }

.tabs { display: flex; gap: 4px; margin-top: 24px; overflow-x: auto; }
.tab { flex: 0 0 auto; text-decoration: none; padding: 14px 26px 12px; border-radius: 12px 12px 0 0; color: #c8cad6; font-weight: 700; font-size: 17px; display: flex; gap: 8px; align-items: baseline; border: 0; background: none; cursor: pointer; }
.tab:hover { color: #fff; background: var(--night-2); }
.tab[aria-current="page"] { background: var(--mist); color: var(--ink); }
.tab small { font-weight: 500; font-size: 13px; opacity: .7; font-variant-numeric: tabular-nums; }

/* 버튼·입력 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; padding: 9px 16px; border-radius: 999px; font-weight: 700; font-size: 14px; border: 1px solid var(--line); background: var(--paper); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--lav); }
.btn.fill { background: var(--grad); color: #fff; border-color: transparent; }
.btn.fill:hover { filter: brightness(1.06); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btn.sm { padding: 5px 11px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: default; }
label { display: grid; gap: 6px; font-size: 14px; font-weight: 500; }
input, select, textarea { font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--lav); }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--lav); margin: 0; }

/* 카드·빈 화면 */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.empty { background: var(--paper); border: 1px dashed var(--line); border-radius: 14px; padding: 28px; color: var(--muted); text-align: center; }
.empty b { color: var(--ink); }
.block-title { font-size: 13px; font-weight: 700; color: var(--muted); margin: 0 0 10px; }

/* 레이아웃: 왼쪽 트리 / 오른쪽 본문 */
.layout { display: grid; grid-template-columns: 280px 1fr; gap: 24px; padding: 28px 0 64px; align-items: start; }
.side { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 14px 10px; position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; }
.side-head { font-size: 13px; font-weight: 700; color: var(--muted); padding: 0 8px 8px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.main { display: grid; gap: 20px; min-width: 0; align-content: start; }

/* 폴더 트리 */
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { padding-left: 16px; }
.node { display: flex; align-items: center; gap: 2px; }
.caret { width: 26px; height: 30px; border: 0; background: none; cursor: pointer; color: var(--muted); flex: 0 0 auto; border-radius: 6px; }
.caret:hover { background: var(--mist); }
.caret.blank { visibility: hidden; }
.folder-btn { flex: 1; min-width: 0; text-align: left; border: 0; background: none; cursor: pointer; padding: 5px 8px; border-radius: 8px; display: flex; gap: 8px; align-items: center; font-size: 15px; }
.folder-btn:hover { background: var(--mist); }
.folder-btn[aria-current="true"] { background: #e8ebfa; color: #3f4690; font-weight: 700; }
.ico { width: 16px; height: 12px; border-radius: 2px 3px 3px 3px; background: var(--sky); position: relative; flex: 0 0 auto; margin-top: 2px; }
.ico::before { content: ""; position: absolute; left: 0; top: -3px; width: 7px; height: 4px; background: var(--sky); border-radius: 2px 2px 0 0; }
.folder-btn .name { flex: 1; min-width: 0; }
.cnt { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.crumbs { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 15px; }
.crumbs button { border: 0; background: none; cursor: pointer; padding: 4px 6px; border-radius: 6px; color: var(--muted); }
.crumbs button:hover { background: var(--paper); color: var(--ink); }
.crumbs button:last-child { color: var(--ink); font-weight: 700; }
.crumbs span { color: #b3b6c4; }
.search input { font-size: 15px; padding: 9px 14px; border-radius: 999px; width: 240px; max-width: 100%; }

/* 폴더 카드 */
.folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.fcard { border: 1px solid var(--line); background: var(--paper); border-radius: 14px; padding: 16px; text-align: left; cursor: pointer; display: grid; gap: 6px; }
.fcard:hover { border-color: var(--lav); }
.fcard .ico { width: 26px; height: 19px; }
.fcard .ico::before { width: 11px; height: 6px; top: -5px; }
.fcard b { font-size: 16px; }
.fcard span { font-size: 13px; color: var(--muted); }

/* 영상 목록 */
.vlist { list-style: none; margin: 0; padding: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.vlist > li + li { border-top: 1px solid var(--line); }
.vbtn { width: 100%; border: 0; background: none; cursor: pointer; text-align: left; padding: 14px 18px; display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center; }
.vbtn:hover:not(:disabled) { background: var(--mist); }
.vbtn:disabled { cursor: default; }
.vbtn.playing { background: #eef1fc; }
.play { width: 34px; height: 34px; border-radius: 50%; background: var(--grad); position: relative; flex: 0 0 auto; }
.play::after { content: ""; position: absolute; left: 13px; top: 10px; border-left: 11px solid #fff; border-top: 7px solid transparent; border-bottom: 7px solid transparent; }
.vbtn:disabled .play, .play.off { background: var(--line); }
.vtitle { font-weight: 500; }
.vpath { display: block; font-size: 13px; color: var(--muted); font-weight: 400; }
.pill { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.pill.ready { background: #e8ebfa; color: #4a51a0; }
.pill.wait { background: var(--mist); color: var(--muted); }

/* 플레이어 */
.player { background: var(--night); color: #fff; border-radius: 16px; overflow: hidden; }
.player[hidden] { display: none; }
.frame { aspect-ratio: 16 / 9; background: #000; display: grid; place-items: center; }
.frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.frame p { color: #b9bccb; padding: 24px; text-align: center; margin: 0; }
.player-info { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; padding: 14px 18px; }
.player-info b { font-size: 17px; }
.player-info .path { font-size: 13px; color: #9fa3b8; display: block; font-weight: 400; }
.player-info a { color: var(--sky); font-size: 14px; text-decoration: none; white-space: nowrap; }
.close { border: 1px solid #4a4658; background: none; color: #fff; border-radius: 999px; padding: 4px 12px; font-size: 13px; cursor: pointer; }

/* 대화상자 */
dialog { border: 0; border-radius: 16px; padding: 0; width: min(440px, 100% - 32px); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(20,18,28,.55); }
dialog form { padding: 24px; display: grid; gap: 14px; }
dialog h3 { font-size: 22px; }
dialog p { margin: 0; color: var(--muted); white-space: pre-line; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

/* 알림 */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--night); color: #fff; padding: 12px 20px; border-radius: 999px; font-size: 14px; z-index: 50; max-width: calc(100% - 32px); box-shadow: 0 8px 30px rgba(0,0,0,.2); }
.toast.err { background: var(--danger); }
.toast[hidden] { display: none; }

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; max-height: 300px; }
  .search { flex: 1 1 100%; }
  .search input { width: 100%; }
  .tab { padding: 12px 18px 10px; }
}
@media (max-width: 420px) {
  .vbtn { grid-template-columns: 30px 1fr; padding: 12px 14px; }
  .vbtn .pill { grid-column: 2; justify-self: start; }
  .play { width: 30px; height: 30px; }
  .play::after { left: 11px; top: 8px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
