/* MyKai Outreach Dashboard */
:root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --surface-2: #242833;
    --border: #2e3345;
    --text: #e4e6ed;
    --text-muted: #8b8fa3;
    --accent: #6c5ce7;
    --accent-light: #a29bfe;
    --green: #00b894;
    --red: #e17055;
    --orange: #fdcb6e;
    --blue: #74b9ff;
    --radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 220px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 1.5rem 0;
    position: fixed;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    font-size: 1.2rem;
    font-weight: 700;
    padding: 0 1.5rem 1.5rem;
    color: var(--accent-light);
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.nav-link {
    display: block;
    padding: 0.75rem 1.5rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.15s;
}

.nav-link:hover { color: var(--text); background: var(--surface-2); }
.nav-link.active { color: var(--accent-light); background: var(--surface-2); border-right: 3px solid var(--accent); }

/* Content */
.content {
    margin-left: 220px;
    padding: 2rem;
    flex: 1;
    max-width: 1200px;
}

h1 { margin-bottom: 1.5rem; font-size: 1.6rem; }
h1 .subtitle { font-size: 0.9rem; color: var(--text-muted); font-weight: 400; }
h3 { margin-bottom: 0.75rem; font-size: 1.1rem; }

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

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

.stat-card.accent { border-color: var(--accent); }
.stat-card.muted { opacity: 0.6; }
.stat-value { font-size: 1.8rem; font-weight: 700; color: var(--text); }
.stat-card.accent .stat-value { color: var(--accent-light); }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; }

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

.data-table th {
    text-align: left;
    padding: 0.6rem 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

.data-table tr:hover td { background: var(--surface-2); }
.data-table a { color: var(--accent-light); text-decoration: none; }
.data-table a:hover { text-decoration: underline; }

/* Badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-pending, .badge-discovered { background: var(--surface-2); color: var(--text-muted); }
.badge-running, .badge-scraped, .badge-transcribed { background: #2d3a5e; color: var(--blue); }
.badge-completed, .badge-qualified, .badge-analyzed, .badge-messages_generated { background: #1e3a2f; color: var(--green); }
.badge-failed, .badge-rejected { background: #3a2020; color: var(--red); }
.badge-exported, .badge-contacted { background: #3a2d1e; color: var(--orange); }
.badge-parked { background: #2a2a3a; color: #b0b0cc; }
.badge-generated, .badge-uploaded { background: #1e3a2f; color: var(--green); }

/* Score badges */
.score-badge { display: inline-block; padding: 0.3rem 0.6rem; border-radius: 4px; font-weight: 600; margin-left: 0.5rem; }
.score-high { background: #1e3a2f; color: var(--green); }
.score-mid { background: #3a2d1e; color: var(--orange); }
.score-low { background: #3a2020; color: var(--red); }

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: opacity 0.15s;
    text-decoration: none;
}

.btn:hover { opacity: 0.85; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.75rem; }
.btn-danger { background: var(--red); }
.btn-accent { background: var(--green); font-size: 1rem; padding: 0.6rem 1.5rem; }
.btn-run { width: 100%; margin-top: 0.5rem; }

/* Forms */
.filter-form { width: 100%; }
.filter-row { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; }
.filter-row label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.8rem; color: var(--text-muted); }
.filter-row input, .filter-row select {
    padding: 0.4rem 0.5rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-size: 0.85rem;
}

.input-group { display: flex; gap: 0.5rem; align-items: center; }
.input-full {
    flex: 1;
    padding: 0.5rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-size: 0.9rem;
}

textarea.input-full { resize: vertical; }

/* Detail page */
.detail-header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1.5rem; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }

.detail-list { display: grid; grid-template-columns: auto 1fr; gap: 0.4rem 1rem; }
.detail-list dt { color: var(--text-muted); font-size: 0.85rem; }
.detail-list dd { font-size: 0.9rem; word-break: break-word; }
.detail-list a { color: var(--accent-light); }

/* Transcripts */
.transcript-card {
    background: var(--surface-2);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.transcript-meta { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.transcript-meta a { color: var(--accent-light); }
.transcript-caption { font-size: 0.85rem; margin-bottom: 0.3rem; }
.transcript-hashtags { font-size: 0.8rem; color: var(--blue); margin-bottom: 0.3rem; }
.transcript-text { font-size: 0.85rem; color: var(--text-muted); white-space: pre-wrap; }

/* Messages */
.message-section { margin-bottom: 1rem; }
.message-section h4 { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 0.3rem; }

.message-edit, .message-edit-input {
    width: 100%;
    padding: 0.5rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
}

/* Pipeline stages */
.pipeline-stages {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.stage-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
}

.stage-card h3 { font-size: 1rem; }
.stage-card p { font-size: 0.85rem; color: var(--text-muted); }
.stage-card .stat { color: var(--accent-light); font-weight: 600; margin-top: 0.5rem; }

/* Progress bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--surface-2);
    border-radius: 4px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width 0.3s;
    width: 0%;
}

/* Pagination */
.pagination { display: flex; align-items: center; gap: 1rem; margin-top: 1rem; justify-content: center; }

/* Error text */
.error-text { color: var(--red); font-size: 0.8rem; max-width: 200px; overflow: hidden; text-overflow: ellipsis; }

/* Settings form */
.settings-form { margin-bottom: 0; }
.settings-label { display: block; margin-bottom: 0.75rem; font-size: 0.85rem; color: var(--text-muted); }
.settings-label input { margin-top: 0.25rem; }
code { background: var(--surface-2); padding: 0.15rem 0.4rem; border-radius: 3px; font-size: 0.85rem; }

/* Responsive */
@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar-brand { display: none; }
    .nav-link { padding: 0.75rem; text-align: center; font-size: 0.7rem; }
    .content { margin-left: 60px; padding: 1rem; }
    .detail-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(3, 1fr); }
    .pipeline-stages { grid-template-columns: 1fr; }
}
