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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #111;
    color: #eee;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #1a2a3a 0%, #0f1a24 100%);
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    z-index: 10;
    flex-shrink: 0;
}

h1 {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.stats {
    display: flex;
    gap: 12px;
    background: rgba(15, 26, 36, 0.8);
    backdrop-filter: blur(4px);
    padding: 4px 12px;
    border-radius: 40px;
    font-size: 0.7rem;
    flex-wrap: wrap;
}

.stats span {
    color: #ffaa44;
    font-weight: bold;
}

.stats #blockedCount {
    color: #ff4444;
}

.top-countries {
    display: flex;
    gap: 8px;
    background: rgba(15, 26, 36, 0.8);
    backdrop-filter: blur(4px);
    padding: 4px 12px;
    border-radius: 40px;
    font-size: 0.65rem;
    align-items: center;
    flex-wrap: wrap;
}

.top-countries span.country-badge {
    background: #2c5a6e;
    padding: 2px 6px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.controls {
    padding: 6px 20px;
    background: #0f1a24;
    display: flex;
    gap: 10px;
    border-bottom: 1px solid #2c3e44;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.controls-left {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.settings-btn {
    background: #3e7e9a;
    display: flex;
    align-items: center;
    gap: 6px;
}

button {
    background: #2c5a6e;
    border: none;
    color: white;
    padding: 4px 12px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.2s;
    font-size: 0.7rem;
}

button:hover {
    background: #3e7e9a;
    transform: scale(0.98);
}

button:active {
    transform: scale(0.95);
}

.container {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

#map {
    flex: 1;
    background: #1a2a2a;
    position: relative;
}

.sidebar {
    width: 320px;
    background: rgba(15, 26, 36, 0.95);
    backdrop-filter: blur(8px);
    border-left: 1px solid #2c3e44;
    display: flex;
    flex-direction: column;
    font-size: 0.7rem;
    z-index: 10;
    flex-shrink: 0;
}

.sidebar h3 {
    padding: 10px;
    background: #0a1520;
    border-bottom: 1px solid #2c3e44;
    font-size: 0.85rem;
    margin: 0;
    flex-shrink: 0;
}

.blocked-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    min-height: 0;
}

.blocked-scroll::-webkit-scrollbar {
    width: 3px;
}

.blocked-scroll::-webkit-scrollbar-track {
    background: #0a1520;
}

.blocked-scroll::-webkit-scrollbar-thumb {
    background: #ffaa44;
    border-radius: 3px;
}

.blocked-item {
    background: #0a121a;
    margin-bottom: 4px;
    padding: 6px 8px;
    border-radius: 5px;
    border-left: 2px solid #ff4444;
    font-family: monospace;
    font-size: 0.65rem;
    animation: slideIn 0.2s ease-out;
}

.blocked-item.fade-out {
    animation: fadeOut 0.4s ease-out forwards;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(15px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(15px);
    }
}

.blocked-ip {
    font-weight: bold;
    color: #ff4444;
}

.flag {
    font-size: 1em;
    margin-right: 3px;
}

.blocked-country {
    color: #88aacc;
}

.blocked-city {
    color: #6688aa;
    font-size: 0.6rem;
}

.blocked-reason {
    color: #ffaa44;
    font-size: 0.55rem;
    margin-top: 2px;
}

.blocked-time {
    color: #6688aa;
    font-size: 0.5rem;
    text-align: right;
}

.footer {
    font-size: 0.6rem;
    text-align: center;
    padding: 3px;
    background: #0a121a;
    flex-shrink: 0;
}

.info-panel {
    position: absolute;
    bottom: 15px;
    left: 15px;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    border-radius: 10px;
    padding: 10px 15px;
    font-size: 0.7rem;
    z-index: 1000;
    pointer-events: none;
    border-left: 3px solid #ffaa44;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.3);
    line-height: 1.5;
    min-width: 240px;
}

.info-panel strong {
    color: #ffaa44;
}

/* ============================================================
   ATTACK PANEL
   ============================================================ */
