/* styles.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: #f9fafb;
    color: #111827;
    line-height: 1.6;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Header */
.header {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    margin-bottom: 24px;
}

.header-content {
    padding: 16px 0;
}

.header h1 {
    font-size: 24px;
    font-weight: bold;
    color: #111827;
    margin-bottom: 4px;
}

.subtitle {
    font-size: 14px;
    color: #6b7280;
}

/* Error Banner */
.error-banner {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-retry {
    background: #ef4444;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.btn-retry:hover {
    background: #dc2626;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 24px;
}

.stat-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-label {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 30px;
    font-weight: bold;
    margin: 8px 0;
}

.stat-subtitle {
    font-size: 12px;
    color: #6b7280;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

/* Tabs */
.tabs-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 24px;
}

.tabs-header {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
}

.tab-btn {
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    background: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    color: #6b7280;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: #374151;
    border-bottom-color: #d1d5db;
}

.tab-btn.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

.tab-content {
    display: none;
    padding: 24px;
}

.tab-content.active {
    display: block;
}

/* Charts */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
}

.chart-container {
    margin-bottom: 24px;
}

.chart-container h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

/* Messages List */
.messages-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.message-card:hover {
    background-color: #f9fafb;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 8px;
}

.message-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.sender-name {
    font-weight: 500;
}

.badge {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 4px;
}

.badge-city {
    background: #dbeafe;
    color: #1e40af;
}

.badge-type {
    background: #e9d5ff;
    color: #6b21a8;
}

.message-meta {
    text-align: right;
    font-size: 12px;
    color: #6b7280;
}

.confidence {
    margin-top: 4px;
}

.message-summary {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 8px;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.tag {
    font-size: 12px;
    background: #f3f4f6;
    color: #374151;
    padding: 2px 8px;
    border-radius: 4px;
}

/* Table */
.table-container {
    overflow-x: auto;
}

.contributors-table {
    width: 100%;
    border-collapse: collapse;
}

.contributors-table thead {
    background: #f9fafb;
}

.contributors-table th {
    padding: 12px;
    text-align: left;
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
    text-transform: uppercase;
}

.contributors-table td {
    padding: 16px 12px;
    font-size: 14px;
    border-top: 1px solid #e5e7eb;
}

.contributors-table tbody tr:hover {
    background: #f9fafb;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #6b7280;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .tabs-header {
        overflow-x: auto;
    }

    .message-header {
        flex-direction: column;
        gap: 8px;
    }

    .message-meta {
        text-align: left;
    }
}

/* Loading Spinner */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

.spinner {
    border: 4px solid #f3f4f6;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}