/* ── VoltaContent - CSS ── */

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Theme Variables ── */
:root {
    --bg: #f8f9fa;
    --bg-card: #ffffff;
    --bg-sidebar: #1e293b;
    --bg-input: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --text-sidebar: #cbd5e1;
    --text-sidebar-active: #ffffff;
    --border: #e2e8f0;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #eef2ff;
    --success: #22c55e;
    --success-light: #f0fdf4;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --info: #3b82f6;
    --info-light: #eff6ff;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --radius: 8px;
    --radius-sm: 4px;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'SF Mono', Monaco, 'Cascadia Code', monospace;
}

[data-theme="dark"] {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-sidebar: #0f172a;
    --bg-input: #334155;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --text-sidebar: #94a3b8;
    --text-sidebar-active: #ffffff;
    --border: #334155;
    --primary-light: #1e1b4b;
    --success-light: #052e16;
    --warning-light: #451a03;
    --danger-light: #450a0a;
    --info-light: #172554;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
}

/* ── Base ── */
html { font-size: 15px; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── App Layout ── */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
    width: 240px;
    background: var(--bg-sidebar);
    color: var(--text-sidebar);
    padding: 1.5rem 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}
.sidebar-brand {
    padding: 0 1.25rem 1.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.02em;
}
.sidebar-nav { flex: 1; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1.25rem;
    color: var(--text-sidebar);
    font-size: 0.9rem;
    transition: background 0.15s, color 0.15s;
}
.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: rgba(255,255,255,0.08);
    color: var(--text-sidebar-active);
    text-decoration: none;
}
.sidebar-nav a svg {
    width: 18px;
    height: 18px;
    opacity: 0.7;
}
.sidebar-section {
    padding: 1rem 1.25rem 0.5rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}
.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

/* ── Main Content ── */
.main-content {
    flex: 1;
    margin-left: 240px;
    padding: 2rem;
    max-width: 1200px;
}
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}
.page-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

/* ── Cards ── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1rem;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}
.card-header h2, .card-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

/* ── Forms ── */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
}
.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: var(--font);
    transition: border-color 0.15s;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}
.form-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: var(--font);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
    text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
}
.btn-outline:hover { background: var(--bg); }
.btn-sm { padding: 0.3rem 0.625rem; font-size: 0.8rem; }
.btn-group { display: flex; gap: 0.5rem; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    text-align: left;
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}
th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
tr:hover td { background: rgba(99,102,241,0.03); }

/* ── Badges / Status ── */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 999px;
    letter-spacing: 0.02em;
}
.badge-pending { background: var(--warning-light); color: var(--warning); }
.badge-processing, .badge-fetching, .badge-crawling, .badge-analyzing { background: var(--info-light); color: var(--info); }
.badge-completed, .badge-ready, .badge-fetched, .badge-validated { background: var(--success-light); color: var(--success); }
.badge-failed, .badge-error, .badge-trashed { background: var(--danger-light); color: var(--danger); }
.badge-raw { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.badge-ai_rewritten { background: var(--primary-light); color: var(--primary); }
.badge-in_review { background: var(--info-light); color: var(--info); }

/* ── Alerts / Flash Messages ── */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}
.alert-success { background: var(--success-light); color: #166534; border: 1px solid var(--success); }
.alert-error { background: var(--danger-light); color: #991b1b; border: 1px solid var(--danger); }
.alert-info { background: var(--info-light); color: #1e40af; border: 1px solid var(--info); }
.alert-warning { background: var(--warning-light); color: #92400e; border: 1px solid var(--warning); }

/* ── Toast Notifications ── */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.toast {
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    font-size: 0.875rem;
    animation: toast-in 0.3s ease;
    max-width: 360px;
}
.toast.toast-success { border-left: 3px solid var(--success); }
.toast.toast-error { border-left: 3px solid var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }

/* ── Stats Grid ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 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;
    box-shadow: var(--shadow);
}
.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
}
.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* ── QA Editor ── */
.qa-columns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}
.qa-column {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
}
.qa-column h4 {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.75rem;
}
.qa-question {
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.qa-answer {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ── Export Preview ── */
.export-preview {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    overflow-x: auto;
    white-space: pre-wrap;
    max-height: 500px;
    overflow-y: auto;
}

/* ── Empty State ── */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}
.empty-state p { margin-top: 0.5rem; }

/* ── Theme Toggle ── */
.theme-toggle {
    background: none;
    border: none;
    color: var(--text-sidebar);
    cursor: pointer;
    padding: 0.375rem;
    border-radius: var(--radius-sm);
}
.theme-toggle:hover { background: rgba(255,255,255,0.1); }

/* ── Auth Layout ── */
.auth-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}
.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 2rem;
    width: 100%;
    max-width: 420px;
}
.auth-card h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}
.auth-card .subtitle {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}
.auth-footer {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; }
    .qa-columns { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Utility ── */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.85rem; }
.text-right { text-align: right; }
.hidden { display: none; }