.attack-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(12px);
    border-radius: 12px;
    width: 380px;
    max-height: 550px;
    z-index: 1000;
    pointer-events: auto;
    border-right: 3px solid #ff4444;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    font-size: 0.7rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.attack-header {
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 14px;
    border-bottom: 1px solid #ff4444;
    font-weight: bold;
    color: #ffaa44;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.attack-badge {
    background: #ff4444;
    color: white;
    border-radius: 20px;
    padding: 2px 10px;
    font-size: 0.7rem;
    font-weight: bold;
}

.attack-clear-btn {
    background: rgba(255, 68, 68, 0.3);
    border: 1px solid #ff4444;
    color: #ff8888;
    padding: 2px 8px;
    font-size: 0.6rem;
    border-radius: 20px;
}

.attack-clear-btn:hover {
    background: #ff4444;
    color: white;
}

.attack-list {
    flex: 1;
    overflow-y: auto;
    max-height: 450px;
    padding: 8px;
    min-height: 0;
}

.attack-list::-webkit-scrollbar {
    width: 4px;
}

.attack-list::-webkit-scrollbar-track {
    background: #0a1520;
}

.attack-list::-webkit-scrollbar-thumb {
    background: #ff4444;
    border-radius: 4px;
}

.attack-item {
    background: #0a121a;
    margin-bottom: 6px;
    padding: 8px 10px;
    border-radius: 6px;
    border-left: 3px solid #ff4444;
    font-family: monospace;
    font-size: 0.7rem;
}

.attack-item.ftp {
    border-left-color: #ffaa44;
}

.attack-item.smtp {
    border-left-color: #ff4444;
}

.attack-item.ssh {
    border-left-color: #ff6600;
}

.attack-item .attack-ip {
    font-weight: bold;
    color: #ff4444;
}

.attack-item .attack-reason {
    color: #ffaa44;
    font-size: 0.6rem;
    margin-top: 4px;
}

.attack-item .attack-time {
    color: #6688aa;
    font-size: 0.55rem;
    text-align: right;
    margin-top: 4px;
}

.attack-item-new {
    animation: slideInRight 0.3s ease-out;
}

.attack-item-removing {
    animation: fadeOutRight 0.3s ease-out forwards;
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeOutRight {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(50px); }
}

/* Responsiivisuus */
@media (max-width: 900px) {
    .attack-panel { width: 320px; max-height: 400px; top: 10px; right: 10px; }
    .attack-list { max-height: 330px; }
}

@media (max-width: 700px) {
    .attack-panel { width: 280px; max-height: 350px; top: 60px; right: 10px; }
    .attack-list { max-height: 280px; }
}

