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

body {
    font-family: 'Share Tech Mono', monospace;
    background: #000;
    color: #4DA6FF;
    height: 100vh;
    position: relative;
    overflow: hidden; /* Keep this only for the main body to prevent page scrolling */
}

.container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 10;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, rgba(77, 166, 255, 0.1), rgba(0, 100, 255, 0.1));
    border-bottom: 2px solid #4DA6FF;
    box-shadow: 0 0 20px rgba(77, 166, 255, 0.3);
    flex-shrink: 0;
}

.logo {
    font-family: 'Orbitron', monospace;
    font-size: 24px;
    font-weight: 900;
}

.logo-text {
    color: #4DA6FF;
    text-shadow: 0 0 10px #4DA6FF;
}

.logo-accent {
    color: #ffffff;
    margin-left: 10px;
    text-shadow: 0 0 10px #ffffff;
}

.status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Orbitron', monospace;
    font-size: 14px;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ff0000;
    animation: pulse 2s infinite;
}

.status-indicator.active {
    background: #4DA6FF;
}

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

/* Control Panel */
.control-panel {
    display: flex;
    justify-content: space-between;
    padding: 15px 20px;
    background: rgba(0, 50, 255, 0.3);
    border-bottom: 1px solid #4DA6FF;
    flex-shrink: 0;
}

.stats {
    display: flex;
    gap: 30px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 10px;
    color: #888;
    font-family: 'Orbitron', monospace;
}

.stat-value {
    font-size: 18px;
    font-weight: bold;
    color: #4DA6FF;
    text-shadow: 0 0 5px #4DA6FF;
}

.threat-low {
    color: #4DA6FF !important;
}

.controls {
    display: flex;
    gap: 15px;
}

.btn {
    padding: 8px 16px;
    border: 2px solid;
    background: transparent;
    font-family: 'Orbitron', monospace;
    font-size: 12px;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.3s ease;
}

.btn-danger {
    color: #ff3333;
    border-color: #ff3333;
}

.btn-danger:hover {
    background: #ff3333;
    color: #000;
    box-shadow: 0 0 15px #ff3333;
}

.btn-primary {
    color: #4DA6FF;
    border-color: #4DA6FF;
}

.btn-primary:hover {
    background: #4DA6FF;
    color: #000;
    box-shadow: 0 0 15px #4DA6FF;
}

/* Terminal - This is the key fix */
.terminal {
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid #4DA6FF;
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(77, 166, 255, 0.3);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    min-height: 0; /* Critical for flex scrolling */
    overflow: hidden; /* Prevent terminal itself from scrolling */
}

.terminal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: linear-gradient(135deg, rgba(77, 166, 255, 0.2), rgba(0, 100, 255, 0.1));
    border-bottom: 1px solid #4DA6FF;
    flex-shrink: 0;
}

.terminal-title {
    font-family: 'Orbitron', monospace;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.terminal-icon {
    color: #ff0000;
    animation: pulse 2s infinite;
}

.terminal-controls {
    display: flex;
    gap: 10px;
}

.control {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    cursor: pointer;
}

.minimize { background: #ffff00; color: #000; }
.maximize { background: #4DA6FF; color: #000; }
.close { background: #ff0000; color: #fff; }

/* Terminal Body - THE MAIN FIX FOR SCROLLING */
.terminal-body {
    flex: 1;
    padding: 20px;
    font-size: 13px;
    line-height: 1.4;
    
    /* Enable all forms of scrolling */
    overflow-y: scroll !important;
    overflow-x: hidden;
    
    /* Ensure it can scroll */
    height: 0; /* Forces flex to calculate height */
    min-height: 0;
    
    /* Enable smooth scrolling */
    scroll-behavior: smooth;
    
    /* Make sure it's focusable for keyboard events */
    tabindex: -1;
}

/* Make sure the terminal body can receive focus for keyboard scrolling */
.terminal-body:focus {
    outline: none;
}

.welcome-message {
    text-align: center;
    margin-bottom: 30px;
}

.ascii-art {
    font-size: 8px;
    color: #4DA6FF;
    line-height: 1;
    margin-bottom: 20px;
    white-space: pre;
}

.system-status p {
    margin: 5px 0;
    color: #4DA6FF;
}

.cursor-line {
    margin-top: 20px;
}

.cursor {
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Request Log Styles */
.request-log {
    margin: 15px 0;
    padding: 15px;
    border: 1px solid #333;
    border-left: 4px solid #4DA6FF;
    background: rgba(0, 50, 255, 0.1);
    border-radius: 3px;
    animation: slideInFromTop 0.5s ease-out;
}

@keyframes slideInFromTop {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.request-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.request-method {
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: bold;
}

.method-GET { background: #4DA6FF; color: #000; }
.method-POST { background: #ff8800; color: #000; }
.method-PUT { background: #0088ff; color: #fff; }
.method-DELETE { background: #ff3333; color: #fff; }
.method-PATCH { background: #ffff00; color: #000; }

.request-timestamp {
    font-size: 11px;
    color: #888;
}

.request-url {
    font-size: 14px;
    color: #ffffff;
    margin-bottom: 10px;
    word-break: break-all;
}

.request-details {
    font-size: 11px;
    color: #aaa;
}

.detail-row {
    margin: 3px 0;
}

.detail-label {
    color: #4DA6FF;
    font-weight: bold;
}

.json-data {
    background: rgba(0, 0, 0, 0.5);
    padding: 10px;
    border-radius: 3px;
    margin-top: 10px;
    border-left: 3px solid #4DA6FF;
    white-space: pre-wrap;
    font-size: 10px;
    max-height: 200px;
    overflow-y: auto;
}

/* Cookies Section Styling */
.cookies-section {
    margin: 10px 0;
}

.expandable {
    cursor: pointer;
    user-select: none;
    transition: color 0.3s ease;
}

.expandable:hover {
    color: #6BB6FF;
    text-shadow: 0 0 5px #6BB6FF;
}

.expand-icon {
    display: inline-block;
    margin-right: 5px;
    transition: transform 0.3s ease;
    font-size: 10px;
    color: #4DA6FF;
}

.cookies-content {
    margin-top: 8px;
    margin-left: 20px;
    padding: 10px;
    background: rgba(0, 20, 60, 0.3);
    border-radius: 3px;
    border-left: 2px solid #4DA6FF;
}

.cookie-item {
    margin: 5px 0;
    font-size: 10px;
    line-height: 1.3;
}

.cookie-name {
    color: #4DA6FF;
    font-weight: bold;
}

.cookie-value {
    color: #ffffff;
    word-break: break-all;
}

@keyframes matrixRain {
    0% {
        transform: translateY(-100vh);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh);
        opacity: 0;
    }
}

/* Main Content Layout - Fix frame alignment */
.main-content {
    display: flex;
    gap: 20px;
    flex: 1;
    min-height: 0;
    align-items: stretch; /* Ensure both panels stretch to same height */
    padding: 20px;
}

.terminal {
    flex: 3;
}

.info-section {
    flex: 1;
    border: 2px solid #4DA6FF;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.9);
    box-shadow: 0 0 30px rgba(77, 166, 255, 0.3);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    min-height: 0; /* Important for flexbox height calculation */
    max-height: 100%; /* Ensure it doesn't exceed container height */
    overflow: hidden;
}

/* Scrollbar Styling - Make sure it's visible and functional */
.terminal-body::-webkit-scrollbar {
    width: 12px;
    background: rgba(0, 0, 0, 0.3);
}

.terminal-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 6px;
}

.terminal-body::-webkit-scrollbar-thumb {
    background: #4DA6FF;
    border-radius: 6px;
    border: 2px solid rgba(0, 0, 0, 0.3);
}

.terminal-body::-webkit-scrollbar-thumb:hover {
    background: #6BB6FF;
    box-shadow: 0 0 10px #4DA6FF;
}

.terminal-body::-webkit-scrollbar-thumb:active {
    background: #2D8CFF;
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 10px;
    }
    
    .control-panel {
        flex-direction: column;
        gap: 15px;
    }
    
    .stats {
        justify-content: center;
    }
    
    .main-content {
        flex-direction: column;
        padding: 10px;
    }
    
    .ascii-art {
        font-size: 6px;
    }
    
    .cookies-content {
        margin-left: 10px;
    }
}

/* Globe Section */
.globe-section {
    width: 400px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex-shrink: 0;
}

.globe-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: linear-gradient(135deg, rgba(77, 166, 255, 0.2), rgba(0, 100, 255, 0.1));
    border: 2px solid #4DA6FF;
    border-radius: 5px;
    box-shadow: 0 0 20px rgba(77, 166, 255, 0.2);
}

.globe-title {
    font-family: 'Orbitron', monospace;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #4DA6FF;
}

.globe-icon {
    font-size: 16px;
    animation: pulse 3s infinite;
}

.btn-small {
    padding: 5px 10px;
    font-size: 10px;
}

.globe-container {
    position: relative;
    height: 300px;
    border: 2px solid #4DA6FF;
    border-radius: 5px;
    background: radial-gradient(circle at center, rgba(0, 20, 60, 0.3), rgba(0, 0, 0, 0.9));
    overflow: hidden;
    box-shadow: 0 0 30px rgba(77, 166, 255, 0.2);
}

#globeCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

.loading-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    z-index: 10;
}

.loading-indicator.show {
    display: flex;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(77, 166, 255, 0.3);
    border-top: 3px solid #4DA6FF;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    font-family: 'Orbitron', monospace;
    font-size: 12px;
    color: #4DA6FF;
    text-shadow: 0 0 10px #4DA6FF;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Info Panel */
.info-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: linear-gradient(135deg, rgba(77, 166, 255, 0.2), rgba(0, 100, 255, 0.1));
    border-bottom: 1px solid #4DA6FF;
    flex-shrink: 0;
}

.info-title {
    font-family: 'Orbitron', monospace;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #4DA6FF;
}

.info-icon {
    font-size: 16px;
    animation: pulse 3s infinite;
}

.info-content {
    padding: 20px;
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

/* No Selection State */
.no-selection {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 15px;
    color: #666;
}

.no-selection-icon {
    font-size: 48px;
    opacity: 0.5;
}

.no-selection-text {
    font-family: 'Orbitron', monospace;
    font-size: 12px;
    text-align: center;
    line-height: 1.5;
}

/* Loading State */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 20px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(77, 166, 255, 0.3);
    border-top: 3px solid #4DA6FF;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    font-family: 'Orbitron', monospace;
    font-size: 12px;
    color: #4DA6FF;
    text-shadow: 0 0 10px #4DA6FF;
}

/* Location Details */
.location-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 8px 0;
    border-bottom: 1px solid rgba(77, 166, 255, 0.1);
    font-size: 11px;
}

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

.info-label {
    color: #4DA6FF;
    font-weight: bold;
    font-family: 'Orbitron', monospace;
    min-width: 120px;
    text-align: left;
}

.info-value {
    color: #ffffff;
    text-align: right;
    flex: 1;
    word-break: break-all;
    margin-left: 10px;
}

/* Request Log Clickable Style */
.request-log {
    cursor: pointer;
    transition: all 0.3s ease;
}

.request-log:hover {
    background: rgba(77, 166, 255, 0.1);
    border-left-color: #6BB6FF;
    transform: translateX(3px);
}

.request-log.selected {
    background: rgba(77, 166, 255, 0.2);
    border-left-color: #ffffff;
    border-left-width: 6px;
}

/* Wireframe Map */
.map-container {
    border: 2px solid #4DA6FF;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.9);
    box-shadow: 0 0 20px rgba(77, 166, 255, 0.2);
    overflow: hidden;
    margin-bottom: 15px;
}

.map-header {
    padding: 8px 12px;
    background: linear-gradient(135deg, rgba(77, 166, 255, 0.2), rgba(0, 100, 255, 0.1));
    border-bottom: 1px solid #4DA6FF;
    display: flex;
    align-items: center;
    gap: 8px;
}

.map-icon {
    font-size: 12px;
}

.map-title {
    font-family: 'Orbitron', monospace;
    font-size: 10px;
    color: #4DA6FF;
    font-weight: bold;
}

.wireframe-map {
    height: 120px;
    padding: 10px;
    background: radial-gradient(circle at center, rgba(0, 20, 60, 0.2), rgba(0, 0, 0, 0.8));
    position: relative;
}

#mapSvg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 5px rgba(77, 166, 255, 0.3));
}

/* Map animations */
#worldOutline {
    stroke-dasharray: 5,3;
    animation: dashOffset 20s linear infinite;
}

@keyframes dashOffset {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: 50; }
}

#gridLines line {
    stroke-dasharray: 2,2;
    animation: gridPulse 4s ease-in-out infinite;
}

@keyframes gridPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

/* Location marker styles */
#locationMarker {
    filter: drop-shadow(0 0 3px rgba(255, 68, 68, 0.8));
}

#markerDot {
    filter: drop-shadow(0 0 2px rgba(255, 68, 68, 0.6));
}

#coordsDisplay {
    text-shadow: 0 0 3px #4DA6FF;
}

/* Responsive map */
@media (max-width: 768px) {
    .wireframe-map {
        height: 100px;
        padding: 8px;
    }
    
    .map-header {
        padding: 6px 10px;
    }
    
    .map-title {
        font-size: 9px;
    }
}
