:root {
    /* Color Palette */
    --bg-color: #050505;
    --text-primary: #f0f0f0;
    --text-secondary: #888888;

    --accent-blue: #007aff;
    --accent-blue-hover: #0056b3;

    --status-exposed: #ff3b30;
    --status-secured: #34c759;

    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);

    --hacker-green: #00ff41;

    /* Typography */
    --font-ui: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'Roboto Mono', monospace;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-ui);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Background Logs */
.bg-logs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    padding: 2rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--hacker-green);
    opacity: 0.15;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    line-height: 1.5;
    white-space: pre-wrap;
    /* Create a subtle fade out at the bottom */
    mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
}

.log-entry {
    margin-bottom: 4px;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

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

/* Main Container */
.app-container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 1200px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 3rem;
    min-height: 100vh;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1rem;
}

.brand-title {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.light-text {
    font-weight: 300;
    color: var(--text-secondary);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    position: relative;
}

.pulse-ring {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    position: absolute;
    left: 0;
    background-color: var(--text-secondary);
    animation: pulseAnim 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.pulse-core {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-secondary);
    margin-left: 2px;
    z-index: 2;
}

/* Dynamically styled in JS */
.status-indicator.exposed .pulse-ring,
.status-indicator.exposed .pulse-core {
    background-color: var(--status-exposed);
}

.status-indicator.exposed #header-status-text {
    color: var(--status-exposed);
}

.status-indicator.secured .pulse-ring,
.status-indicator.secured .pulse-core {
    background-color: var(--status-secured);
}

.status-indicator.secured #header-status-text {
    color: var(--status-secured);
}

.risk-badge {
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
    margin-left: 1rem;
}


@keyframes pulseAnim {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }

    70% {
        transform: scale(3);
        opacity: 0;
    }

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

/* Hero Visualizer */
.visualizer-section {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem 0;
}

.visualizer-track {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    max-width: 800px;
}

.node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.node-icon {
    font-size: 1.5rem;
}

.node-label {
    font-size: 0.75rem;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    transition: color 0.3s ease;
}

.gateway-node {
    transition: all 0.5s ease;
    position: relative;
}

.gateway-node.secured {
    border-color: var(--status-secured);
    box-shadow: 0 0 20px rgba(52, 199, 89, 0.2);
}

.gateway-node.secured .node-label {
    color: var(--status-secured);
}

/* Secure Tunnel Glow */
.gateway-node.secured::after {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border: 1px solid var(--status-secured);
    border-radius: 14px;
    opacity: 0.3;
    animation: tunnelGlow 2s infinite;
}

@keyframes tunnelGlow {
    0% {
        transform: scale(1);
        opacity: 0.3;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.1;
    }

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

.connection-line {
    flex-grow: 1;
    height: 2px;
    background: var(--glass-border);
    position: relative;
    overflow: hidden;
}

.data-packet {
    position: absolute;
    top: -2px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--accent-blue);
    box-shadow: 0 0 10px var(--accent-blue);
}

.p1 {
    animation: packetMove 2s linear infinite;
}

.p2 {
    animation: packetMove 2s linear 1s infinite;
}

.p3 {
    animation: packetMove 2s linear 0.5s infinite;
}

.p4 {
    animation: packetMove 2s linear 1.5s infinite;
}

/* Dynamic packet coloring based on status */
.out-line.exposed .data-packet {
    background-color: var(--status-exposed);
    box-shadow: 0 0 10px var(--status-exposed);
}

.out-line.secured .data-packet {
    background-color: var(--status-secured);
    box-shadow: 0 0 10px var(--status-secured);
}

@keyframes packetMove {
    0% {
        left: 0;
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        left: 100%;
        opacity: 0;
    }
}

/* Dashboard Cards */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.glass-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.15);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card-icon {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
}

.card-header h2 {
    font-size: 1rem;
    font-weight: 500;
}

.card-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.data-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 0.5rem;
}

.data-row.flex-col {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
}

.data-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.data-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.data-value {
    font-size: 0.95rem;
    font-weight: 500;
    text-align: right;
}

.data-value.sm-text {
    font-size: 0.85rem;
    text-align: left;
}

.data-value.not-supported {
    color: rgba(255, 255, 255, 0.35);
    font-style: italic;
    font-size: 0.85rem;
}

/* Map Visualizer */
.map-container {
    height: 180px;
    width: 100%;
    margin-top: 1rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    overflow: hidden;
    z-index: 5;
    /* Ensure visibility over card background */
}

.isp-visibility-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.visibility-title {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.visibility-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.visibility-list li {
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 500;
}

/* Leaflet Dark Mode Adjustments */
.leaflet-container {
    background: #111 !important;
}

.leaflet-bar a {
    background-color: var(--glass-bg) !important;
    color: var(--text-primary) !important;
    border-bottom: 1px solid var(--glass-border) !important;
}

.leaflet-control-attribution {
    background: rgba(0, 0, 0, 0.5) !important;
    color: var(--text-secondary) !important;
    font-size: 8px !important;
}

.leaflet-marker-icon {
    filter: drop-shadow(0 0 5px var(--accent-blue));
}

.highlight {
    color: var(--accent-blue);
    font-family: var(--font-mono);
}

.not-detected {
    color: var(--text-secondary);
    opacity: 0.6;
    font-family: var(--font-ui);
    font-size: 0.85rem;
}

.centered-status {
    align-items: center;
    text-align: center;
}

.main-status {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.main-status.exposed {
    color: var(--status-exposed);
}

.main-status.secured {
    color: var(--status-secured);
}

.data-value.warning {
    color: var(--status-exposed);
    font-weight: 600;
}

.data-value.safe {
    color: var(--status-secured);
    font-weight: 600;
}

.mt-3 {
    margin-top: 1rem;
}

/* Action Area */
.action-area {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

.cta-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--accent-blue);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 30px;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 122, 255, 0.3);
}

.cta-button:hover {
    background-color: var(--accent-blue-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 122, 255, 0.4);
}

.cta-icon {
    width: 20px;
    height: 20px;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    /* Slightly darker */
    backdrop-filter: blur(8px);
    /* Adjusted to 8px */
    -webkit-backdrop-filter: blur(8px);
    display: none;
    /* Hidden by default */
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    width: 90%;
    max-width: 500px;
    padding: 2.5rem;
    animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(to right, #fff, #888);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.close-x {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
}

.close-x:hover {
    color: #fff;
}

.checklist-item {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.item-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.item-text h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.item-text p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.modal-footer {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .app-container {
        padding: 1rem;
        gap: 2rem;
    }

    /* Header scaling */
    .brand-title {
        font-size: 1.1rem;
    }

    /* Visualizer Optimization */
    .visualizer-section {
        padding: 1rem 0;
    }

    .visualizer-track {
        flex-direction: column;
        gap: 0.5rem;
    }

    .node {
        padding: 0.75rem 1rem;
        min-width: 140px;
    }

    .node-icon {
        font-size: 1.25rem;
    }

    .node-label {
        font-size: 0.65rem;
    }

    .connection-line {
        width: 2px;
        height: 30px;
        margin: 4px 0;
    }

    .out-line {
        height: 30px;
    }

    /* Dashboard Grid Stacking */
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .glass-card {
        padding: 1.25rem;
    }

    /* Map Reduction */
    .map-container {
        height: 120px;
    }

    /* Text Scaling */
    .main-status {
        font-size: 1.1rem;
    }

    .data-value.sm-text {
        font-size: 0.75rem;
    }

    @keyframes packetMove {
        0% {
            top: 0;
            opacity: 0;
            left: -2px;
        }

        10% {
            opacity: 1;
            left: -2px;
        }

        90% {
            opacity: 1;
            left: -2px;
        }

        100% {
            top: 100%;
            opacity: 0;
            left: -2px;
        }
    }
}