/* 독립 동영상 편집 사이트 스타일 (메인 사이트 편집 UI 규칙에서 파생) */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: #eef2f7; color: #0f172a; font-family: "Apple SD Gothic Neo","Malgun Gothic","Noto Sans KR",system-ui,sans-serif; font-size: 14px; line-height: 1.5; }
a { color: #1d4ed8; text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { margin: 0 0 12px; font-size: 22px; }
h3, h4 { margin: 0; }
label { display: block; margin: 0 0 8px; font-size: 13px; font-weight: 600; color: #334155; }
input[type="text"], input[type="password"], input[type="number"], input[type="search"], select, textarea { width: 100%; min-height: 34px; margin-top: 4px; padding: 6px 9px; border: 1px solid #cbd5e1; background: #fff; color: inherit; font: inherit; }
input[type="file"] { width: 100%; margin-top: 4px; font: inherit; }
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 6px 14px; border: 1px solid #1d4ed8; background: #2563eb; color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
button:hover, .btn:hover { background: #1d4ed8; text-decoration: none; }
.btn-light, button.btn-light { border-color: #cbd5e1; background: #f8fafc; color: #334155; }
.btn-light:hover, button.btn-light:hover { border-color: #93c5fd; background: #eff6ff; }
button.danger { border-color: #b91c1c; background: #dc2626; }
button.danger:hover { background: #b91c1c; }
button:disabled { opacity: .55; cursor: default; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 18px; border-bottom: 1px solid #dbe4f0; background: #fff; }
.brand { color: #0f172a; font-size: 17px; font-weight: 800; }
.topnav { display: flex; align-items: center; gap: 12px; }
.topnav .user { color: #475569; font-weight: 700; }
.logout-form { margin: 0; }
.logout-form button { min-height: 30px; padding: 4px 10px; }
.theme-toggle { min-height: 30px; padding: 4px 10px; border-color: #cbd5e1; background: #f8fafc; color: #334155; }
.container { max-width: 1100px; margin: 0 auto; padding: 18px 16px 60px; }

.flash { margin: 0 0 14px; padding: 10px 13px; border: 1px solid #93c5fd; background: #eff6ff; color: #1e40af; font-weight: 600; }
.flash-error { border-color: #fca5a5; background: #fef2f2; color: #b91c1c; }
.empty { padding: 26px; border: 1px dashed #cbd5e1; background: #f8fafc; color: #64748b; text-align: center; }
.muted { color: #64748b; font-size: 13px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.login-panel { max-width: 380px; margin: 48px auto 0; padding: 26px; border: 1px solid #dbe4f0; background: #fff; }
.login-form button { width: 100%; margin-top: 6px; }

.upload-panel { margin-bottom: 18px; padding: 16px; border: 1px solid #dbe4f0; background: #fff; }
.upload-form { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.upload-form label { flex: 1 1 320px; margin: 0; }
.upload-form button { flex: 0 0 auto; }

.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.video-card-item { display: flex; flex-direction: column; border: 1px solid #dbe4f0; background: #fff; }
.video-card-link { display: flex; flex-direction: column; color: inherit; }
.video-card-link:hover { text-decoration: none; }
.video-card-link img { display: block; width: 100%; aspect-ratio: 16/9; object-fit: cover; background: #0f172a; }
.video-card-name { padding: 9px 10px 2px; font-weight: 700; overflow-wrap: anywhere; }
.video-card-meta { padding: 0 10px 9px; color: #64748b; font-size: 12px; }
.video-card-actions { display: flex; gap: 6px; padding: 0 10px 10px; }
.video-card-actions form { margin: 0; margin-left: auto; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.breadcrumbs { color: #475569; }
.toolbar-actions { display: flex; gap: 8px; }
.viewer { margin-bottom: 16px; background: #000; text-align: center; }
.viewer video { display: block; width: 100%; max-height: 72vh; background: #000; }
#mediaVideoPlayer.is-floating { position: fixed; right: 14px; bottom: 14px; z-index: 60; width: min(380px,48vw); height: auto; background: #000; box-shadow: 0 12px 34px rgba(0,0,0,.45); border: 1px solid #334155; }

.media-description-panel { margin-top: 16px; padding: 16px; border: 1px solid #dbe4f0; background: #fff; }
.media-description-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.media-description-heading small { color: #64748b; }
.split-file-list { margin: 0; padding-left: 20px; }

/* ── 동영상 편집 패널 ── */
.video-split-form { display: grid; gap: 14px; }
.video-split-mode { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.video-split-mode label { display: flex; gap: 6px; align-items: center; margin: 0; font-weight: 600; color: #334155; }
.video-split-mode input { width: auto; min-height: 0; }
.video-split-mode-help { flex: 1 1 260px; color: #64748b; font-size: 12px; line-height: 1.5; }
.video-split-full-option { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; padding: 9px 12px; border: 1px dashed #93c5fd; background: #eff6ff; color: #1e40af; font-size: 13px; font-weight: 600; cursor: pointer; }
.video-split-full-option input { width: auto; min-height: 0; }
.video-cut-mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; align-items: start; }
.video-cut-mode-box { display: grid; gap: 8px; padding: 12px; border: 1px solid #e2e8f0; background: #f8fafc; }
.video-cut-mode-box.is-on { border: 2px solid #2563eb; background: #eff6ff; box-shadow: 0 0 0 2px rgba(37,99,235,.12); }
.video-cut-mode-title { display: flex; gap: 6px; align-items: center; margin: 0; font-weight: 700; color: #334155; cursor: pointer; }
.video-cut-mode-title input { width: auto; min-height: 0; }
.video-cut-mode-box.is-on .video-cut-mode-title { color: #1d4ed8; }
.video-cut-mode-desc { margin: 0; color: #64748b; font-size: 12px; line-height: 1.5; }
.video-cut-mode-fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.video-cut-mode-fieldset[disabled] { opacity: .45; pointer-events: none; }
.video-split-marker { display: grid; gap: 8px; padding: 12px; border: 1px solid #dbe4f0; background: #fff; }
.video-split-marker-times { display: flex; justify-content: space-between; gap: 12px; color: #475569; font-size: 13px; }
.video-split-marker-times b { font-family: ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; color: #0f172a; }
.video-split-track { position: relative; height: 52px; background: linear-gradient(#cbd5e1,#cbd5e1) center/100% 8px no-repeat; touch-action: none; cursor: pointer; }
.video-split-range { position: absolute; top: 22px; left: 0; width: 100%; height: 8px; background: #2563eb; pointer-events: none; }
.video-split-points { position: absolute; inset: 0; pointer-events: none; }
.video-cut-point-mark { position: absolute; top: 6px; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border: 2px solid #fff; background: #7c3aed; color: #fff; font-size: 11px; font-weight: 800; transform: translateX(-50%); box-shadow: 0 2px 8px rgba(15,23,42,.25); }
.video-split-handle { position: absolute; top: 50%; width: 22px; height: 38px; min-height: 0; padding: 0; border: 2px solid #fff; background: #1d4ed8; box-shadow: 0 2px 8px rgba(15,23,42,.25); transform: translate(-50%,-50%); cursor: grab; }
.video-split-handle:focus-visible { outline: 3px solid rgba(37,99,235,.35); outline-offset: 3px; }
.video-split-handle:active { cursor: grabbing; }
.video-split-handle.is-end { background: #dc2626; }
.video-split-handle.is-point { background: #7c3aed; }
.video-split-nudge { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.video-split-nudge span { color: #475569; font-size: 13px; font-weight: 700; }
.video-split-nudge button { min-width: 38px; padding-inline: 10px; }
.video-cut-point-panel { display: grid; gap: 10px; padding: 12px; border: 1px solid #e2e8f0; background: #fff; }
.video-cut-point-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.video-cut-point-head span { color: #64748b; font-size: 13px; }
.video-cut-point-current { display: flex; align-items: center; gap: 6px; color: #475569; font-size: 13px; font-weight: 600; }
.video-cut-point-current b { font-family: ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; color: #0f172a; }
.video-cut-point-current button { min-width: 38px; padding-inline: 10px; }
.video-cut-point-list { display: flex; flex-wrap: wrap; gap: 8px; min-height: 34px; align-items: center; }
.video-cut-point-item { display: inline-flex; gap: 6px; align-items: center; }
.video-cut-point-empty { color: #94a3b8; font-size: 13px; }
.video-split-rows { display: grid; gap: 10px; }
.video-split-row { display: grid; grid-template-columns: auto minmax(150px,1fr) minmax(150px,1fr) auto auto auto; gap: 8px; align-items: end; padding: 10px; border: 1px solid #e2e8f0; background: #fff; }
.video-split-row.is-active { border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,.14); }
.video-split-row-number { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 42px; background: #e2e8f0; color: #0f172a; font-size: 14px; }
.video-split-row label { margin: 0; }
.video-split-overlap-warning { padding: 9px 12px; border: 1px solid #fca5a5; background: #fef2f2; color: #b91c1c; font-size: 13px; font-weight: 700; }
.video-split-intro { grid-column: 1 / -1; padding: 8px 10px; border: 1px dashed #cbd5e1; background: #f8fafc; }
.video-split-intro summary { cursor: pointer; color: #475569; font-size: 12px; font-weight: 700; }
.video-split-intro-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; align-items: end; }
.video-split-intro-fields label { display: block; margin: 0; min-width: 0; font-size: 12px; }
.video-split-intro-fields input[type="file"] { width: 100%; max-width: 100%; }
.video-split-intro-fields input[type="number"] { width: 100%; }
.intro-field-upload { grid-column: 1; }
.intro-field-seconds { grid-column: 2; }
.intro-field-text { grid-column: 1 / -1; }
.video-split-intro-note { margin: 6px 0 0; color: #94a3b8; font-size: 11px; }
.video-split-addrow { justify-content: center; margin-top: 14px; }
.video-split-submit { justify-content: center; }

/* 대기 오버레이 */
.wait-overlay { position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center; padding: 18px; background: rgba(15,23,42,.56); backdrop-filter: blur(5px); }
.wait-overlay-card { width: min(430px,100%); padding: 28px; background: #fff; color: #0f172a; text-align: center; box-shadow: 0 24px 80px rgba(15,23,42,.28); }
.wait-overlay-card h2 { margin: 12px 0 8px; }
.wait-overlay-card p { margin: 0 0 18px; color: #475569; }
.wait-overlay-card small { display: block; margin-top: 13px; color: #64748b; line-height: 1.45; }
.wait-spinner { width: 52px; height: 52px; margin: 0 auto; border-radius: 999px; border: 5px solid #dbeafe; border-top-color: #2563eb; animation: wait-spin .9s linear infinite; }
.wait-progress { height: 10px; overflow: hidden; background: #e2e8f0; }
.wait-progress span { display: block; width: 42%; height: 100%; background: linear-gradient(90deg,#f97316,#2563eb); animation: wait-progress 1.25s ease-in-out infinite; }
@keyframes wait-spin { to { transform: rotate(360deg); } }
@keyframes wait-progress { 0% { transform: translateX(-110%); } 50% { transform: translateX(70%); } 100% { transform: translateX(250%); } }

/* 다크 테마 */
html[data-theme="dark"] body { background: #0b1220; color: #e5e7eb; }
html[data-theme="dark"] .topbar { border-color: #263244; background: #101a2b; }
html[data-theme="dark"] .brand { color: #e5e7eb; }
html[data-theme="dark"] a { color: #93c5fd; }
html[data-theme="dark"] label, html[data-theme="dark"] .video-split-mode label, html[data-theme="dark"] .video-cut-mode-title { color: #cbd5e1; }
html[data-theme="dark"] input[type="text"], html[data-theme="dark"] input[type="password"], html[data-theme="dark"] input[type="number"], html[data-theme="dark"] input[type="search"], html[data-theme="dark"] select, html[data-theme="dark"] textarea { border-color: #334155; background: #0f172a; color: #e5e7eb; }
html[data-theme="dark"] .btn-light, html[data-theme="dark"] button.btn-light, html[data-theme="dark"] .theme-toggle { border-color: #334155; background: #131c2d; color: #dbeafe; }
html[data-theme="dark"] .login-panel, html[data-theme="dark"] .upload-panel, html[data-theme="dark"] .video-card-item, html[data-theme="dark"] .media-description-panel { border-color: #263244; background: #101a2b; }
html[data-theme="dark"] .flash { border-color: #1d4ed8; background: #172554; color: #93c5fd; }
html[data-theme="dark"] .flash-error { border-color: #7f1d1d; background: #450a0a; color: #fca5a5; }
html[data-theme="dark"] .empty { border-color: #334155; background: #0f172a; color: #94a3b8; }
html[data-theme="dark"] .video-cut-mode-box { border-color: #334155; background: #0f172a; }
html[data-theme="dark"] .video-cut-mode-box.is-on { border-color: #3b82f6; background: #172554; box-shadow: 0 0 0 2px rgba(59,130,246,.18); }
html[data-theme="dark"] .video-cut-mode-box.is-on .video-cut-mode-title { color: #93c5fd; }
html[data-theme="dark"] .video-split-marker, html[data-theme="dark"] .video-cut-point-panel, html[data-theme="dark"] .video-split-row { border-color: #334155; background: #0f172a; }
html[data-theme="dark"] .video-split-marker-times b, html[data-theme="dark"] .video-cut-point-current b { color: #e5e7eb; }
html[data-theme="dark"] .video-split-row-number { background: #263244; color: #e5e7eb; }
html[data-theme="dark"] .video-split-intro { border-color: #334155; background: #0f172a; }
html[data-theme="dark"] .video-split-full-option { border-color: #1d4ed8; background: #172554; color: #93c5fd; }
html[data-theme="dark"] .video-split-overlap-warning { border-color: #7f1d1d; background: #450a0a; color: #fca5a5; }
html[data-theme="dark"] .wait-overlay-card { background: #101a2b; color: #e5e7eb; }
html[data-theme="dark"] .wait-overlay-card p, html[data-theme="dark"] .wait-overlay-card small { color: #94a3b8; }

@media(max-width:900px){ .video-cut-mode-grid { grid-template-columns: 1fr; } }
@media(max-width:760px){
  .video-split-row { grid-template-columns: auto 1fr 1fr; }
  .video-split-row button { width: 100%; }
  .video-split-intro-fields { grid-template-columns: 1fr; }
  .intro-field-upload, .intro-field-seconds, .intro-field-text { grid-column: 1; }
  #mediaVideoPlayer.is-floating { width: min(300px,62vw); right: 8px; bottom: 8px; }
}
