/* ============================================
   COMPONENTS — Reusable UI Components
   ============================================ */

/* ---- AUTH SCREEN ---- */
.auth-screen {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(247,193,68,0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(99,102,241,0.06) 0%, transparent 50%);
}
.auth-card {
  width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  box-shadow: var(--shadow-lg);
}
.auth-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}
.auth-card h1 {
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  letter-spacing: -0.4px;
}
.auth-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 6px;
  margin-bottom: 24px;
}
.auth-tabs {
  display: flex;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: 24px;
}
.auth-tab {
  flex: 1;
  padding: 7px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition);
}
.auth-tab.active {
  background: var(--surface-3);
  color: var(--text);
}
.auth-divider {
  text-align: center;
  margin: 16px 0;
  color: var(--text-dim);
  font-size: 12px;
  position: relative;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: calc(50% - 24px);
  height: 1px;
  background: var(--border);
}
.auth-divider::before { left: 0; }
.auth-divider::after { right: 0; }
.btn-social {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  transition: background var(--transition);
}
.btn-social:hover { background: var(--surface-3); }
.auth-form .form-group + .form-group { margin-top: 14px; }

/* ---- VIDEO CARD ---- */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}
.video-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  cursor: pointer;
}
.video-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.video-thumb {
  position: relative;
  aspect-ratio: 16/9;
  background: var(--surface-2);
  overflow: hidden;
}
.video-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 300ms ease;
}
.video-card:hover .video-thumb img { transform: scale(1.03); }
.video-thumb-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 50%);
  opacity: 0;
  transition: opacity var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.video-card:hover .video-thumb-overlay { opacity: 1; }
.play-btn-overlay {
  width: 40px; height: 40px;
  background: rgba(247,193,68,0.9);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #0D0F16;
}
.video-duration {
  position: absolute;
  bottom: 8px; right: 8px;
  background: rgba(0,0,0,0.7);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-family: var(--mono);
  font-weight: 500;
}
.video-status-badge {
  position: absolute;
  top: 8px; left: 8px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  display: flex; align-items: center; gap: 4px;
}
.video-status-badge.ready { background: var(--success-bg); color: var(--success); }
.video-status-badge.processing { background: var(--warning-bg); color: var(--warning); }
.video-status-badge.failed { background: var(--error-bg); color: var(--error); }
.video-card-body { padding: 14px; }
.video-card-address { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.video-card-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.video-card-date { font-size: 12px; color: var(--text-dim); }
.video-card-menu {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  transition: all var(--transition);
  position: relative;
}
.video-card-menu:hover { background: var(--surface-2); color: var(--text); }
.video-card-menu-btn {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
}
.card-menu-dropdown {
  position: absolute;
  top: calc(100% + 4px); right: 0;
  min-width: 160px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  box-shadow: var(--shadow-lg);
  z-index: 50;
  display: none;
}
.card-menu-dropdown.show { display: block; }
.card-menu-dropdown button {
  width: 100%;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-muted);
  text-align: left;
  transition: background var(--transition), color var(--transition);
}
.card-menu-dropdown button:hover { background: var(--surface-3); color: var(--text); }
.card-menu-dropdown button.danger { color: var(--error); }
.card-menu-dropdown button.danger:hover { background: var(--error-bg); }

