/* ═══════════════════════════════════════════════
   Universal Video Pro — Premium Light Theme
   ═══════════════════════════════════════════════ */
:root {
  --bg: #f4f6fb; --surface: #ffffff; --surface-2: #f0f2f8;
  --accent: #6c3ce9; --accent-light: #ede7ff; --accent-hover: #5a2bd4;
  --success: #16a34a; --danger: #ef4444; --warning: #f59e0b;
  --text: #1e1e2e; --text-2: #6b7280; --text-3: #9ca3af;
  --border: #e5e7eb; --border-2: #d1d5db;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 30px rgba(108,60,233,0.08);
  --radius: 14px; --radius-sm: 8px;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--bg); color: var(--text); }
::selection { background: var(--accent-light); color: var(--accent); }
input, select, textarea, button { font-family: inherit; }

/* ── Layout ── */
#app { display: flex; height: 100vh; overflow: hidden; }
.sidebar { width: 220px; min-width: 220px; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.content-wrap { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.top-banner-wrap { background: var(--surface); border-bottom: 1px solid var(--border); padding: 8px 24px; display: flex; justify-content: center; align-items: center; min-height: 66px; }
.page-body { flex: 1; display: flex; overflow: hidden; }
.main-content { flex: 1; overflow-y: auto; padding: 24px 28px; }
.ad-sidebar { width: 300px; min-width: 300px; background: var(--surface); border-left: 1px solid var(--border); overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 16px; }

/* ── Sidebar ── */
.sidebar-header { padding: 24px 20px 16px; }
.logo-wrap { display: flex; align-items: center; gap: 12px; }
.logo-icon { font-size: 28px; background: var(--accent); color: #fff; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 12px; }
.logo-name { font-size: 15px; font-weight: 800; letter-spacing: 1px; color: var(--text); }
.logo-sub { font-size: 11px; font-weight: 700; color: var(--accent); letter-spacing: 2px; }
.sidebar-nav { padding: 8px 12px; flex: 0 0 auto; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 14px; border: none; background: transparent; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; color: var(--text-2); cursor: pointer; transition: all .15s; text-decoration: none; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-light); color: var(--accent); font-weight: 600; }
.nav-icon { font-size: 18px; }
.sidebar-stats { padding: 16px 20px; margin-top: auto; border-top: 1px solid var(--border); }
.stats-title { font-size: 11px; font-weight: 700; color: var(--text-3); letter-spacing: 1px; margin-bottom: 10px; }
.stat-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 13px; }
.stat-label { color: var(--text-2); }
.stat-val { font-weight: 700; font-size: 14px; }
.stat-val.success { color: var(--success); }
.stat-val.danger { color: var(--danger); }
.stat-val.accent { color: var(--accent); }
.sidebar-license { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; align-items: center; }

/* ── Section Header ── */
.section-header { margin-bottom: 24px; }
.section-header h2 { font-size: 22px; font-weight: 700; color: var(--text); }
.section-header p { font-size: 14px; color: var(--text-2); margin-top: 4px; }

/* ── Cards ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.card-title { font-size: 14px; font-weight: 600; color: var(--text); }
.card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.option-card { flex: 1; min-width: 0; overflow: hidden; }
.options-row { display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; border: none; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); box-shadow: var(--shadow-lg); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-2); border: 1px solid var(--border-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-full { width: 100%; }
.btn-lg { padding: 14px 28px; font-size: 15px; border-radius: 12px; }
.btn-sm { padding: 7px 12px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-icon { font-size: 16px; }

/* ── Inputs ── */
.input-group { display: flex; flex-direction: column; gap: 6px; }
.input-group label { font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .5px; }
.input-group.sm label { font-size: 11px; }
input[type="text"], input[type="number"], select { padding: 10px 14px; border: 1px solid var(--border-2); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); font-size: 13px; outline: none; transition: border .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.url-textarea { width: 100%; min-height: 100px; resize: vertical; padding: 14px; border: 1px solid var(--border-2); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); font-size: 13px; font-family: 'JetBrains Mono', monospace; outline: none; line-height: 1.6; }
.url-count { font-size: 12px; font-weight: 700; color: var(--accent); }
.hint { font-size: 12px; color: var(--text-3); }

/* ── Radio / Toggle ── */
.radio-group { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-group.vertical { flex-direction: column; }
.radio-opt { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border: 1px solid var(--border-2); border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; font-weight: 500; transition: all .15s; color: var(--text-2); }
.radio-opt:hover { border-color: var(--accent); }
.radio-opt.selected { border-color: var(--accent); background: var(--accent-light); color: var(--accent); font-weight: 600; }
.radio-opt input[type="radio"] { display: none; }
.radio-icon { font-size: 16px; }
.toggle-label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--text-2); }
.toggle-label input { display: none; }
.toggle-slider { width: 36px; height: 20px; background: var(--border-2); border-radius: 999px; position: relative; transition: .2s; }
.toggle-slider::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: .2s; }
.toggle-label input:checked + .toggle-slider { background: var(--accent); }
.toggle-label input:checked + .toggle-slider::after { transform: translateX(16px); }

/* ── Action Row ── */
.action-row { display: flex; gap: 10px; align-items: center; margin-top: 20px; flex-wrap: wrap; }
.filter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; overflow: hidden; }
.filter-grid .input-group { min-width: 0; }
.filter-grid input { width: 100%; min-width: 0; }

/* ── Progress Bar ── */
.progress-header { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.progress-bar-wrap { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--accent), #a78bfa); border-radius: 999px; transition: width .3s; }
#progress-section { margin-top: 20px; }

/* ── Results Grid ── */
.results-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-top: 20px; }
.video-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: box-shadow .2s, transform .2s; }
.video-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.video-thumb { height: 160px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.video-thumb img { width: 100%; height: 100%; object-fit: cover; }
.video-thumb span { font-size: 40px; }
.video-info { padding: 14px; }
.video-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.video-meta { display: flex; gap: 10px; font-size: 12px; color: var(--text-3); margin: 6px 0 12px; }
.badge-source { background: var(--accent-light); color: var(--accent); padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.video-actions { display: flex; gap: 6px; }

/* ── Log Console ── */
.log-card { margin-top: 20px; }
.log-console { max-height: 180px; overflow-y: auto; font-family: 'JetBrains Mono', monospace; font-size: 12px; padding: 12px; background: var(--surface-2); border-radius: var(--radius-sm); color: var(--text-2); line-height: 1.7; }
.log-line-error { color: var(--danger); }
.log-line-success { color: var(--success); }
.log-line-warn { color: var(--warning); }

/* ── Search ── */
.search-bar { display: flex; gap: 8px; align-items: stretch; }
.platform-select { min-width: 140px; }
.search-input { flex: 1; }
.search-limit { width: 70px; }

/* ── History ── */
.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-item { display: flex; align-items: center; gap: 14px; padding: 14px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.history-icon { font-size: 24px; }
.history-info { flex: 1; min-width: 0; }
.history-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-size { font-size: 12px; color: var(--text-3); }
.empty-state { text-align: center; padding: 50px; color: var(--text-3); }
.empty-icon { font-size: 48px; margin-bottom: 10px; }

/* ── Tabs ── */
.tab-section { display: none; }
.tab-section.active { display: block; }
.hidden { display: none !important; }

/* ── Toast ── */
#toast-container { position: fixed; top: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 20px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; color: #fff; animation: slideIn .3s; box-shadow: 0 4px 16px rgba(0,0,0,0.12); }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }
.toast.info { background: var(--accent); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { from { opacity: 1; } to { transform: translateX(100%); opacity: 0; } }

/* ── Spinner ── */
.spinner { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .6s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Livestream ── */
.live-dot { display: inline-block; width: 10px; height: 10px; background: var(--danger); border-radius: 50%; animation: pulse 1.5s infinite; margin-right: 6px; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }

/* ── Lang Switcher ── */
.lang-switcher { display: flex; gap: 6px; justify-content: center; margin-top: 8px; }
.lang-btn { background: transparent; border: 1px solid var(--border-2); color: var(--text-3); padding: 4px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; cursor: pointer; transition: all .15s; }
.lang-btn:hover { background: var(--surface-2); color: var(--text); }
.lang-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Ad Slots ── */
.ad-slot { background: var(--surface-2); border: 1px dashed var(--border-2); border-radius: var(--radius); display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; position: relative; }
.ad-slot-label { font-size: 10px; font-weight: 600; color: var(--text-3); letter-spacing: 1px; text-transform: uppercase; position: absolute; top: 6px; left: 10px; }
/* Top leaderboard 728x90 */
.ad-leaderboard { width: 100%; max-width: 728px; height: 90px; }
/* Right sidebar ads */
.ad-square { width: 300px; height: 250px; }
.ad-halfpage { width: 300px; height: 250px; margin-top: 0; }
.ad-sticky-wrap { position: sticky; top: 0; display: flex; flex-direction: column; gap: 16px; }
/* In-content ad */
.ad-incontent { width: 100%; height: 90px; margin: 20px 0; }

/* ── Responsive ── */
@media (max-width: 1280px) {
  .ad-sidebar { width: 250px; min-width: 250px; }
  .ad-square, .ad-halfpage { width: 250px; }
}
@media (max-width: 1024px) {
  .ad-sidebar { display: none; }
  .sidebar { width: 200px; min-width: 200px; }
  .main-content { padding: 20px 18px; }
}
@media (max-width: 768px) {
  .sidebar { width: 60px; min-width: 60px; }
  .sidebar .logo-name, .sidebar .logo-sub, .sidebar .nav-item span:not(.nav-icon),
  .sidebar .stats-title, .sidebar .stat-label, .sidebar .stat-row, .sidebar-stats,
  .sidebar-license { display: none; }
  .nav-item { justify-content: center; padding: 12px; }
  .nav-icon { font-size: 22px; }
  .main-content { padding: 16px 12px; }
  .options-row { flex-direction: column; }
  .top-banner-wrap { display: none; }
}
