/* ASTC Video Vault — 기존 LMS(css/styles.css) 스타일 계열을 계승한 단일 CSS. */
:root {
  --primary: #1a4d8f;
  --primary-dark: #143b6e;
  --bg: #f4f6f9;
  --border: #d5dbe3;
  --text: #222;
  --muted: #667;
  --danger: #c0392b;
  --ok: #1e8449;
}

* { box-sizing: border-box; }

/* HTML hidden 속성이 아래 display 규칙보다 우선하도록 강제. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  color: var(--text);
  background: var(--bg);
}

a { color: var(--primary); }

/* ── 로그인/가입/대기 화면 (중앙 카드) ── */
.center-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.card-box {
  background: #fff;
  padding: 2rem;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.card-box h1 { font-size: 1.25rem; margin: 0; text-align: center; }
.card-box .subtitle { margin: 0 0 0.5rem; text-align: center; color: var(--muted); font-size: 0.9rem; }
.card-box label { display: flex; flex-direction: column; font-size: 0.85rem; gap: 0.25rem; }
.error { color: var(--danger); font-size: 0.85rem; margin: 0.25rem 0 0; min-height: 1em; }
.hint { color: var(--muted); font-size: 0.8rem; margin: 0; }
.switch-line { text-align: center; font-size: 0.85rem; margin: 0.25rem 0 0; }

/* ── 상단바 ── */
.topbar {
  background: var(--primary);
  color: #fff;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.topbar h1 { font-size: 1.05rem; margin: 0; }
.topbar h1 a { color: #fff; text-decoration: none; }
.nav-links { display: flex; gap: 0.35rem; margin-left: 0.5rem; margin-right: auto; flex-wrap: wrap; }
.nav-links a {
  color: #fff; text-decoration: none; font-size: 0.78rem;
  border: 1px solid rgba(255, 255, 255, 0.45); border-radius: 999px; padding: 0.15rem 0.6rem;
  white-space: nowrap;
}
.nav-links a:hover, .nav-links a.active { background: rgba(255, 255, 255, 0.15); }
.user-box { display: flex; align-items: center; gap: 0.75rem; font-size: 0.85rem; }

main { padding: 1rem; max-width: 1100px; margin: 0 auto; }
h2 { font-size: 1.1rem; }

/* ── 공통 폼·버튼 ── */
input, select, textarea {
  font: inherit;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}
button {
  font: inherit;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
}
button:hover { background: var(--primary-dark); }
button:disabled { background: #9aa7b8; cursor: not-allowed; }
button.secondary { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
button.secondary:hover { background: #eef3fa; }
button.danger { background: var(--danger); }
button.small { padding: 0.25rem 0.6rem; font-size: 0.8rem; }

.entry-form {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.entry-form label { display: flex; flex-direction: column; font-size: 0.85rem; gap: 0.25rem; }

/* ── 목록 필터 줄 ── */
.filter-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 0.75rem;
}
.filter-row input[type="search"] { flex: 1; min-width: 160px; }

/* ── 용량 게이지 ── */
.gauge-wrap {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  margin-bottom: 0.75rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.gauge-bar {
  height: 8px;
  background: #e6eaf0;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.35rem;
}
.gauge-fill { height: 100%; background: var(--primary); border-radius: 999px; width: 0; }
.gauge-fill.warn { background: var(--danger); }

/* ── 비디오 카드 목록 ── */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.75rem;
}
.video-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  text-decoration: none;
  color: inherit;
}
.video-card:hover { border-color: var(--primary); }
.video-card .v-title { font-weight: 600; }
.video-card .v-meta { font-size: 0.78rem; color: var(--muted); }
.badge {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.72rem;
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
}

/* ── 테이블 (관리 화면) ── */
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--border); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 0.85rem; }
th, td { border-bottom: 1px solid var(--border); padding: 0.5rem 0.6rem; text-align: left; white-space: nowrap; }
th { background: #f0f3f7; font-weight: 600; }
tr:last-child td { border-bottom: none; }

/* ── 재생 화면 ── */
.player-box { background: #000; border-radius: 8px; overflow: hidden; }
.player-box video { display: block; width: 100%; max-height: 70vh; background: #000; }
.watch-meta { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 1rem; margin-top: 0.75rem; }
.watch-meta h2 { margin: 0 0 0.35rem; }
.watch-meta .v-meta { color: var(--muted); font-size: 0.85rem; }
.watch-meta p.desc { white-space: pre-wrap; margin: 0.75rem 0 0; }
.watch-actions { margin-top: 0.75rem; display: flex; gap: 0.5rem; }

/* ── 일괄 업로드: 드롭존 ── */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  background: #fafbfd;
}
.dropzone.dragover { border-color: var(--primary); background: #eef3fa; color: var(--primary); }

/* ── 업로드 진행률 ── */
.progress-wrap { margin-top: 0.25rem; }
.progress-bar { height: 10px; background: #e6eaf0; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--ok); transition: width 0.15s; }
.progress-text { font-size: 0.8rem; color: var(--muted); margin-top: 0.25rem; }

.empty { color: var(--muted); text-align: center; padding: 2rem 0; }
.ok-msg { color: var(--ok); font-size: 0.85rem; }
