/* Custom CSS for animations and Leaflet overrides */
/* Tailwind handles most styling, this is for extras */

/* Modal transitions */
.modal-overlay.active {
    opacity: 1 !important;
    visibility: visible !important;
}

.modal-overlay.active .modal {
    transform: scale(1) !important;
}

/* Table row animation */
.new-row {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Table row hover */
#feedBody tr {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

#feedBody tr:hover {
    background-color: rgba(59, 130, 246, 0.1);
}

/* Connection status pulse animation */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    }

    50% {
        opacity: 0.8;
        box-shadow: 0 0 0 4px rgba(34, 197, 94, 0);
    }
}

.status-dot {
    transition: background-color 0.2s ease;
}

/* Attack map - Leaflet overrides */
#attackMap,
#statsMap {
    height: 320px !important;
    background: #1a1a2e !important;
}

/* Taller map on larger screens */
@media (min-width: 768px) {

    #attackMap,
    #statsMap {
        height: 450px !important;
    }
}

@media (min-width: 1024px) {

    #attackMap,
    #statsMap {
        height: 550px !important;
    }
}

.leaflet-container {
    background: #1a1a2e !important;
    font-family: inherit;
}

.leaflet-popup-content-wrapper {
    background: #1f2937;
    color: #f9fafb;
    border-radius: 0.75rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.leaflet-popup-tip {
    background: #1f2937;
}

.leaflet-popup-content {
    margin: 12px 16px;
}

/* Attack markers - SVG circle markers */
.attack-circle-marker {
    /* Ambient glow animation - visible pulsing */
    filter: drop-shadow(0 0 3px rgba(239, 68, 68, 0.6));
    animation: softGlow 3s ease-in-out infinite;
    /* Stagger via custom property set in JS */
    animation-delay: var(--stagger-delay, 0s);
}

/* Entrance animation - applied temporarily when marker first appears */
.attack-circle-marker.marker-entering {
    animation: markerEnter 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes markerEnter {
    0% {
        transform: scale(0);
        opacity: 0;
        filter: drop-shadow(0 0 0 rgba(239, 68, 68, 0));
    }

    60% {
        transform: scale(1.5);
        opacity: 1;
        filter: drop-shadow(0 0 20px rgba(239, 68, 68, 1));
    }

    100% {
        transform: scale(1);
        opacity: 1;
        filter: drop-shadow(0 0 4px rgba(239, 68, 68, 0.7));
    }
}

@keyframes softGlow {

    0%,
    100% {
        filter: drop-shadow(0 0 2px rgba(239, 68, 68, 0.4));
    }

    50% {
        /* Multiple layered shadows for halo effect */
        filter:
            drop-shadow(0 0 8px rgba(239, 68, 68, 1)) drop-shadow(0 0 20px rgba(239, 68, 68, 0.8)) drop-shadow(0 0 35px rgba(239, 68, 68, 0.4));
    }
}

/* Custom Map Tooltip */
.map-tooltip {
    background: rgba(31, 41, 55, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #f3f4f6;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.map-tooltip::before {
    border-top-color: rgba(31, 41, 55, 0.95);
}

/* Light theme tooltip overrides */
[data-theme="light"] .map-tooltip {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #1f2937;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .map-tooltip::before {
    border-top-color: rgba(255, 255, 255, 0.95);
}

/* Badge Tooltip (Permanent count) */
.badge-tooltip {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 9px;
    /* Smaller font */
    font-weight: 800;
    padding: 0 3px;
    border-radius: 3px;
    /* Squarish look */
    line-height: 14px;
    height: 14px;
    /* Smaller height */
    min-width: 14px;
    /* Smaller width */
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    /* Layering: visible but below popups */
    z-index: 500;
    /* Interaction improvements */
    pointer-events: none;
    /* Let clicks pass through to marker/map */
    user-select: none;
    /* Prevent text selection */
    /* Reset Leaflet defaults */
    margin: 0;
}

.badge-tooltip::before {
    display: none !important;
}

/* Ensure popups are always on top of everything */
.leaflet-popup {
    z-index: 2000 !important;
}

/* Legacy attack markers (keeping for stats page compatibility) */
.attack-marker,
.country-marker {
    position: relative;
    /* Explicit size to match Leaflet iconSize */
    width: 24px;
    height: 24px;
}

.attack-dot {
    width: 12px;
    height: 12px;
    background: #ef4444;
    border-radius: 50%;
    position: absolute;
    /* Center 12px dot in 24px container: (24-12)/2 = 6 */
    top: 6px;
    left: 6px;
    box-shadow: 0 0 12px #ef4444, 0 0 24px rgba(239, 68, 68, 0.5);
    z-index: 2;
}

.attack-pulse {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #ef4444;
    opacity: 0.4;
    position: absolute;
    /* 24px pulse fills 24px container */
    top: 0;
    left: 0;
    animation: pulseRing 1.5s ease-out infinite;
    z-index: 1;
}

@keyframes pulseRing {
    0% {
        transform: scale(0.5);
        opacity: 0.6;
    }

    100% {
        transform: scale(2.5);
        opacity: 0;
    }
}

/* Attack count badge */
.attack-count-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border: 2px solid #1a1a2e;
    border-radius: 9px;
    font-size: 10px;
    font-weight: 700;
    font-family: system-ui, -apple-system, sans-serif;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.5);
    animation: badgePop 0.2s ease-out;
}

@keyframes badgePop {
    0% {
        transform: scale(0);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

/* Light theme badge adjustment */
[data-theme="light"] .attack-count-badge {
    border-color: #ffffff;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.4);
}

/* Service badges */
.service-ssh {
    background-color: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.service-ftp {
    background-color: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
}

.service-telnet {
    background-color: rgba(139, 92, 246, 0.2);
    color: #c4b5fd;
}

.service-http {
    background-color: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

.service-mysql {
    background-color: rgba(6, 182, 212, 0.2);
    color: #67e8f9;
}

.service-default {
    background-color: rgba(107, 114, 128, 0.2);
    color: #9ca3af;
}

/* ===== LIGHT THEME ===== */
/* Professional light theme with proper contrast and shadows */
[data-theme="light"] {
    /* Override body - warm white */
    background-color: #f5f7fa !important;
    color: #1a202c !important;
}

[data-theme="light"] body {
    background-color: #f5f7fa !important;
    color: #1a202c !important;
}

/* Header - clean white with shadow */
[data-theme="light"] header {
    background-color: rgba(255, 255, 255, 0.95) !important;
    border-color: #e2e8f0 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

/* Cards - white with subtle shadow for depth */
[data-theme="light"] [class*="bg-gray-900"] {
    background-color: #ffffff !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06) !important;
}

[data-theme="light"] [class*="bg-gray-950"] {
    background-color: #f8fafc !important;
}

[data-theme="light"] [class*="bg-gray-800"] {
    background-color: #f1f5f9 !important;
}

[data-theme="light"] [class*="from-gray-900"] {
    --tw-gradient-from: #ffffff !important;
}

[data-theme="light"] [class*="to-gray-900"],
[data-theme="light"] [class*="to-gray-950"] {
    --tw-gradient-to: #fafbfc !important;
}

/* Borders - visible but not harsh */
[data-theme="light"] [class*="border-gray-800"],
[data-theme="light"] [class*="border-gray-700"] {
    border-color: #e2e8f0 !important;
}

/* Text colors - proper dark tones for readability */
[data-theme="light"] [class*="text-white"] {
    color: #1a202c !important;
}

[data-theme="light"] [class*="text-gray-100"] {
    color: #2d3748 !important;
}

[data-theme="light"] [class*="text-gray-300"] {
    color: #4a5568 !important;
}

[data-theme="light"] [class*="text-gray-400"] {
    color: #718096 !important;
}

[data-theme="light"] [class*="text-gray-500"] {
    color: #4a5568 !important;
}

/* Accent colors - MUCH darker for light mode visibility */
/* Amber for usernames - dark gold */
[data-theme="light"] [class*="text-amber-400"] {
    color: #b45309 !important;
}

/* Red for passwords - dark red */
[data-theme="light"] [class*="text-red-400"] {
    color: #c53030 !important;
}

/* Blue for paths - dark blue */
[data-theme="light"] [class*="text-blue-400"] {
    color: #2b6cb0 !important;
}

/* Green for success - dark green */
[data-theme="light"] [class*="text-green-400"],
[data-theme="light"] [class*="text-green-500"] {
    color: #276749 !important;
}

/* Purple for telnet badges */
[data-theme="light"] [class*="text-purple-400"] {
    color: #6b46c1 !important;
}

/* Cyan for mysql badges */
[data-theme="light"] [class*="text-cyan-400"] {
    color: #0e7490 !important;
}

/* Dividers */
[data-theme="light"] [class*="divide-gray-800"]>*,
[data-theme="light"] [class*="divide-gray-800/50"]>* {
    border-color: #e2e8f0 !important;
}

/* Table rows - subtle hover */
[data-theme="light"] #feedBody tr:hover {
    background-color: rgba(66, 153, 225, 0.08) !important;
}

/* Stats tables hover */
[data-theme="light"] tr.hover\:bg-gray-800\/30:hover {
    background-color: rgba(66, 153, 225, 0.08) !important;
}

/* Map containers */
[data-theme="light"] #attackMap,
[data-theme="light"] #statsMap {
    background: #e8ecf1 !important;
}

[data-theme="light"] .leaflet-container {
    background: #e8ecf1 !important;
}

[data-theme="light"] .leaflet-popup-content-wrapper {
    background: #ffffff !important;
    color: #1a202c !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15) !important;
}

[data-theme="light"] .leaflet-popup-tip {
    background: #ffffff !important;
}

/* Modal - white with shadow */
[data-theme="light"] .modal {
    background: linear-gradient(to bottom, #ffffff, #fafbfc) !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
}

[data-theme="light"] .modal [class*="bg-gray-800"] {
    background-color: #f7fafc !important;
}

/* Pre/code blocks - distinct background */
[data-theme="light"] pre[class*="bg-gray-950"],
[data-theme="light"] pre[class*="bg-gray-900"] {
    background-color: #edf2f7 !important;
    border-color: #e2e8f0 !important;
    color: #2d3748 !important;
}

/* Code text in pre - darker green for readability */
[data-theme="light"] pre [class*="text-green-400"] {
    color: #276749 !important;
}

/* Font mono elements */
[data-theme="light"] .font-mono {
    color: #2d3748 !important;
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

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

::-webkit-scrollbar-thumb:hover {
    background: #4b5563;
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: #a0aec0;
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: #718096;
}

/* Select dropdown in light mode */
[data-theme="light"] select {
    background-color: #ffffff !important;
    border-color: #e2e8f0 !important;
    color: #1a202c !important;
}

/* Button hover states */
[data-theme="light"] button:hover {
    background-color: #edf2f7 !important;
}

/* Charts legend text */
[data-theme="light"] .chartjs-legend li {
    color: #4a5568 !important;
}

/* Footer */
[data-theme="light"] footer {
    color: #718096 !important;
}

[data-theme="light"] footer a {
    color: #4a5568 !important;
}

[data-theme="light"] footer a:hover {
    color: #2d3748 !important;
}

/* ===== LIGHT THEME SERVICE BADGES ===== */
/* Colorful, vibrant badges with high contrast for light backgrounds */
[data-theme="light"] .service-ssh {
    background-color: rgba(220, 38, 38, 0.15) !important;
    color: #b91c1c !important;
    border: 1px solid rgba(220, 38, 38, 0.3);
}

[data-theme="light"] .service-ftp {
    background-color: rgba(217, 119, 6, 0.15) !important;
    color: #b45309 !important;
    border: 1px solid rgba(217, 119, 6, 0.3);
}

[data-theme="light"] .service-telnet {
    background-color: rgba(124, 58, 237, 0.15) !important;
    color: #6d28d9 !important;
    border: 1px solid rgba(124, 58, 237, 0.3);
}

[data-theme="light"] .service-http {
    background-color: rgba(37, 99, 235, 0.15) !important;
    color: #1d4ed8 !important;
    border: 1px solid rgba(37, 99, 235, 0.3);
}

[data-theme="light"] .service-mysql {
    background-color: rgba(8, 145, 178, 0.15) !important;
    color: #0e7490 !important;
    border: 1px solid rgba(8, 145, 178, 0.3);
}

[data-theme="light"] .service-default {
    background-color: rgba(75, 85, 99, 0.15) !important;
    color: #374151 !important;
    border: 1px solid rgba(75, 85, 99, 0.3);
}