/* ─── Variables ──────────────────────────────────────────────────── */
:root {
  --c-primary: #2563EB;
  --c-primary-h: #1D4ED8;
  --c-primary-light: #EFF6FF;
  --c-danger: #DC2626;
  --c-warning: #F59E0B;
  --c-success: #059669;
  --c-bg: #F7F7F8;
  --c-surface: #FFFFFF;
  --c-border: #E0E0E0;
  --c-text: #1A1A1A;
  --c-muted: #6B7280;
  --font: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Yu Gothic UI', 'Inter', sans-serif;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* ─── Reset & Base ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--c-text);
  background: var(--c-bg);
  overflow: hidden;
  height: 100vh;
}

/* ─── Layout ─────────────────────────────────────────────────────── */
.app {
  display: flex;
  height: 100vh;
}
.sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--c-surface);
  border-right: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ─── Sidebar ────────────────────────────────────────────────────── */
.sidebar-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--c-border);
  font-size: 16px;
  font-weight: 600;
}
.sidebar-section {
  padding: 12px 16px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.category-list {
  list-style: none;
  padding: 4px 8px;
}
.category-item {
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.1s;
}
.category-item:hover { background: var(--c-bg); }
.category-item.active {
  background: var(--c-primary-light);
  color: var(--c-primary);
  font-weight: 500;
}
.category-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--c-muted);
  background: var(--c-bg);
  padding: 1px 6px;
  border-radius: 10px;
}

.script-list {
  list-style: none;
  padding: 4px 8px;
  flex: 1;
  overflow-y: auto;
}
.script-item {
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  border-bottom: 1px solid var(--c-bg);
  transition: background 0.1s;
}
.script-item:hover { background: var(--c-bg); }
.script-item.active { background: var(--c-primary-light); }
.script-item-title {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.script-item-meta {
  font-size: 11px;
  color: var(--c-muted);
  margin-top: 2px;
}

/* ─── Main Header ────────────────────────────────────────────────── */
.main-header {
  padding: 12px 24px;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-surface);
  display: flex;
  align-items: center;
  gap: 12px;
}
.main-header h2 {
  font-size: 15px;
  font-weight: 600;
  flex: 1;
}

/* ─── Main Content ───────────────────────────────────────────────── */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* ─── Input Form ─────────────────────────────────────────────────── */
.input-form {
  background: var(--c-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  max-width: 720px;
  margin: 0 auto 24px;
}
.input-form h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
}
.input-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  border: 1px solid var(--c-border);
  border-radius: 6px;
  overflow: hidden;
}
.input-tab {
  flex: 1;
  padding: 8px 12px;
  border: none;
  background: var(--c-bg);
  font-size: 13px;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s;
}
.input-tab.active {
  background: var(--c-primary);
  color: white;
  font-weight: 500;
}
.input-tab:not(:last-child) { border-right: 1px solid var(--c-border); }

.form-row {
  margin-bottom: 12px;
}
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--c-muted);
  margin-bottom: 4px;
}
.form-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--c-border);
  border-radius: 6px;
  font-size: 14px;
  font-family: var(--font);
  transition: border-color 0.15s;
}
.form-input:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.form-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--c-border);
  border-radius: 6px;
  font-size: 14px;
  background: var(--c-surface);
  cursor: pointer;
}

/* ─── Drop Zone ──────────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--c-border);
  border-radius: var(--radius);
  padding: 32px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 12px;
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--c-primary);
  background: var(--c-primary-light);
}
.drop-zone-icon { font-size: 32px; margin-bottom: 8px; }
.drop-zone-text { font-size: 13px; color: var(--c-muted); }
.drop-zone-file {
  font-size: 13px;
  font-weight: 500;
  color: var(--c-primary);
  margin-top: 4px;
}

/* ─── Button ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 20px;
  border-radius: 6px;
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--c-primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--c-primary-h); }
.btn-danger { background: var(--c-danger); color: white; }
.btn-danger:hover:not(:disabled) { background: #B91C1C; }
.btn-ghost {
  background: transparent;
  color: var(--c-muted);
  border: 1px solid var(--c-border);
}
.btn-ghost:hover:not(:disabled) { background: var(--c-bg); }
.btn-sm { padding: 4px 12px; font-size: 12px; }

/* ─── Progress ───────────────────────────────────────────────────── */
.progress-container {
  max-width: 720px;
  margin: 0 auto 24px;
  background: var(--c-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.progress-bar-wrap {
  background: #E5E7EB;
  border-radius: 4px;
  height: 8px;
  overflow: hidden;
  margin-top: 12px;
}
.progress-bar {
  background: var(--c-warning);
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}
.progress-step {
  font-size: 13px;
  color: var(--c-muted);
  margin-top: 8px;
}

/* ─── Script View ────────────────────────────────────────────────── */
.script-view {
  max-width: 960px;
  margin: 0 auto;
}
.script-meta {
  background: var(--c-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  margin-bottom: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.meta-item label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 2px;
}
.meta-item span {
  font-size: 14px;
}

.script-table-wrap {
  background: var(--c-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.script-table {
  width: 100%;
  border-collapse: collapse;
}
.script-table th {
  background: #1C4587;
  color: white;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}
.script-table td {
  padding: 10px 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--c-border);
  vertical-align: top;
  line-height: 1.5;
}
.script-table tr:nth-child(even) td { background: #F9FAFB; }
.script-table td:first-child {
  width: 40px;
  text-align: center;
  font-weight: 600;
  color: var(--c-muted);
}
.col-video { width: 20%; }
.col-line { width: 25%; }
.col-shoot { width: 25%; }
.col-edit { width: 25%; }

.script-actions {
  padding: 16px 24px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  border-top: 1px solid var(--c-border);
}

/* ─── Empty State ────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--c-muted);
}
.empty-state-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state-text { font-size: 14px; }

/* ─── Toast ──────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: 8px;
  background: var(--c-text);
  color: white;
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 1000;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s, transform 0.3s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--c-danger); }
.toast.success { background: var(--c-success); }

/* ─── Hidden ─────────────────────────────────────────────────────── */
.hidden { display: none !important; }
