/* ============================================================
   COMPONENTS.CSS — Shared UI Components
   ============================================================ */

/* ── SCENE CARD (Script View) ───────────────────────────────── */
.scene-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  overflow: hidden;
  transition: border-color var(--dur-fast) var(--ease);
}
.scene-card:hover { border-color: var(--border-default); }
.scene-card.active { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold-glow); }

.scene-card-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  user-select: none;
}
.scene-card-header:hover { background: var(--bg-hover); }
.scene-number-badge {
  background: var(--gold);
  color: #0a0900;
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  flex-shrink: 0;
}
.scene-heading-text {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex: 1;
}
.scene-meta-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.scene-meta-chip {
  font-size: 11px; padding: 2px 8px; border-radius: 10px;
  background: var(--bg-active); color: var(--text-muted);
  border: 1px solid var(--border-default);
}
.scene-expand-btn { color: var(--text-muted); font-size: 18px; transition: transform var(--dur-fast) var(--ease); flex-shrink: 0; }
.scene-card.expanded .scene-expand-btn { transform: rotate(180deg); }

.scene-card-body { padding: 18px; display: none; }
.scene-card.expanded .scene-card-body { display: block; }

.scene-status-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }

/* Script-formatted text areas */
.script-action {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 14px;
  white-space: pre-wrap;
  padding: 12px 16px;
  background: var(--bg-panel);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}
.dialogue-block {
  margin: 12px 0;
  padding: 12px 16px 12px 32px;
  border-left: 3px solid var(--border-default);
  background: var(--bg-panel);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
.dialogue-speaker {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}
.dialogue-text {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.scene-edit-textarea {
  width: 100%; min-height: 120px;
  font-family: var(--font-mono); font-size: 13px;
  resize: vertical; line-height: 1.7;
}

/* ── BREAKDOWN TABLE ────────────────────────────────────────── */
.breakdown-section { margin-bottom: 28px; }
.breakdown-scene-header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 14px; padding: 14px 18px;
  background: var(--bg-panel); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}
.breakdown-category-tabs {
  display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px;
}
.breakdown-cat-tab {
  padding: 5px 12px; border-radius: 20px; font-size: 11px; font-weight: 600;
  border: 1px solid var(--border-default); color: var(--text-muted);
  transition: all var(--dur-fast) var(--ease); cursor: pointer;
}
.breakdown-cat-tab.active { background: var(--gold-glow); color: var(--gold); border-color: rgba(245,166,35,0.3); }
.breakdown-cat-tab:hover:not(.active) { background: var(--bg-hover); color: var(--text-secondary); }

/* ── SHOT LIST ──────────────────────────────────────────────── */
.shot-row { position: relative; }
.shot-row.dragging { opacity: 0.4; }
.shot-row.drag-over { border-top: 2px solid var(--gold); }
.shot-row td:first-child { padding-left: 8px; }
.shot-complete-btn {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--border-default);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--dur-fast) var(--ease); cursor: pointer;
  font-size: 14px; color: transparent;
}
.shot-complete-btn:hover { border-color: var(--accent-green); color: var(--accent-green); }
.shot-complete-btn.done { border-color: var(--accent-green); background: var(--accent-green); color: white; }
.shot-complete-btn.skipped { border-color: var(--accent-red); background: rgba(239,68,68,0.2); color: var(--accent-red); }

/* ── EQUIPMENT CHECKLIST ────────────────────────────────────── */
.equip-category { margin-bottom: 24px; }
.equip-category-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--bg-panel);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
  margin-bottom: 10px;
}
.equip-category-name {
  font-family: var(--font-head); font-size: 14px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.equip-category-icon { font-size: 18px; }
.equip-progress-text { font-size: 12px; color: var(--text-muted); font-family: var(--font-mono); }
.equip-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; margin-bottom: 6px;
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); transition: all var(--dur-fast) var(--ease);
}
.equip-item:hover { border-color: var(--border-default); }
.equip-item.checked { background: rgba(34,197,94,0.05); border-color: rgba(34,197,94,0.2); }
.equip-checkbox {
  width: 18px; height: 18px; border-radius: 4px;
  border: 2px solid var(--border-default); flex-shrink: 0;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all var(--dur-fast) var(--ease);
}
.equip-checkbox.checked { background: var(--accent-green); border-color: var(--accent-green); color: white; font-size: 11px; }
.equip-item-name { flex: 1; font-size: 13px; }
.equip-item.checked .equip-item-name { text-decoration: line-through; color: var(--text-muted); }
.equip-ai-suggest { font-size: 10px; color: var(--accent-purple); background: rgba(168,85,247,0.1); padding: 2px 7px; border-radius: 10px; border: 1px solid rgba(168,85,247,0.2); }