/* ---- LIST VIEW ---- */
.video-list { display: flex; flex-direction: column; gap: 10px; }
.video-list-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.video-list-item:hover { border-color: var(--border-light); background: var(--surface-2); }
.video-list-thumb {
  width: 120px;
  aspect-ratio: 16/9;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
  flex-shrink: 0;
}
.video-list-thumb img { width: 100%; height: 100%; object-fit: cover; }
.video-list-info { flex: 1; min-width: 0; }
.video-list-address { font-weight: 600; font-size: 14px; }
.video-list-date { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.video-list-right { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }

/* ---- FILTER BAR ---- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}
.filter-group select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
}
.view-toggle {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
}
.view-btn {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px;
  color: var(--text-dim);
  transition: all var(--transition);
}
.view-btn.active { background: var(--surface-3); color: var(--text); }
.view-btn:hover:not(.active) { color: var(--text); }

/* ---- EMPTY STATE ---- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 20px;
}
.empty-icon {
  width: 100px; height: 100px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim);
  margin-bottom: 24px;
}
.empty-state h3 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.empty-state p { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; max-width: 360px; }

/* ---- PAGINATION ---- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.pagination-btn {
  min-width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-muted);
  transition: all var(--transition);
}
.pagination-btn:hover:not(.active) { border-color: var(--border-light); color: var(--text); }
.pagination-btn.active { background: var(--accent); border-color: var(--accent); color: #0D0F16; font-weight: 700; }

/* ---- UPLOAD ZONE ---- */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  color: var(--text-muted);
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-bg);
}
.upload-zone svg { margin-bottom: 8px; }
.upload-zone p { font-size: 13px; font-weight: 600; margin-bottom: 4px; color: var(--text); }
.upload-zone span { font-size: 11px; color: var(--text-dim); display: block; margin: 6px 0; }
.upload-zone .btn { margin: 0 auto; }

.upload-zone-sm {
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-muted);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.upload-zone-sm:hover { border-color: var(--border-light); background: var(--surface-2); }
.upload-zone-sm p { font-size: 12px; color: var(--text-dim); }

/* ---- PROGRESS BAR ---- */
.progress-bar {
  height: 4px;
  background: var(--surface-3);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 300ms ease;
  width: 0%;
}
.upload-progress {
  margin-top: 12px;
  padding: 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}
.upload-progress p { font-size: 12px; color: var(--text-muted); margin-top: 8px; text-align: center; }

/* ---- SLIDES GRID ---- */
.slides-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.slide-thumb {
  position: relative;
  aspect-ratio: 16/9;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition);
}
.slide-thumb:hover { transform: scale(1.05); border-color: var(--border-light); }
.slide-thumb.selected { border-color: var(--accent); }
.slide-thumb img { width: 100%; height: 100%; object-fit: cover; }
.slide-thumb-num {
  position: absolute;
  bottom: 3px; left: 3px;
  background: rgba(0,0,0,0.6);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10px;
  font-family: var(--mono);
}
.slide-thumb-remove {
  position: absolute;
  top: 3px; right: 3px;
  width: 18px; height: 18px;
  background: rgba(239,68,68,0.9);
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: white;
  cursor: pointer;
}
.slide-thumb:hover .slide-thumb-remove { display: flex; }

/* Checkbox overlay on scraped image thumbnails */
.slide-thumb-check {
  position: absolute;
  top: 6px; right: 6px;
  width: 20px; height: 20px;
  background: rgba(0,0,0,0.5);
  border: 2px solid rgba(255,255,255,0.7);
  border-radius: 4px;
  display: none;
  align-items: center;
  justify-content: center;
}
.slide-thumb.selected .slide-thumb-check { display: flex; background: var(--accent); border-color: var(--accent); }

