:root {
    --bg-primary: #0f1117;
    --bg-secondary: #1a1d2e;
    --bg-card: #1e2235;
    --bg-hover: #252842;
    --border: #2d3155;
    --text-primary: #e8eaf6;
    --text-secondary: #8892b0;
    --text-muted: #5a6480;
    --accent: #6c63ff;
    --accent-hover: #7c74ff;
    --accent-light: rgba(108, 99, 255, 0.15);
    --success: #00c851;
    --success-light: rgba(0, 200, 81, 0.15);
    --warning: #ffbb33;
    --warning-light: rgba(255, 187, 51, 0.15);
    --danger: #ff4444;
    --danger-light: rgba(255, 68, 68, 0.15);
    --info: #33b5e5;
    --info-light: rgba(51, 181, 229, 0.15);
    --gradient: linear-gradient(135deg, #6c63ff, #a855f7);
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.2s ease;
}

[data-theme="light"] {
    --bg-primary: #f0f2f5;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #f5f7fa;
    --border: #e2e8f0;
    --text-primary: #1a1d2e;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --accent: #6c63ff;
    --accent-hover: #5a52e0;
    --accent-light: rgba(108, 99, 255, 0.1);
    --shadow: 0 4px 24px rgba(0,0,0,0.1);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.6;
}

/* ── NAVBAR ── */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 60px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
}

.brand-link { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-icon { font-size: 22px; }
.brand-name { font-size: 18px; font-weight: 800; background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

.navbar-menu { display: flex; gap: 4px; }
.nav-link {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    font-size: 14px;
}
.nav-link:hover, .nav-link.active { background: var(--accent-light); color: var(--accent); }

.navbar-actions { display: flex; align-items: center; gap: 12px; }

.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    width: 34px;
    height: 34px;
    cursor: pointer;
    font-size: 16px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}
.theme-toggle:hover { background: var(--bg-hover); }

.user-menu { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.user-avatar-placeholder {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--gradient);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px; color: white;
}
.user-name { font-weight: 500; color: var(--text-secondary); font-size: 13px; }

.hamburger { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 6px; }
.hamburger span { width: 20px; height: 2px; background: var(--text-secondary); border-radius: 2px; transition: var(--transition); }

/* ── MAIN ── */
.main-content { padding: 24px; max-width: 1400px; margin: 0 auto; }
.full-height { max-width: 100%; padding: 0; margin: 0; }

/* ── FLASH MESSAGES ── */
.flash-messages { position: fixed; top: 70px; right: 20px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.alert {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 16px; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 500; min-width: 280px;
    box-shadow: var(--shadow); animation: slideIn 0.3s ease;
}
.alert-success { background: var(--success-light); border: 1px solid var(--success); color: var(--success); }
.alert-danger { background: var(--danger-light); border: 1px solid var(--danger); color: var(--danger); }
.alert-warning { background: var(--warning-light); border: 1px solid var(--warning); color: var(--warning); }
.alert-info { background: var(--info-light); border: 1px solid var(--info); color: var(--info); }
.alert button { background: none; border: none; cursor: pointer; color: inherit; font-size: 18px; line-height: 1; padding: 0 4px; }

/* ── CARDS ── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: var(--transition);
}
.card:hover { border-color: var(--accent); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.card-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── KPI CARDS ── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    transition: var(--transition);
}
.kpi-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.kpi-value { font-size: 32px; font-weight: 800; background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; line-height: 1.2; }
.kpi-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; margin-top: 6px; font-weight: 600; }
.kpi-trend { font-size: 11px; margin-top: 4px; }
.kpi-trend.up { color: var(--success); }
.kpi-trend.down { color: var(--danger); }

/* ── BUTTONS ── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 18px; border-radius: var(--radius-sm);
    font-weight: 600; font-size: 13px; cursor: pointer;
    transition: var(--transition); text-decoration: none; border: none;
    white-space: nowrap;
}
.btn-primary { background: var(--gradient); color: white; }
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-secondary); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { opacity: 0.85; }
.btn-success { background: var(--success); color: white; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* ── FORMS ── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.form-control {
    width: 100%; padding: 10px 14px;
    background: var(--bg-primary); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text-primary);
    font-size: 14px; font-family: inherit; transition: var(--transition);
}
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.form-control::placeholder { color: var(--text-muted); }
select.form-control { cursor: pointer; }

/* ── TABLES ── */
.table-container { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
thead th { padding: 12px 16px; background: var(--bg-secondary); font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; border-bottom: 1px solid var(--border); text-align: left; }
tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-secondary); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg-hover); }

/* ── BADGES ── */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 700; letter-spacing: 0.3px;
}
.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info { background: var(--info-light); color: var(--info); }
.badge-secondary { background: var(--bg-hover); color: var(--text-muted); }

/* ── PAGE HEADER ── */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; gap: 16px; flex-wrap: wrap; }
.page-title { font-size: 26px; font-weight: 800; color: var(--text-primary); }
.page-subtitle { font-size: 14px; color: var(--text-muted); margin-top: 4px; }

/* ── GRID ── */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ── TABS ── */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 20px; background: var(--bg-secondary); padding: 6px; border-radius: var(--radius); border: 1px solid var(--border); }
.tab-btn {
    padding: 7px 14px; border-radius: var(--radius-sm); border: none;
    background: transparent; color: var(--text-muted); font-size: 12px;
    font-weight: 600; cursor: pointer; transition: var(--transition);
    white-space: nowrap;
}
.tab-btn:hover { color: var(--text-primary); background: var(--bg-hover); }
.tab-btn.active { background: var(--accent); color: white; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── PROGRESS BAR ── */
.progress { height: 6px; background: var(--bg-hover); border-radius: 3px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--gradient); border-radius: 3px; transition: width 0.5s ease; }

/* ── PLATFORM BADGE ── */
.platform-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px; }
.platform-youtube { background: rgba(255,0,0,0.15); color: #ff0000; }
.platform-instagram { background: rgba(225,48,108,0.15); color: #e1306c; }

/* ── STATUS INDICATOR ── */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-running { background: var(--success); box-shadow: 0 0 6px var(--success); animation: pulse 1.5s infinite; }
.status-completed { background: var(--info); }
.status-error { background: var(--danger); }
.status-paused { background: var(--warning); }

/* ── ANIMATIONS ── */
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.fade-in { animation: fadeIn 0.4s ease; }

/* ── SPINNER ── */
.spinner { width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-state-title { font-size: 18px; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; }
.empty-state-desc { color: var(--text-muted); font-size: 14px; max-width: 400px; margin: 0 auto 20px; }

/* ── SCORE RING ── */
.score-ring { position: relative; display: inline-flex; align-items: center; justify-content: center; }
.score-value { position: absolute; font-size: 24px; font-weight: 800; }

/* ── MODAL ── */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.7); z-index: 500;
    align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; max-width: 500px; width: 90%; box-shadow: var(--shadow); animation: fadeIn 0.2s ease; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; cursor: pointer; font-size: 22px; color: var(--text-muted); }

/* ── RESPONSIVE ── */
@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .navbar-menu { display: none; position: absolute; top: 60px; left: 0; right: 0; flex-direction: column; background: var(--bg-secondary); border-bottom: 1px solid var(--border); padding: 12px; gap: 4px; }
    .navbar-menu.open { display: flex; }
    .hamburger { display: flex; }
    .user-name { display: none; }
    .main-content { padding: 16px; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .page-header { flex-direction: column; }
}
@media (max-width: 480px) {
    .kpi-grid { grid-template-columns: 1fr; }
}