/* ── CONTINUITY ALERT ───────────────────────────────────────── */
.continuity-alert {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; border-radius: var(--radius-md);
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  margin-bottom: 10px;
}
.continuity-alert.high  { border-left: 3px solid var(--accent-red); }
.continuity-alert.medium{ border-left: 3px solid var(--gold); }
.continuity-alert.low   { border-left: 3px solid var(--accent-blue); }
.continuity-alert-icon { font-size: 20px; flex-shrink: 0; margin-top: 1px; }
.continuity-alert-body { flex: 1; }
.continuity-alert-title { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.continuity-alert-desc  { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.continuity-scenes { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.continuity-scene-tag { font-size: 10px; font-family: var(--font-mono); padding: 2px 7px; border-radius: 4px; background: var(--bg-hover); border: 1px solid var(--border-default); color: var(--text-muted); }

/* ── SCHEDULE DRAG CARD ─────────────────────────────────────── */
.schedule-day {
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); margin-bottom: 16px; overflow: hidden;
  transition: border-color var(--dur-fast) var(--ease);
}
.schedule-day.drag-over { border-color: var(--gold); border-style: dashed; }
.schedule-day-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; background: var(--bg-panel);
  border-bottom: 1px solid var(--border-subtle);
}
.schedule-day-num {
  background: var(--gold); color: #0a0900;
  font-family: var(--font-head); font-size: 12px; font-weight: 700;
  padding: 4px 12px; border-radius: 20px;
}
.schedule-day-info { flex: 1; }
.schedule-day-date { font-family: var(--font-head); font-size: 13px; font-weight: 600; }
.schedule-day-meta { font-size: 11px; color: var(--text-muted); display: flex; gap: 10px; margin-top: 3px; }
.schedule-scenes { padding: 14px 18px; display: flex; flex-wrap: wrap; gap: 8px; min-height: 60px; }
.schedule-scene-chip {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 12px; background: var(--bg-hover);
  border: 1px solid var(--border-default); border-radius: var(--radius-md);
  font-size: 12px; cursor: grab; transition: all var(--dur-fast) var(--ease);
  user-select: none;
}
.schedule-scene-chip:hover { border-color: var(--border-active); background: var(--bg-active); }
.schedule-scene-chip:active { cursor: grabbing; }
.schedule-scene-chip.dragging { opacity: 0.3; }

/* ── CALL SHEET ──────────────────────────────────────────────── */
.callsheet-page {
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); overflow: hidden;
}
.callsheet-header {
  background: linear-gradient(135deg, #0d0f1a, #1a1d2e);
  padding: 24px 28px;
  border-bottom: 2px solid var(--gold);
}
.callsheet-title { font-family: var(--font-head); font-size: 22px; font-weight: 700; }
.callsheet-subtitle { color: var(--gold); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 1.5px; margin-top: 4px; }
.callsheet-meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; padding: 20px 28px; border-bottom: 1px solid var(--border-subtle); }
.callsheet-meta-item { display: flex; flex-direction: column; gap: 3px; }
.callsheet-meta-label { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); font-weight: 600; }
.callsheet-meta-value { font-size: 14px; font-weight: 600; }
.callsheet-section { padding: 20px 28px; border-bottom: 1px solid var(--border-subtle); }
.callsheet-section-title { font-family: var(--font-head); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--gold); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.calltime-table { width: 100%; font-size: 13px; }
.calltime-table td { padding: 8px 12px; border-bottom: 1px solid var(--border-subtle); }
.calltime-table tr:last-child td { border-bottom: none; }
.calltime-table .time-col { font-family: var(--font-mono); font-weight: 600; color: var(--gold); width: 80px; }

/* ── DASHBOARD ON-SET ───────────────────────────────────────── */
.onset-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  grid-template-rows: auto 1fr;
  gap: 16px;
  height: calc(100vh - var(--header-h) - 42px);
}
@media (max-width: 1024px) {
  .onset-grid { grid-template-columns: 1fr; grid-template-rows: auto; height: auto; }
}
.now-shooting-card {
  background: linear-gradient(135deg, #0d0f1a, #1a1d2e);
  border: 1px solid var(--gold);
  border-radius: var(--radius-xl);
  padding: 28px;
  box-shadow: var(--shadow-gold);
}
.now-shooting-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 2px; color: var(--gold); margin-bottom: 8px;
  display: flex; align-items: center; gap: 8px;
}
.now-shooting-label::before {
  content:''; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent-red); animation: blink-rec 1s infinite;
}
@keyframes blink-rec { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
.now-shooting-shot { font-family: var(--font-head); font-size: 32px; font-weight: 700; line-height: 1.2; margin-bottom: 16px; }
.now-shooting-details { display: flex; gap: 12px; flex-wrap: wrap; }
.shot-detail-chip { padding: 6px 14px; border-radius: 20px; font-size: 12px; font-weight: 600; background: var(--bg-active); border: 1px solid var(--border-default); }
.next-shot-card { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: 16px 20px; }
.next-shot-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-muted); margin-bottom: 6px; }
.next-shot-info { font-family: var(--font-head); font-size: 15px; font-weight: 600; }
.dashboard-action-row { display: flex; gap: 10px; margin-top: 20px; }
.dashboard-shot-list { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }
.dashboard-shot-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; background: var(--bg-card);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
  transition: all var(--dur-fast) var(--ease);
}
.dashboard-shot-item.current { border-color: var(--gold); background: rgba(245,166,35,0.06); }
.dashboard-shot-item.completed { opacity: 0.5; }
.dashboard-shot-item.skipped { opacity: 0.4; border-style: dashed; }
.dashboard-shot-desc { flex: 1; font-size: 13px; }
.dashboard-shot-desc strong { font-family: var(--font-mono); font-size: 12px; color: var(--gold); }