/* Scraped image picker in Step 1 */
.wiz-scraped-picker { margin-top: 20px; }
.picker-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.picker-title { font-size: 13px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }
.sel-bar-wrap { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.sel-bar { flex: 1; height: 4px; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
.sel-bar-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.2s; width: 0%; }
.sel-count { font-size: 12px; font-family: var(--mono); color: var(--text-muted); white-space: nowrap; }

.label-count { font-size: 12px; font-weight: 400; color: var(--text-muted); font-family: var(--mono); margin-left: 6px; }

#wiz-scrape-btn { background: var(--surface-3) !important; color: #fff !important; }
#wiz-scrape-btn:hover { background: var(--surface-2) !important; }

/* ---- CONFIGURATION PANEL ---- */
.config-sections { height: 100%; display: flex; flex-direction: column; overflow: hidden; }
.config-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 12px 12px 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.cfg-tab {
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: color var(--transition), background var(--transition);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.cfg-tab:hover { color: var(--text); }
.cfg-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.cfg-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}
.cfg-content h3 { font-size: 13px; font-weight: 700; margin-bottom: 12px; color: var(--text); }
.cfg-section { margin-bottom: 20px; }
.cfg-section + .cfg-section { padding-top: 16px; border-top: 1px solid var(--border); }
.cfg-desc { font-size: 11px; color: var(--text-dim); margin-top: 4px; }

/* ---- TEMPLATE GRID ---- */
.template-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.template-grid-sm {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.template-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color var(--transition);
  font-size: 11px;
  color: var(--text-muted);
}
.template-card:hover { border-color: var(--border-light); }
.template-card.active { border-color: var(--accent); color: var(--text); }
.tpl-preview {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 10px;
  overflow: hidden;
}
.tpl-preview.explosive { background: #FF0000; color: #FFD700; text-shadow: 2px 2px 0 rgba(0,0,0,0.8); font-size: 14px; }
.tpl-preview.neo-minimal { background: #1a1a2e; color: #ffffff; font-size: 11px; }
.tpl-preview.hype { background: linear-gradient(135deg, #667eea, #764ba2); color: white; }
.tpl-preview.classic { background: #1a1a1a; color: #c9a84c; border: 1px solid #c9a84c; }
.tpl-preview.minimalist { background: #ffffff; color: #000000; }
.tpl-preview.retro-gaming { background: #000; color: #39ff14; font-family: monospace; }
.tpl-preview.word-focus { background: #0a0a0a; color: #ff6b6b; font-size: 13px; font-weight: 900; }

/* ---- TRANSITION GRID ---- */
.transition-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.trans-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 11px;
  color: var(--text-muted);
  transition: border-color var(--transition);
}
.trans-card:hover { border-color: var(--border-light); }
.trans-card.active { border-color: var(--accent); color: var(--text); }
.trans-icon { font-size: 16px; }

/* ---- CORNER PICKER ---- */
.corner-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: 80px;
  height: 60px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-top: 4px;
}
.corner-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-dim);
  transition: background var(--transition), color var(--transition);
}
.corner-btn:nth-child(1), .corner-btn:nth-child(3), .corner-btn:nth-child(5), .corner-btn:nth-child(7) { background: var(--surface-2); }
.corner-btn:nth-child(2), .corner-btn:nth-child(4), .corner-btn:nth-child(6), .corner-btn:nth-child(8) { background: transparent; }
.corner-btn.active { background: var(--accent) !important; color: #0D0F16; }
.corner-btn:not(.corner-btn:nth-child(5)):hover { background: var(--surface-3); }

/* ---- MUSIC LIST ---- */
.music-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.music-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
}
.music-item:hover { background: var(--surface-2); }
.music-item.active { background: var(--accent-bg); border-color: rgba(247,193,68,0.3); }
.music-item-info { flex: 1; min-width: 0; }
.music-item-name { font-size: 13px; font-weight: 600; }
.music-item-desc { font-size: 11px; color: var(--text-dim); margin-top: 1px; }
.music-play-btn {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--surface-3);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all var(--transition);
}
.music-play-btn:hover { background: var(--accent); color: #0D0F16; }

/* ---- SCRAPE STATUS ---- */
.scrape-status {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.scrape-status.loading { background: var(--surface-2); color: var(--text-muted); }
.scrape-status.success { background: var(--success-bg); color: var(--success); }
.scrape-status.error { background: var(--error-bg); color: var(--error); }

/* ---- CHAR COUNT ---- */
.char-count { font-size: 11px; color: var(--text-dim); margin-top: 4px; text-align: right; }

/* ---- SCRIPT ACTIONS ---- */
.script-actions { display: flex; gap: 8px; margin-bottom: 8px; }

/* ---- LOGO PREVIEW ---- */
.logo-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  padding: 10px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}
.logo-preview img { max-width: 80px; max-height: 40px; object-fit: contain; }

/* ---- SPINNER ---- */
.spinner-ring {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }
