/* Content Autopilot — App Stylesheet */
/* Design: dark sidebar + clean white content area */

:root {
    --bg-sidebar:   #0f1117;
    --bg-main:      #f5f6f8;
    --bg-card:      #ffffff;
    --sidebar-w:    220px;

    --accent:       #6c63ff;
    --accent-dark:  #574fd6;
    --accent-light: #ede9ff;

    --text-primary: #1a1d23;
    --text-muted:   #6b7280;
    --text-sidebar: #9ca3af;
    --text-sidebar-active: #ffffff;

    --border:       #e5e7eb;
    --border-dark:  #d1d5db;

    --success:      #10b981;
    --error:        #ef4444;
    --warning:      #f59e0b;
    --pending:      #3b82f6;

    --radius:       10px;
    --radius-sm:    6px;
    --shadow-card:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md:    0 4px 16px rgba(0,0,0,.10);

    --font:         'Inter', system-ui, -apple-system, sans-serif;
    --font-mono:    'JetBrains Mono', 'Fira Code', monospace;
}

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

body {
    font-family: var(--font);
    background: var(--bg-main);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
}

/* ── Layout ─────────────────────────────────────────────────────────────────── */
.layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1.5rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,.06);
}

.brand-icon {
    width: 32px; height: 32px;
    background: var(--accent);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; color: #fff;
    flex-shrink: 0;
}

.brand-icon--lg {
    width: 56px; height: 56px;
    font-size: 28px;
    border-radius: 14px;
}

.brand-name { display: block; font-weight: 700; color: #fff; font-size: 15px; }
.brand-sub  { display: block; font-size: 11px; color: var(--text-sidebar); letter-spacing: .04em; }

.sidebar-nav { padding: 1rem 0; flex: 1; }

.nav-item {
    display: flex;
    align-items: center;
    gap: .625rem;
    padding: .6rem 1.25rem;
    color: var(--text-sidebar);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    border-radius: 0;
    transition: background .15s, color .15s;
}

.nav-item:hover { background: rgba(255,255,255,.05); color: #e5e7eb; }
.nav-item.active {
    background: rgba(108,99,255,.2);
    color: var(--text-sidebar-active);
    border-left: 3px solid var(--accent);
}

.nav-icon { font-size: 15px; opacity: .7; }
.nav-item.active .nav-icon { opacity: 1; }

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,.06);
}

.version-badge {
    font-size: 11px;
    color: rgba(255,255,255,.3);
    font-family: var(--font-mono);
}

/* ── Main ───────────────────────────────────────────────────────────────────── */
.main {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.page-title { font-size: 17px; font-weight: 600; }

.content { padding: 1.75rem; }

/* ── Cards ──────────────────────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    margin-bottom: 1.25rem;
}

.card-header {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: .875rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: #fafafa;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem;
}

/* ── Stats grid ─────────────────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1rem;
    text-align: center;
    box-shadow: var(--shadow-card);
}

.stat-card--error { border-color: #fecaca; background: #fff5f5; }

.stat-value { font-size: 2rem; font-weight: 700; line-height: 1; margin-bottom: .25rem; }
.stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }

/* ── Layout helpers ──────────────────────────────────────────────────────────── */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    align-items: start;
}
.two-col--sidebar { grid-template-columns: 340px 1fr; }
.card--wide { min-width: 0; }

