:root {
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --accent-high: #ef4444;
    --accent-medium: #f59e0b;
    --accent-low: #3b82f6;
    --accent-ignore: #64748b;
    
    --border-color: #334155;
    --btn-primary: #3b82f6;
    --btn-primary-hover: #2563eb;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background-color: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.brand {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text-main);
}

.project-selector select {
    background-color: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    outline: none;
}

.user-info {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Main Layout */
.dashboard {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Stats */
.stats-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.stat-card h3 {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0.5rem 0;
}

.stat-card.urgent { border-top: 4px solid var(--accent-high); }
.stat-card.warning { border-top: 4px solid var(--accent-medium); }

/* Content Wrapper */
.content-wrapper {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    position: sticky;
    top: 80px;
}

.sidebar h3 {
    margin-bottom: 1rem;
    font-size: 1rem;
}

.filter-group {
    margin-bottom: 1rem;
}

.filter-group label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
}

.filter-group select, .filter-group input {
    width: 100%;
    background-color: var(--bg-main);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
}

/* Buttons */
.btn {
    background-color: var(--bg-hover);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn:hover { background-color: #475569; }

.btn.primary {
    background-color: var(--btn-primary);
    border-color: var(--btn-primary);
    width: 100%;
}
.btn.primary:hover { background-color: var(--btn-primary-hover); }

.btn.small { padding: 0.25rem 0.5rem; font-size: 0.75rem; }

/* Queue */
.queue {
    flex: 1;
}

.queue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.feed {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Opportunity Card */
.opp-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    transition: transform 0.2s ease;
}

.opp-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Priority Visuals */
.opp-card[data-priority="HIGH"] {
    border-left: 4px solid var(--accent-high);
}
.opp-card[data-priority="MEDIUM"] {
    border-left: 4px solid var(--accent-medium);
}
.opp-card[data-priority="LOW"] {
    border-left: 4px solid var(--accent-low);
}

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

.author {
    font-weight: 600;
    font-size: 1rem;
}

.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
}
.badge.HIGH { background-color: rgba(239, 68, 68, 0.2); color: var(--accent-high); }
.badge.MEDIUM { background-color: rgba(245, 158, 11, 0.2); color: var(--accent-medium); }

.post-text {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.analysis-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    background-color: rgba(0,0,0,0.2);
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.analysis-item span:first-child {
    font-weight: 600;
    margin-right: 0.5rem;
}

.reason {
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    font-style: italic;
    color: #cbd5e1;
}

.actions {
    display: flex;
    gap: 0.5rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.actions button {
    flex: 1;
}

.action-engage { background-color: rgba(34, 197, 94, 0.1); color: #22c55e; border-color: rgba(34, 197, 94, 0.2); }
.action-engage:hover { background-color: rgba(34, 197, 94, 0.2); }

.action-ignore { background-color: rgba(239, 68, 68, 0.1); color: #ef4444; border-color: rgba(239, 68, 68, 0.2); }
.action-ignore:hover { background-color: rgba(239, 68, 68, 0.2); }

.action-save { background-color: rgba(59, 130, 246, 0.1); color: #3b82f6; border-color: rgba(59, 130, 246, 0.2); }
.action-save:hover { background-color: rgba(59, 130, 246, 0.2); }

.reviewed-overlay {
    opacity: 0.6;
    pointer-events: none;
}
.reviewed-status {
    color: #22c55e;
    font-weight: bold;
    display: inline-block;
    margin-bottom: 1rem;
}

/* Replies Workspace */
.replies-container {
    margin: 1.5rem 0;
    padding: 1.5rem;
    background-color: rgba(0,0,0,0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.replies-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.replies-header h4 {
    margin: 0;
    color: #38bdf8;
}

.replies-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.reply-item {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: 6px;
    transition: border-color 0.2s ease;
}

.reply-item.selected {
    border-color: #38bdf8;
    background-color: rgba(56, 189, 248, 0.05);
}

.reply-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.reply-badge {
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

.style-badge { background-color: rgba(255,255,255,0.1); color: #e2e8f0; }
.entity-badge { background-color: rgba(168, 85, 247, 0.2); color: #d8b4fe; }

.rel-badge.direct { background-color: rgba(34, 197, 94, 0.2); color: #86efac; }
.rel-badge.contextual { background-color: rgba(234, 179, 8, 0.2); color: #fde047; }
.rel-badge.weak { background-color: rgba(239, 68, 68, 0.2); color: #fca5a5; }

.mention-yes { border: 1px solid #38bdf8; color: #38bdf8; }
.mention-no { border: 1px solid #94a3b8; color: #94a3b8; }

.reply-text {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.reply-reason {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    padding: 0.5rem;
    background-color: rgba(0,0,0,0.15);
    border-radius: 4px;
    border-left: 2px solid var(--accent-medium);
}

.reply-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* --- Navigation --- */
.nav-links {
    display: flex;
    gap: 1.5rem;
    margin-right: auto;
    margin-left: 2rem;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    padding-bottom: 0.25rem;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.nav-links a:hover {
    color: var(--text-primary);
}

.nav-links a.active {
    color: var(--accent-light);
    border-bottom-color: var(--accent-medium);
}

/* --- Analytics Dashboard --- */
.analytics-dashboard {
    padding: 2rem;
}

.analytics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.chart-card, .data-card {
    background-color: var(--bg-card);
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.chart-card h3, .data-card h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1.1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.chart-card canvas {
    max-height: 300px;
}

.data-card.full-width {
    grid-column: 1 / -1;
}

.table-container {
    overflow-x: auto;
}

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

.data-table th, .data-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
}

.data-table a {
    color: var(--accent-light);
    text-decoration: none;
}

.data-table a:hover {
    text-decoration: underline;
}

.high-text {
    color: var(--priority-high);
    font-weight: 600;
}

.success-text {
    color: #22c55e;
    font-weight: 600;
}

.warning-text {
    color: var(--priority-medium);
    font-weight: 600;
}

/* Funnel Visualization */
.funnel-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.funnel-step {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.funnel-label {
    width: 120px;
    font-weight: 500;
    color: var(--text-muted);
}

.funnel-bar {
    flex: 1;
    height: 24px;
    background-color: rgba(255,255,255,0.05);
    border-radius: 4px;
    overflow: hidden;
}

.funnel-fill {
    height: 100%;
    background-color: #3b82f6;
    transition: width 0.5s ease-out;
}

.funnel-fill.priority-fill {
    background-color: #f59e0b;
}

.funnel-fill.success-fill {
    background-color: #22c55e;
}

.funnel-val {
    width: 80px;
    text-align: right;
    font-weight: 600;
}

.reply-workspace {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.reply-workspace label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.engagement-text {
    width: 100%;
    min-height: 100px;
    background-color: var(--bg-main);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
}

.engagement-text:focus {
    outline: none;
    border-color: #38bdf8;
}
