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

body {
    font-family: 'Roboto', sans-serif;
    background: linear-gradient(135deg, #0c0c0c 0%, #1a1a1a 50%, #0c0c0c 100%);
    color: #ffffff;
    min-height: 100vh;
    overflow-x: hidden;
}

/* --- Dashboard Container --- */
.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
    min-height: 100vh;
}

/* --- Main Header --- */
.main-header {
    text-align: center;
    padding: 1rem 0;
    border-bottom: 2px solid #333;
    margin-bottom: 2rem;
}

.title {
    font-family: 'Creepster', cursive;
    font-size: 4.5rem;
    color: #ff6b6b;
    text-shadow: 0 0 20px rgba(255, 107, 107, 0.8);
    margin-bottom: 1rem;
    letter-spacing: 0.1em;
    word-spacing: 0.2em;
}

.flicker {
    animation: flicker 2s infinite alternate;
}

@keyframes flicker {
    0%, 18%, 22%, 25%, 53%, 57%, 100% {
        text-shadow: 0 0 20px rgba(255, 107, 107, 0.8), 0 0 30px rgba(255, 107, 107, 0.6);
    }
    20%, 24%, 55% {
        text-shadow: none;
    }
}

.tagline {
    font-size: 1.1rem;
    color: #ccc;
    margin-top: 0.5rem;
}

/* --- Dashboard Grid --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: 300px 1fr 350px;
    gap: 2rem;
    margin: 2rem 0;
    min-height: 70vh;
}

/* --- Stats Panel (Left) --- */
.stats-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.stats-card, .controls-card {
    background: rgba(30, 30, 30, 0.9);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid #333;
}

.info-card {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.15), rgba(30, 30, 30, 0.9));
    border-radius: 12px;
    padding: 1.5rem;
    border: 2px solid #ff6b6b;
    box-shadow: 0 0 20px rgba(255, 107, 107, 0.3);
    animation: pulseGlow 3s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(255, 107, 107, 0.3);
    }
    50% {
        box-shadow: 0 0 30px rgba(255, 107, 107, 0.5);
    }
}

.stats-card h3, .info-card h4, .controls-card h4 {
    color: #ff6b6b;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.total-counter {
    text-align: center;
}

.total-counter span {
    display: block;
    font-size: 3rem;
    font-weight: bold;
    color: #ff6b6b;
    text-shadow: 0 0 20px rgba(255, 107, 107, 0.5);
}

.total-counter small {
    color: #ccc;
    font-size: 0.9rem;
}

.info-card p {
    color: #ccc;
    line-height: 1.5;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.legend {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-color.flash {
    background: #ff6b6b;
    box-shadow: 0 0 10px rgba(255, 107, 107, 0.8);
}

.legend-color.normal {
    background: #333;
    border: 1px solid #555;
}

.controls-card {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.btn {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
    border: none;
    padding: 0.6rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    font-size: 0.85rem;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #555, #444);
}

.btn-secondary:hover {
    box-shadow: 0 4px 15px rgba(85, 85, 85, 0.4);
}

/* --- Center: Ports Grid --- */
.ports-grid {
    display: flex;
    flex-direction: column;
}

.ports-grid h3 {
    color: #ff6b6b;
    margin-bottom: 1rem;
    text-align: center;
    font-size: 1.2rem;
}

.ports-explanation {
    text-align: center;
    color: #ccc;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: rgba(255, 230, 109, 0.1);
    border-radius: 6px;
    border: 1px solid rgba(255, 230, 109, 0.3);
}

#threat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.8rem;
    flex: 1;
}

.threat-card.compact {
    background: rgba(40, 40, 40, 0.9);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    border: 1px solid #333;
    transition: all 0.3s ease;
    cursor: pointer;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.threat-card.compact:hover {
    border-color: #ff6b6b;
    transform: translateY(-2px);
}

.threat-card.compact.flash {
    background: rgba(255, 107, 107, 0.3);
    border-color: #ff6b6b;
    box-shadow: 0 0 20px rgba(255, 107, 107, 0.5);
    animation: flashCard 0.7s ease-out;
}

@keyframes flashCard {
    0% {
        background: rgba(255, 107, 107, 0.6);
        transform: scale(1.05);
    }
    100% {
        background: rgba(255, 107, 107, 0.3);
        transform: scale(1);
    }
}

.threat-card.compact .port-number {
    font-size: 1.5rem;
    font-weight: bold;
    color: #ff6b6b;
}

.threat-card.compact .port-name {
    font-size: 0.8rem;
    color: #ccc;
    margin: 0.3rem 0;
}

.threat-card.compact .attack-count {
    font-size: 1.2rem;
    font-weight: bold;
    color: #ffe66d;
    background: rgba(255, 230, 109, 0.1);
    border-radius: 4px;
    padding: 0.2rem 0.5rem;
}

/* --- Right: History Panel --- */
.history-panel {
    display: flex;
    flex-direction: column;
}

.history-panel h3 {
    color: #ff6b6b;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.attack-log.compact {
    background: rgba(30, 30, 30, 0.9);
    border-radius: 8px;
    border: 1px solid #333;
    flex: 1;
    overflow-y: auto;
    max-height: 500px;
}

.log-header {
    display: grid;
    grid-template-columns: 1fr 1.2fr 0.8fr 1fr;
    gap: 0.5rem;
    padding: 0.8rem;
    background: rgba(255, 107, 107, 0.1);
    border-bottom: 2px solid #ff6b6b;
    font-weight: bold;
    font-size: 0.75rem;
    color: #ff6b6b;
    position: sticky;
    top: 0;
    z-index: 10;
}

.log-header span {
    text-align: center;
}

.attack-entry {
    display: grid;
    grid-template-columns: 1fr 1.2fr 0.8fr 1fr;
    gap: 0.5rem;
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid #333;
    font-size: 0.8rem;
    line-height: 1.3;
    align-items: center;
}

.attack-entry > div {
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attack-entry:hover {
    background: rgba(255, 107, 107, 0.1);
}

.attack-entry.new-entry {
    background: rgba(255, 107, 107, 0.2);
    animation: highlightAttack 2s ease-out;
}

@keyframes highlightAttack {
    0% {
        background: rgba(255, 107, 107, 0.4);
        transform: scale(1.02);
    }
    100% {
        background: rgba(255, 107, 107, 0.1);
        transform: scale(1);
    }
}

.no-attacks {
    text-align: center;
    color: #666;
    padding: 2rem;
    font-style: italic;
}

/* --- Status Bar --- */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
    background: rgba(30, 30, 30, 0.7);
    border-top: 1px solid #333;
    margin-top: 2rem;
    border-radius: 6px;
}

.status-item {
    font-size: 0.85rem;
    color: #ccc;
}

/* --- Responsive Design --- */
@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: 250px 1fr 300px;
    }
}

@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .stats-panel {
        flex-direction: row;
        gap: 1rem;
    }
    
    .stats-card, .info-card, .controls-card {
        flex: 1;
    }
    
    .status-bar {
        flex-direction: column;
        gap: 0.5rem;
    }
}

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

::-webkit-scrollbar-track {
    background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
    background-color: #555;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background-color: #777;
}
