/* ============================================
   YouTube Digest v3.0 — Styles
   ============================================ */

:root {
    --primary: #667eea;
    --primary-dark: #5a6fd6;
    --accent: #764ba2;
    --danger: #e74c3c;
    --success: #27ae60;
    --warning: #f39c12;
    --text: #2d3748;
    --text-muted: #718096;
    --bg: #f7fafc;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 14px rgba(0,0,0,0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
}

/* ---- Buttons ---- */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.9; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 32px; font-size: 16px; }
.btn-full { width: 100%; text-align: center; }

/* ---- Forms ---- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }
.form-group input, .form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}
.form-group input:focus { border-color: var(--primary); outline: none; }
.form-group small { color: var(--text-muted); font-size: 12px; margin-top: 4px; display: block; }

.inline-form { display: flex; gap: 10px; align-items: center; }
.inline-form input { flex: 1; padding: 8px 12px; border: 2px solid var(--border); border-radius: 8px; }

/* ---- Alerts ---- */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: var(--success); border: 1px solid #bbf7d0; }
.alert-warning { background: #fffbeb; color: var(--warning); border: 1px solid #fde68a; }

.text-muted { color: var(--text-muted); }

/* ---- Card ---- */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}
.card h2 { font-size: 18px; margin-bottom: 16px; color: var(--text); }

/* ============================================
   Landing Page
   ============================================ */
.landing {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.landing-hero {
    text-align: center;
    color: white;
    padding: 60px 20px;
    max-width: 800px;
}
.landing-hero h1 { font-size: 48px; margin-bottom: 12px; }
.landing-hero .tagline { font-size: 20px; opacity: 0.9; margin-bottom: 50px; }

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    margin-bottom: 50px;
}
.feature-card {
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 30px 20px;
    text-align: center;
}
.feature-icon { font-size: 40px; margin-bottom: 12px; }
.feature-card h3 { font-size: 18px; margin-bottom: 8px; }
.feature-card p { font-size: 14px; opacity: 0.85; }

.cta-buttons { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.cta-buttons .btn-primary { background: white; color: var(--primary); }
.cta-buttons .btn-primary:hover { background: #f0f0f0; }
.cta-buttons .btn-outline { border-color: white; color: white; }
.cta-buttons .btn-outline:hover { background: white; color: var(--primary); }

/* ============================================
   Auth Pages
   ============================================ */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
}
.auth-card {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
}
.auth-card h1 {
    text-align: center;
    color: var(--primary);
    font-size: 28px;
    margin-bottom: 4px;
}
.auth-card h2 { text-align: center; font-size: 18px; color: var(--text-muted); margin-bottom: 30px; }
.auth-link { text-align: center; margin-top: 20px; font-size: 14px; color: var(--text-muted); }
.auth-link a { color: var(--primary); text-decoration: none; font-weight: 600; }

/* ============================================
   Dashboard
   ============================================ */
.dashboard { min-height: 100vh; background: var(--bg); }

.dash-header {
    background: white;
    padding: 16px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 10;
}
.dash-header h1 { font-size: 22px; color: var(--primary); }
.dash-header-right { display: flex; align-items: center; gap: 12px; }
.user-email { font-size: 14px; color: var(--text-muted); }

.dash-content { max-width: 1200px; margin: 0 auto; padding: 24px; }

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow);
}
.stat-value { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.5px; }

.processing-badge {
    display: inline-block;
    background: var(--warning);
    color: white;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    line-height: 36px;
    font-size: 18px;
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Two column layout */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 768px) {
    .dash-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Channels */
.channel-list { display: flex; flex-direction: column; gap: 12px; }
.channel-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-radius: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
}
.channel-name { font-weight: 600; font-size: 14px; }
.channel-meta { font-size: 12px; color: var(--text-muted); }
.channel-actions { display: flex; gap: 6px; }

/* Job log */
.job-log { display: flex; flex-direction: column; gap: 8px; max-height: 500px; overflow-y: auto; }
.job-item {
    display: flex;
    gap: 10px;
    padding: 10px;
    border-radius: 8px;
    background: var(--bg);
    border-left: 3px solid var(--border);
    font-size: 13px;
}
.job-item.job-completed { border-left-color: var(--success); }
.job-item.job-running { border-left-color: var(--warning); }
.job-item.job-failed { border-left-color: var(--danger); }
.job-icon { font-size: 16px; flex-shrink: 0; }
.job-type { font-weight: 600; }
.job-video-id { font-weight: 400; color: var(--text-muted); font-family: monospace; font-size: 11px; }
.job-meta { color: var(--text-muted); font-size: 12px; }
.job-error { color: var(--danger); font-size: 12px; margin-top: 2px; }

/* --- Admin panel --- */
.impersonation-banner {
    background: #fff4e5;
    border-bottom: 2px solid var(--warning);
    color: #8a5a00;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}
.impersonation-banner a { color: var(--primary-dark); font-weight: 600; }

.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #edf2f7; }
.admin-table th { color: var(--text-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
.admin-table tbody tr:hover { background: #f9fafc; }
.admin-table a { color: var(--primary-dark); text-decoration: none; font-weight: 600; }
.row-actions { display: flex; gap: 6px; white-space: nowrap; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.tag-ok { background: #e6f7ee; color: var(--success); }
.tag-off { background: #f0f0f0; color: var(--text-muted); }
.tag-admin { background: #ece9fb; color: var(--accent); }

.text-block {
    white-space: pre-wrap;
    word-break: break-word;
    background: #f7fafc;
    border: 1px solid #edf2f7;
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.6;
    max-height: 480px;
    overflow-y: auto;
}
.alert-success { background: #e6f7ee; color: #1d7a4a; border: 1px solid #b7e4c7; padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
