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

:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --accent-blue: #3b82f6;
    --accent-red: #ef4444;
    --accent-yellow: #f59e0b;
    --accent-green: #10b981;
    --border-color: #475569;
    --shadow: rgba(0, 0, 0, 0.3);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    font-size: 0.9rem;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-yellow);
    animation: pulse 2s infinite;
}

.status-dot.active {
    background: var(--accent-green);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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

.stat-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 1.5rem;
    border-left: 4px solid var(--accent-blue);
    box-shadow: 0 4px 6px var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px var(--shadow);
}

.stat-card.anomaly {
    border-left-color: var(--accent-yellow);
}

.stat-card.threat {
    border-left-color: var(--accent-red);
}

.stat-card.bot {
    border-left-color: var(--accent-green);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.stat-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

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

.panel {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px var(--shadow);
}

.panel h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

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

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

thead {
    background: var(--bg-tertiary);
}

th {
    padding: 0.75rem;
    text-align: left;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    padding: 0.75rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
}

tbody tr:hover {
    background: var(--bg-tertiary);
}

td.empty {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    padding: 2rem;
}

footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 2px solid var(--border-color);
}

.footer-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.footer-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-secondary {
    background: var(--accent-blue);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: #2563eb;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-high {
    background: var(--accent-red);
    color: white;
}

.badge-medium {
    background: var(--accent-yellow);
    color: var(--bg-primary);
}

.badge-low {
    background: var(--accent-green);
    color: white;
}

.panel-description {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    margin-top: -0.5rem;
}

.whitelist-panel {
    margin-top: 1.5rem;
}

.whitelist-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
}

.tab-content {
    display: none;
}

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

.whitelist-form {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.whitelist-input {
    flex: 1;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.75rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: 'Courier New', monospace;
}

.whitelist-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.whitelist-input::placeholder {
    color: var(--text-secondary);
}

.btn-add {
    background: var(--accent-green);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.2s;
    white-space: nowrap;
}

.btn-add:hover {
    background: #059669;
}

.btn-small {
    background: var(--accent-blue);
    color: white;
    border: none;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-small:hover {
    background: #2563eb;
}

.btn-remove {
    background: var(--accent-red);
    color: white;
    border: none;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    transition: background 0.2s;
}

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

.whitelist-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 400px;
    overflow-y: auto;
}

.whitelist-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
    transition: background 0.2s;
}

.whitelist-item:hover {
    background: var(--bg-secondary);
}

.whitelist-item code {
    background: var(--bg-primary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    color: var(--accent-green);
    flex: 1;
    word-break: break-all;
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    padding: 2rem;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .whitelist-form {
        flex-direction: column;
    }
    
    .btn-add {
        width: 100%;
    }
    
    .whitelist-tabs {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        flex: 1;
        min-width: 100px;
    }
    
    .footer-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .footer-buttons button {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .content-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-info {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
}