/* ── Forms ──────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; padding: 0 1.25rem; }
.form-group:first-of-type { padding-top: 1rem; }

label { display: block; font-size: 13px; font-weight: 500; margin-bottom: .35rem; color: var(--text-primary); }

.form-control {
    width: 100%;
    padding: .5rem .75rem;
    border: 1.5px solid var(--border-dark);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 13.5px;
    color: var(--text-primary);
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
    appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(108,99,255,.12);
}

textarea.form-control { resize: vertical; min-height: 120px; }

.form-hint { font-size: 12px; color: var(--text-muted); margin-top: .3rem; display: block; }
.form-actions { padding: 1rem 1.25rem 1.25rem; display: flex; gap: .5rem; flex-wrap: wrap; }

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .5rem 1rem;
    border: none; border-radius: var(--radius-sm);
    font-family: var(--font); font-size: 13.5px; font-weight: 500;
    cursor: pointer; text-decoration: none;
    transition: background .15s, transform .08s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost { background: transparent; border: 1.5px solid var(--border-dark); color: var(--text-primary); }
.btn-ghost:hover { background: #f3f4f6; }
.btn-sm { padding: .35rem .75rem; font-size: 12.5px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-icon {
    font-size: 15px; text-decoration: none; padding: .2rem .35rem;
    border-radius: 4px; transition: background .12s;
    display: inline-flex; align-items: center;
}
.btn-icon:hover { background: #f3f4f6; }
.btn-icon--danger:hover { background: #fee2e2; }

/* ── Tables ─────────────────────────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: .625rem 1rem; text-align: left; border-bottom: 1px solid var(--border); }
.table th { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); background: #fafafa; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #fafbff; }
.table-compact th, .table-compact td { padding: .4rem .75rem; }
.cell-title { font-weight: 500; }
.cell-sub   { font-size: 12px; color: var(--text-muted); }
.cell-error { font-size: 11.5px; color: var(--error); margin-top: .2rem; }
.actions-col { white-space: nowrap; text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; font-size: 12.5px; }
.row-dimmed td { opacity: .45; }

/* ── Badges ─────────────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center;
    padding: .2rem .5rem; border-radius: 100px;
    font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-green  { background: #d1fae5; color: #065f46; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-blue   { background: #dbeafe; color: #1e40af; }
.badge-purple { background: #ede9fe; color: #5b21b6; }
.badge-gray   { background: #f3f4f6; color: #6b7280; }

/* ── Alerts ─────────────────────────────────────────────────────────────────── */
.alert {
    padding: .75rem 1rem; border-radius: var(--radius-sm);
    font-size: 13.5px; margin-bottom: 1rem;
    border-left: 4px solid;
}
.alert-success { background: #f0fdf4; border-color: var(--success); color: #065f46; }
.alert-error   { background: #fff5f5; border-color: var(--error);   color: #991b1b; }
.alert-warning { background: #fffbeb; border-color: var(--warning);  color: #92400e; }

/* ── Status pills ────────────────────────────────────────────────────────────── */
.status-pills { display: flex; gap: .35rem; flex-wrap: wrap; }
.pill {
    padding: .2rem .625rem; border-radius: 100px;
    font-size: 11.5px; font-weight: 500;
    text-decoration: none; color: var(--text-muted);
    border: 1px solid var(--border-dark);
    transition: background .12s;
}
.pill:hover, .pill.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Blog list ───────────────────────────────────────────────────────────────── */
.blog-list { padding: .75rem 0; }
.blog-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: .75rem 1.25rem;
    border-bottom: 1px solid var(--border);
    gap: 1rem;
}
.blog-item:last-child { border-bottom: none; }
.blog-item--inactive { opacity: .5; }
.blog-item-body { flex: 1; min-width: 0; }
.blog-item-name { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: .5rem; }
.blog-item-url  { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.blog-item-meta { margin-top: .3rem; }
.blog-item-actions { display: flex; gap: .25rem; align-items: center; }

/* ── Queue banner ────────────────────────────────────────────────────────────── */
.queue-banner {
    background: var(--accent-light);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    padding: .875rem 1.25rem;
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    font-size: 13.5px;
}

.queue-info {
    padding: 1rem 1.25rem;
    background: #fffbeb;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; flex-wrap: wrap;
}

/* ── Logs ───────────────────────────────────────────────────────────────────── */
.log-container { padding: .5rem 0; }
.log-line {
    display: flex; align-items: baseline; gap: .5rem;
    padding: .35rem 1rem; font-size: 12.5px;
    border-bottom: 1px solid transparent;
    font-family: var(--font-mono);
}
.log-line:hover { background: #f9fafb; }
.log-success { border-left: 3px solid var(--success); }
.log-error   { border-left: 3px solid var(--error); background: #fff5f5; }
.log-warning { border-left: 3px solid var(--warning); background: #fffbeb; }
.log-info    { border-left: 3px solid transparent; }
.log-time    { color: var(--text-muted); flex-shrink: 0; }
.log-icon    { flex-shrink: 0; }
.log-context { color: var(--accent); flex-shrink: 0; }
.log-msg     { color: var(--text-primary); word-break: break-word; }

/* ── Settings ────────────────────────────────────────────────────────────────── */
.settings-section { padding: 1.25rem 1.25rem .5rem; border-bottom: 1px solid var(--border); }
.settings-section:last-of-type { border-bottom: none; }
.settings-section .form-group { padding: 0; }
.settings-section-title { font-weight: 700; font-size: 13px; margin-bottom: .875rem; color: var(--text-primary); }

/* ── Empty state ─────────────────────────────────────────────────────────────── */
.empty-state {
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.75;
}

/* ── Colors ─────────────────────────────────────────────────────────────────── */
.text-success { color: var(--success); }
.text-error   { color: var(--error); }
.text-pending { color: var(--pending); }

.small { font-size: 12.5px; }
.font-mono { font-family: var(--font-mono); }

/* ── Login Page ──────────────────────────────────────────────────────────────── */
body.login-page {
    background: var(--bg-sidebar);
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh;
}

.login-box {
    background: var(--bg-card);
    border-radius: 14px;
    padding: 2.5rem 2rem;
    width: 100%; max-width: 380px;
    box-shadow: var(--shadow-md);
}

.login-brand {
    text-align: center; margin-bottom: 1.75rem;
    display: flex; flex-direction: column; align-items: center; gap: .5rem;
}

.login-brand h1 { font-size: 20px; font-weight: 700; }
.login-brand p  { color: var(--text-muted); font-size: 13.5px; }

.login-box .form-group { padding: 0; margin-bottom: .875rem; }
.login-box .alert { margin-bottom: 1rem; }

/* ── Two-col responsive ──────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .two-col, .two-col--sidebar { grid-template-columns: 1fr; }
    .sidebar { width: 60px; }
    .sidebar .brand-text, .nav-item span:last-child, .sidebar-footer { display: none; }
    .nav-item { justify-content: center; padding: .75rem; }
    .brand-icon { margin: 0 auto; }
    .main { margin-left: 60px; }
}
