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

:root {
    --primary: #FF6B6B;
    --secondary: #4ECDC4;
    --warning: #FFE66D;
    --danger: #FF5252;
    --dark: #1A1A2E;
    --light: #F7F7F7;
    --border: #E0E0E0;
    --text: #333;
    --text-light: #666;
    
    --bg-negative: #FFE5E5;
    --bg-positive: #E5F5E5;
    --bg-neutral: #F5F5F5;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, #ff8787 100%);
    color: white;
    padding: 40px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 32px;
    margin-bottom: 8px;
}

.header .subtitle {
    font-size: 14px;
    opacity: 0.9;
}

.header-stats {
    display: flex;
    gap: 30px;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 12px;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 28px;
    font-weight: bold;
    margin-top: 5px;
}

/* Controls */
.controls {
    display: flex;
    gap: 15px;
    padding: 20px 30px;
    background: var(--light);
    border-bottom: 1px solid var(--border);
    align-items: center;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.3);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(78, 205, 196, 0.3);
}

select {
    padding: 10px 15px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    background: white;
}

/* Grid Layout */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    padding: 20px 30px;
}

.card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.card h2 {
    font-size: 18px;
    margin-bottom: 15px;
    color: var(--primary);
}

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

.trending-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--light);
    border-radius: 6px;
    border-left: 4px solid var(--primary);
}

.trending-item-name {
    font-weight: 600;
    color: var(--text);
}

.trending-item-meta {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: var(--text-light);
}

.trending-item-count {
    background: var(--primary);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
}

/* Heatmap */
.heatmap {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.heatmap-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.heatmap-label {
    width: 120px;
    font-size: 12px;
    font-weight: 500;
}

.heatmap-bar {
    flex: 1;
    height: 24px;
    background: linear-gradient(90deg, var(--secondary), var(--primary));
    border-radius: 4px;
    position: relative;
}

.heatmap-value {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 12px;
    font-weight: 600;
}

/* Sentiment Chart */
.sentiment-chart {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    gap: 15px;
    height: 150px;
    margin-top: 20px;
}

.sentiment-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.sentiment-bar-fill {
    width: 60px;
    border-radius: 4px 4px 0 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
}

.sentiment-bar-negative .sentiment-bar-fill {
    background: var(--danger);
}

.sentiment-bar-neutral .sentiment-bar-fill {
    background: var(--warning);
}

.sentiment-bar-positive .sentiment-bar-fill {
    background: var(--secondary);
}

.sentiment-bar-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

/* Signals List */
.signals-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
}

.signal-item {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.signal-item:hover {
    background: var(--light);
    border-color: var(--primary);
}

.signal-headline {
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.signal-meta {
    display: flex;
    gap: 10px;
    font-size: 12px;
    color: var(--text-light);
    flex-wrap: wrap;
}

.signal-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.badge-negative {
    background: var(--bg-negative);
    color: var(--danger);
}

.badge-neutral {
    background: var(--bg-neutral);
    color: var(--text-light);
}

.badge-positive {
    background: var(--bg-positive);
    color: var(--secondary);
}

.badge-source {
    background: #E3F2FD;
    color: #1976D2;
}

.badge-company {
    background: #F3E5F5;
    color: #7B1FA2;
}

/* Filters */
.filters {
    display: flex;
    gap: 15px;
    padding: 20px 30px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

#filter-company {
    flex: 1;
    min-width: 200px;
    padding: 10px 15px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
}

#filter-company::placeholder {
    color: var(--text-light);
}

/* Table */
.table-card {
    margin: 0 30px 20px 30px;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th {
    background: var(--light);
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text);
    border-bottom: 2px solid var(--border);
}

td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

tr:hover {
    background: var(--light);
}

/* Footer */
.footer {
    background: var(--light);
    border-top: 1px solid var(--border);
    padding: 15px 30px;
    text-align: center;
    font-size: 12px;
    color: var(--text-light);
}

/* Placeholder */
.placeholder {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
    font-size: 14px;
}

/* Loading Animation */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        text-align: center;
    }

    .header-stats {
        margin-top: 20px;
        flex-direction: column;
        gap: 15px;
    }

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

    .controls, .filters {
        flex-direction: column;
    }

    .controls > *, .filters > * {
        width: 100%;
    }

    table {
        font-size: 12px;
    }

    th, td {
        padding: 8px;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}