.legend {
    position: absolute;
    bottom: 15px;
    right: 340px;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    border-radius: 10px;
    padding: 5px 10px;
    font-size: 0.6rem;
    z-index: 1000;
    pointer-events: none;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.legend-item {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 3px;
}

.nuclear-icon {
    width: 28px;
    height: 28px;
    background: radial-gradient(circle, #ff6600, #cc0000);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffff00;
    box-shadow: 0 0 15px #ff0000;
    cursor: pointer;
    animation: nuclearExplosion 8s ease-out forwards;
}

.nuclear-icon span {
    font-size: 16px;
    animation: iconShrink 8s ease-out forwards;
}

.exploded-icon {
    width: 24px !important;
    height: 24px !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.exploded-icon span {
    font-size: 20px;
    filter: drop-shadow(0 0 3px #ff0000);
    background: transparent !important;
}

.nuclear-icon-pulse {
    width: 24px;
    height: 24px;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    animation: pulseOutward 0.5s ease-out 2;
}

.nuclear-icon-pulse::before {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid #ffaa44;
    border-radius: 50%;
    box-shadow: 0 0 5px #ffaa44;
    animation: pulseRing 0.5s ease-out 2;
}

.nuclear-icon-pulse span {
    display: none;
}

.trusted-icon {
    width: 14px;
    height: 14px;
    background: #3388ff;
    border-radius: 50%;
    border: 1px solid white;
    box-shadow: 0 0 5px #3388ff;
}

.https-icon {
    width: 14px;
    height: 14px;
    background: #33aaff;
    border-radius: 50%;
    border: 1px solid #aaddff;
    box-shadow: 0 0 6px #33aaff;
}

.threat-marker-safe {
    width: 10px;
    height: 10px;
    background: #44ff44;
    border-radius: 50%;
    border: 1px solid white;
}

.threat-marker-warning {
    width: 12px;
    height: 12px;
    background: #ffaa44;
    border-radius: 50%;
    border: 1px solid white;
    box-shadow: 0 0 5px #ffaa44;
}

.threat-marker-danger {
    width: 14px;
    height: 14px;
    background: #ff4444;
    border-radius: 50%;
    border: 1.5px solid white;
    box-shadow: 0 0 8px #ff0000;
}

.explosion-text {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    background: rgba(0,0,0,0.6);
    padding: 2px 6px;
    border-radius: 12px;
    pointer-events: none;
    z-index: 1000;
    text-shadow: 0 0 2px black;
    font-weight: bold;
}

.nuclear-marker, .exploded-marker, .pulse-marker, .ring-marker {
    position: relative;
}

.nuclear-marker .explosion-text, 
.exploded-marker .explosion-text {
    bottom: -28px;
}

@keyframes nuclearExplosion {
    0% { width: 72px; height: 72px; margin-left: -22px; margin-top: -22px; background: radial-gradient(circle, #ffff00, #ff0000); box-shadow: 0 0 50px #ff6600; }
    50% { width: 48px; height: 48px; margin-left: -10px; margin-top: -10px; background: radial-gradient(circle, #ff8800, #cc0000); box-shadow: 0 0 30px #ff4400; }
    100% { width: 28px; height: 28px; margin-left: 0px; margin-top: 0px; background: radial-gradient(circle, #ff6600, #cc0000); box-shadow: 0 0 15px #ff0000; }
}

@keyframes iconShrink {
    0% { font-size: 42px; }
    50% { font-size: 28px; }
    100% { font-size: 16px; }
}

@keyframes pulseRing {
    0% { width: 14px; height: 14px; opacity: 1; }
    50% { width: 24px; height: 24px; opacity: 0.7; }
    100% { width: 20px; height: 20px; opacity: 1; }
}

@keyframes pulseOutward {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

.pulse-ring-expand { position: relative; }
.pulse-ring-expand::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: transparent;
    animation: ringExpand 1.5s ease-out infinite;
    pointer-events: none;
}

.pulse-ring-shrink { position: relative; }
.pulse-ring-shrink::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200%;
    height: 200%;
    border-radius: 50%;
    background: transparent;
    animation: ringShrink 1.5s ease-out infinite;
    pointer-events: none;
}

.pulse-ring-blink { position: relative; }
.pulse-ring-blink::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 150%;
    height: 150%;
    border-radius: 50%;
    background: transparent;
    animation: ringBlink 0.8s ease-in-out infinite;
    pointer-events: none;
}

@keyframes ringExpand {
    0% { width: 0%; height: 0%; opacity: 1; border: 2px solid currentColor; }
    100% { width: 200%; height: 200%; opacity: 0; border: 2px solid currentColor; }
}

@keyframes ringShrink {
    0% { width: 200%; height: 200%; opacity: 1; border: 2px solid currentColor; }
    100% { width: 0%; height: 0%; opacity: 0; border: 2px solid currentColor; }
}

@keyframes ringBlink {
    0%, 100% { opacity: 0.3; border: 2px solid currentColor; width: 100%; height: 100%; }
    50% { opacity: 1; border: 3px solid currentColor; width: 160%; height: 160%; }
}

.laser-line {
    stroke: #ff0000;
    stroke-width: 2;
    stroke-dasharray: 4, 4;
    animation: laserPulse 0.5s infinite;
}

@keyframes laserPulse {
    0%, 100% { stroke-opacity: 1; stroke-width: 2; }
    50% { stroke-opacity: 0.5; stroke-width: 3; }
}

.home-icon {
    width: 28px;
    height: 28px;
    cursor: pointer;
    transition: 0.2s;
    vertical-align: middle;
    margin-right: 8px;
}

.home-icon:hover {
    transform: scale(1.1);
    filter: drop-shadow(0 0 5px #ffaa44);
}

.home-marker {
    cursor: pointer;
    transition: transform 0.2s;
}

.home-marker:hover {
    transform: scale(1.1);
}

.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    animation: pulseDot 2s ease-in-out infinite;
}

@keyframes pulseDot {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; box-shadow: 0 0 5px currentColor; }
}

.status-connected { background: #44ff44; box-shadow: 0 0 5px #44ff44; }
.status-disconnected { background: #ff4444; animation: none; }

.blinking-text {
    animation: blinkText 1s step-end infinite;
}

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

[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]:before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1a2a3a;
    color: #ffaa44;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.6rem;
    white-space: nowrap;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

[data-tooltip]:hover:before {
    opacity: 1;
}

.version-badge {
    position: fixed;
    bottom: 10px;
    right: 10px;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.6rem;
    color: #ffaa44;
    z-index: 1000;
    pointer-events: none;
    font-family: monospace;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #1a2a3a;
    border-radius: 12px;
    width: 95%;
    max-width: 1200px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 15px;
    border: 1px solid #2c5a6e;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid #2c5a6e;
}

.modal-header h2 {
    font-size: 1.2rem;
}

.close-modal {
    background: #ff4444;
    padding: 3px 12px;
}

.tab-buttons {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    border-bottom: 1px solid #2c5a6e;
    flex-wrap: wrap;
}

.tab-btn {
    background: none;
    border-radius: 0;
    padding: 6px 12px;
    font-size: 0.7rem;
}

.tab-btn.active {
    background: #3e7e9a;
    border-bottom: 2px solid #ffaa44;
}

.tab-pane {
    display: none;
}

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

.settings-section {
    margin-bottom: 15px;
    padding: 8px;
    background: #0f1a24;
    border-radius: 8px;
}

.settings-section h3 {
    font-size: 0.85rem;
    color: #ffaa44;
    margin-bottom: 8px;
}

.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid #2c3e44;
    flex-wrap: wrap;
    gap: 8px;
}

.settings-row:last-child {
    border-bottom: none;
}

.settings-label {
    font-weight: bold;
    font-size: 0.75rem;
}

.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #2c5a6e;
    transition: 0.2s;
    border-radius: 20px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: 0.2s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #44aa44;
}

input:checked + .slider:before {
    transform: translateX(20px);
}

.rule-card {
    background: #0a1520;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 10px;
    border-left: 3px solid #ffaa44;
}

.rule-card h4 {
    font-size: 0.8rem;
    margin-bottom: 8px;
    color: #ffaa44;
}

.rule-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 6px;
}

.rule-row input, .rule-row select {
    background: #1a2a3a;
    border: 1px solid #2c5a6e;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
}

.rule-row input {
    width: 100px;
}

.rule-row select {
    width: 80px;
}

.rule-row button {
    padding: 2px 8px;
    font-size: 0.6rem;
}

.btn-small {
    padding: 2px 6px;
    font-size: 0.65rem;
}

.btn-danger {
    background: #ff4444;
}

.btn-success {
    background: #44aa44;
}

.btn-warning {
    background: #ffaa44;
    color: #111;
}

.port-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.port-tag {
    background: #2c5a6e;
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 0.65rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.port-tag button {
    background: none;
    border: none;
    color: #ffaa44;
    cursor: pointer;
    padding: 0 3px;
    font-size: 0.65rem;
}

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 8px;
    background: #0a1520;
    margin-bottom: 4px;
    border-radius: 4px;
    font-size: 0.7rem;
}

.info-text {
    background: #0f1a24;
    padding: 12px;
    border-radius: 8px;
    line-height: 1.5;
    font-size: 0.75rem;
}

.info-text code {
    background: #2c5a6e;
    padding: 2px 4px;
    border-radius: 4px;
}

@media (max-width: 800px) {
    .sidebar { width: 260px; }
    .legend { right: 280px; }
    .stats, .top-countries { font-size: 0.55rem; gap: 4px; }
    .modal-content { width: 98%; max-width: none; }
    .rule-row input { width: 70px; }
}

:-webkit-full-screen { width: 100%; height: 100%; }
:fullscreen { width: 100%; height: 100%; }
