/* Audience Automator -- Dark Theme */

:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    --border: #334155;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --green: #22c55e;
    --red: #ef4444;
    --warn: #f59e0b;
    --info: #06b6d4;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
}

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

.sidebar {
    width: 240px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.nav-links {
    list-style: none;
    padding: 12px 0;
    flex: 1;
}

.nav-links li a {
    display: block;
    padding: 10px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.15s;
}

.nav-links li a:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-links li a.active { color: var(--accent); background: rgba(59, 130, 246, 0.1); border-right: 2px solid var(--accent); }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.target-label { font-size: 12px; color: var(--text-muted); }
.logout-link { font-size: 12px; color: var(--text-muted); text-decoration: none; }
.logout-link:hover { color: var(--red); }

.content {
    flex: 1;
    margin-left: 240px;
    padding: 24px 32px;
    max-width: 1400px;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-header h1 { font-size: 24px; font-weight: 600; }
.header-actions { display: flex; gap: 8px; }

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.card-header h3 { font-size: 16px; font-weight: 600; }
.card h3 { font-size: 16px; font-weight: 600; margin-bottom: 12px; }

/* Grid */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* Stats */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 12px; }
.stat-grid-wide { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 12px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 16px; margin-bottom: 20px; }

.stat { text-align: center; }
.stat-value { display: block; font-size: 24px; font-weight: 700; }
.stat-label { display: block; font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

.stat-row {
    display: flex;
    gap: 20px;
    font-size: 13px;
    color: var(--text-secondary);
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success { background: rgba(34, 197, 94, 0.15); color: var(--green); }
.badge-error { background: rgba(239, 68, 68, 0.15); color: var(--red); }
.badge-warn { background: rgba(245, 158, 11, 0.15); color: var(--warn); }
.badge-info { background: rgba(6, 182, 212, 0.15); color: var(--info); }
.badge-muted { background: rgba(100, 116, 139, 0.15); color: var(--text-muted); }
.badge-type { background: rgba(59, 130, 246, 0.15); color: var(--accent); }
.badge-live { background: rgba(34, 197, 94, 0.2); color: var(--green); }

/* Colors */
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-warn { color: var(--warn); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }
.text-center { text-align: center; }

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    text-align: left;
    padding: 10px 12px;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(51, 65, 85, 0.5);
    white-space: nowrap;
}

.data-table td:first-child { white-space: normal; max-width: 280px; }

.data-table tbody tr:hover { background: var(--bg-hover); }
.data-table a { color: var(--accent); text-decoration: none; }
.data-table a:hover { text-decoration: underline; }

.sortable th[data-sort]:hover { color: var(--accent); }
.sortable th.sort-asc::after { content: ' \25B2'; font-size: 10px; }

/* Filter Tabs */
.filter-tabs { display: flex; gap: 8px; margin-bottom: 16px; }

.filter-tab {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}

.filter-tab:hover { background: var(--bg-hover); color: var(--text-primary); }
.filter-tab.active { background: var(--accent); color: white; border-color: var(--accent); }

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
}

.btn:hover { background: var(--bg-hover); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { background: var(--red); border-color: var(--red); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-warn { background: var(--warn); border-color: var(--warn); color: #1e293b; }
.btn-warn:hover { background: #d97706; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.form-help { font-size: 11px; color: var(--text-muted); }

.form-group input, .form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
}

.form-group input:focus { outline: none; border-color: var(--accent); }
.input-row { display: flex; align-items: center; gap: 8px; }
.input-row input { flex: 1; }
.input-suffix { font-size: 14px; color: var(--text-muted); min-width: 24px; }
.input-mono { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 12px; }

/* Mode Cards */
.mode-card {
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 16px;
}

.mode-dry { background: rgba(245, 158, 11, 0.1); border: 1px solid rgba(245, 158, 11, 0.3); }
.mode-live { background: rgba(34, 197, 94, 0.1); border: 1px solid rgba(34, 197, 94, 0.3); }

.mode-icon {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.mode-dry .mode-icon { color: var(--warn); }
.mode-live .mode-icon { color: var(--green); }
.mode-card p { font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: rgba(239, 68, 68, 0.15); color: var(--red); border: 1px solid rgba(239, 68, 68, 0.3); }

/* Utility */
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }

/* Login */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 40px;
    width: 360px;
    text-align: center;
}

.login-card h1 { font-size: 22px; margin-bottom: 4px; }
.login-subtitle { color: var(--text-muted); font-size: 13px; margin-bottom: 24px; }

.login-card input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    margin-bottom: 12px;
}

.login-card input:focus { outline: none; border-color: var(--accent); }

.login-card button {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 6px;
    background: var(--accent);
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.login-card button:hover { background: var(--accent-hover); }

/* Campaign link */
.campaign-link {
    color: var(--text-primary);
    text-decoration: none;
}
.campaign-link:hover { color: var(--accent); text-decoration: underline; }

/* Responsive */
@media (max-width: 1024px) {
    .sidebar { width: 200px; }
    .content { margin-left: 200px; padding: 16px 20px; }
    .grid-2 { grid-template-columns: 1fr; }
}