/* ── DELAY ALERT ────────────────────────────────────────────── */
.delay-alert {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex; align-items: flex-start; gap: 12px;
  margin-bottom: 14px;
  animation: alert-pulse 2s infinite;
}
@keyframes alert-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.2); }
  50% { box-shadow: 0 0 0 4px rgba(239,68,68,0); }
}
.delay-alert-icon { font-size: 20px; flex-shrink: 0; }
.delay-alert-body { flex: 1; }
.delay-alert-title { font-weight: 700; color: var(--accent-red); margin-bottom: 4px; }
.delay-alert-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* ── CAST DATABASE ──────────────────────────────────────────── */
.cast-card {
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); padding: 16px;
  transition: all var(--dur-fast) var(--ease);
}
.cast-card:hover { border-color: var(--border-default); transform: translateY(-2px); }
.cast-avatar {
  width: 48px; height: 48px; border-radius: 50%;
  background: linear-gradient(135deg, var(--bg-active), var(--border-active));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-size: 18px; font-weight: 700;
  color: var(--gold); margin-bottom: 12px;
}
.cast-name { font-family: var(--font-head); font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.cast-scene-count { font-size: 11px; color: var(--text-muted); margin-bottom: 10px; }
.cast-scenes-list { display: flex; flex-wrap: wrap; gap: 4px; }
.cast-scene-tag { font-size: 10px; font-family: var(--font-mono); padding: 2px 7px; border-radius: 4px; background: rgba(79,142,247,0.1); border: 1px solid rgba(79,142,247,0.25); color: var(--accent-blue); }

/* ── LOCATION MANAGER ───────────────────────────────────────── */
.location-card {
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); padding: 16px;
  transition: all var(--dur-fast) var(--ease);
}
.location-card:hover { border-color: var(--border-default); }
.location-icon { font-size: 28px; margin-bottom: 10px; }
.location-name { font-family: var(--font-head); font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.location-scene-count { font-size: 11px; color: var(--text-muted); margin-bottom: 8px; }
.location-address { font-size: 12px; color: var(--text-muted); font-style: italic; }

/* ── BTS PHOTO GRID ─────────────────────────────────────────── */
.bts-photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-top: 10px; }
.bts-photo-thumb { aspect-ratio: 4/3; border-radius: var(--radius-sm); overflow: hidden; background: var(--bg-hover); position: relative; cursor: pointer; }
.bts-photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.bts-photo-thumb:hover::after { content: '🔍'; position: absolute; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; font-size: 20px; }
.bts-add-btn { aspect-ratio: 4/3; border-radius: var(--radius-sm); border: 2px dashed var(--border-default); display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 4px; font-size: 10px; color: var(--text-muted); cursor: pointer; transition: all var(--dur-fast) var(--ease); }
.bts-add-btn:hover { border-color: var(--gold); color: var(--gold); }

/* ── TABS ────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border-subtle); margin-bottom: 20px; overflow-x: auto; }
.tabs::-webkit-scrollbar { height: 0; }
.tab-btn { padding: 10px 18px; font-size: 13px; font-weight: 500; color: var(--text-muted); border-bottom: 2px solid transparent; transition: all var(--dur-fast) var(--ease); white-space: nowrap; cursor: pointer; }
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--gold); border-bottom-color: var(--gold); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── AI THINKING ANIMATION ──────────────────────────────────── */
.ai-thinking {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; background: rgba(79,70,229,0.08);
  border: 1px solid rgba(79,70,229,0.2); border-radius: var(--radius-md);
  color: #a5b4fc; font-size: 13px;
}
.ai-dots { display: flex; gap: 4px; }
.ai-dots span { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: ai-bounce 1.2s infinite; }
.ai-dots span:nth-child(2) { animation-delay: 0.2s; }
.ai-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes ai-bounce { 0%, 100% { transform: translateY(0); opacity: 0.4; } 50% { transform: translateY(-4px); opacity: 1; } }

/* ── SCENE PROGRESS (in dashboard) ─────────────────────────── */
.scene-progress-card {
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); padding: 14px 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.scene-progress-header { display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.scene-progress-label { font-weight: 600; }
.scene-progress-count { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }
