/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'VT323', monospace;
    background: #000000;
    color: #00FF00;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

/* CRT Screen Effects */
.crt-screen {
    position: relative;
    min-height: 100vh;
    background: #000000;
    padding: 20px;
    overflow-y: auto;
}

.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        transparent 50%,
        rgba(0, 255, 0, 0.03) 50%
    );
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 1000;
    animation: scanline 8s linear infinite;
}

@keyframes scanline {
    0% { transform: translateY(0); }
    100% { transform: translateY(4px); }
}

.glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        ellipse at center,
        rgba(0, 255, 0, 0.05) 0%,
        transparent 70%
    );
    pointer-events: none;
    z-index: 999;
    animation: glow-pulse 3s ease-in-out infinite;
}

@keyframes glow-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.8; }
}

/* Container */
.container {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    z-index: 1;
    padding: 20px;
}

/* Page Header */
.page-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    font-size: 28px;
    color: #00FF00;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
    letter-spacing: 3px;
    z-index: 100;
    font-weight: normal;
    animation: fade-in 1s ease-in;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.page-header:hover {
    color: #33FF33;
    text-shadow: 0 0 15px rgba(51, 255, 51, 0.8);
}

/* Header with background for leaderboard */
body.leaderboard-active .page-header {
    background: #000000;
    border-bottom: 1px solid rgba(0, 255, 0, 0.3);
    box-shadow: 0 2px 10px rgba(0, 255, 0, 0.2);
}

/* Header with background for map page */
body.map-page .page-header,
.map-page .page-header {
    background: #000000;
    border-bottom: 1px solid rgba(0, 255, 0, 0.3);
    box-shadow: 0 2px 10px rgba(0, 255, 0, 0.2);
}

/* Landing State */
.landing-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    text-align: center;
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes text-flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.98; }
}

.input-section {
    margin: 40px 0;
    text-align: left;
}

.terminal-label {
    display: block;
    font-size: 24px;
    margin-bottom: 10px;
    color: #00FF00;
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
    letter-spacing: 2px;
    text-align: left;
}

.input-wrapper {
    position: relative;
    display: inline-block;
}

.terminal-input {
    background: transparent;
    border: 2px solid #00FF00;
    color: #00FF00;
    font-family: 'VT323', monospace;
    font-size: 28px;
    padding: 10px 15px;
    width: 400px;
    max-width: 90vw;
    outline: none;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.terminal-input:focus {
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.6);
    border-color: #33FF33;
}

.terminal-input::placeholder {
    color: #00FF00;
    opacity: 0.4;
    text-transform: none;
    letter-spacing: 1px;
}

/* Mobile Search Button */
.search-button-mobile {
    display: none;
    width: 100%;
    max-width: 90vw;
    margin-top: 20px;
    font-size: 24px;
    padding: 15px 30px;
    text-align: center;
}

.search-button-mobile:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    border-color: #006600;
    color: #006600;
    box-shadow: 0 0 5px rgba(0, 102, 0, 0.2);
}

.search-button-mobile:disabled:hover {
    background: transparent;
    box-shadow: 0 0 5px rgba(0, 102, 0, 0.2);
    border-color: #006600;
    color: #006600;
}

.search-button-mobile:not(:disabled):hover {
    background: rgba(0, 255, 0, 0.15);
    box-shadow: 0 0 25px rgba(0, 255, 0, 0.7);
    border-color: #33FF33;
    color: #33FF33;
}

.search-button-mobile:not(:disabled):active {
    transform: scale(0.98);
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.5);
}

.cursor-blink {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #00FF00;
    font-size: 28px;
    animation: blink 0.5s infinite;
    pointer-events: none;
}

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

.system-time {
    position: fixed;
    top: 20px;
    right: 20px;
    font-size: 18px;
    color: #33FF33;
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
    z-index: 101;
}

/* Loading State */
.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    text-align: center;
}

.loading-content {
    width: 100%;
    max-width: 600px;
}

.loading-message {
    font-size: 24px;
    margin-bottom: 20px;
    color: #00FF00;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
    animation: typewriter 0.1s steps(20);
}

.loading-status {
    font-size: 18px;
    margin-top: 15px;
    color: #33FF33;
    min-height: 25px;
}

.progress-bar {
    width: 100%;
    height: 30px;
    border: 2px solid #00FF00;
    background: #000000;
    position: relative;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #00FF00;
    width: 0%;
    transition: width 0.3s ease;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.8);
    animation: progress-glow 1s ease-in-out infinite;
}

@keyframes progress-glow {
    0%, 100% { box-shadow: 0 0 20px rgba(0, 255, 0, 0.8); }
    50% { box-shadow: 0 0 30px rgba(0, 255, 0, 1); }
}

/* Leaderboard State */
.leaderboard-state {
    animation: fade-in 0.5s ease-in;
    padding-top: 100px;
}

.header-section {
    margin-bottom: 30px;
}

.ascii-title {
    text-align: center;
}

.ascii-title pre {
    font-family: 'VT323', monospace;
    color: #00FF00;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
    margin: 0;
    white-space: pre;
    overflow-x: auto;
}

.map-title-text {
    font-size: 32px;
    color: #00FF00;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
    margin-bottom: 20px;
    text-align: left;
    letter-spacing: 2px;
}

/* Profile Card */
.profile-card {
    border: 2px solid #00FF00;
    padding: 20px;
    margin: 20px 0;
    background: rgba(0, 255, 0, 0.05);
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.3);
    animation: card-appear 0.5s ease-in;
}

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

.profile-card-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid #00FF00;
    padding-bottom: 15px;
}

.profile-header-info {
    flex: 1;
}

.profile-picture-large {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 3px solid #00FF00;
    object-fit: cover;
    filter: brightness(1.2) contrast(1.1) sepia(1) hue-rotate(90deg) saturate(2);
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.5);
}

.profile-name-large {
    font-size: 32px;
    color: #33FF33;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.8);
    letter-spacing: 3px;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.profile-quote-section {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-top: 10px;
}

.profile-quote {
    font-size: 20px;
    color: #00FF00;
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
    font-style: italic;
    letter-spacing: 1px;
    opacity: 0.9;
    flex: 1;
}

.profile-map-button {
    flex-shrink: 0;
    background: #33FF33 !important;
    color: #000000 !important;
    border: 2px solid #33FF33 !important;
    font-size: 24px;
    padding: 15px 30px;
    box-shadow: 0 0 25px rgba(51, 255, 51, 0.8);
}

.profile-map-button:hover {
    background: #00FF00 !important;
    color: #000000 !important;
    border-color: #00FF00 !important;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.7);
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.stat-item {
    border: 1px solid #00FF00;
    padding: 15px;
    background: rgba(0, 255, 0, 0.02);
}

.stat-label {
    font-size: 16px;
    color: #33FF33;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 28px;
    color: #00FF00;
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
}

.profile-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    justify-content: center;
}

/* Leaderboard Table */
.leaderboard-table {
    border: 2px solid #00FF00;
    margin: 20px 0;
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.3);
    width: 100%;
    overflow-x: auto;
}

.table-header {
    display: grid;
    grid-template-columns: 60px 100px 1fr 150px 120px 120px;
    background: rgba(0, 255, 0, 0.1);
    border-bottom: 2px solid #00FF00;
    padding: 15px;
    font-size: 18px;
    font-weight: bold;
    color: #33FF33;
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
}

.table-body {
    background: rgba(0, 0, 0, 0.5);
}

.table-row {
    display: grid;
    grid-template-columns: 60px 100px 1fr 150px 120px 120px;
    padding: 15px;
    border-bottom: 1px solid rgba(0, 255, 0, 0.2);
    transition: all 0.3s ease;
    animation: row-appear 0.3s ease-in;
}

@keyframes row-appear {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.table-row:hover {
    background: rgba(0, 255, 0, 0.05);
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.2);
}

.table-row.clickable {
    cursor: pointer;
}

.table-row.clickable:hover {
    background: rgba(0, 255, 0, 0.1);
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.4);
    border-color: rgba(0, 255, 0, 0.5);
}

.table-row.clickable:active {
    transform: scale(0.98);
}

.table-row.highlighted {
    background: rgba(51, 255, 51, 0.15);
    border: 2px solid #33FF33;
    box-shadow: 0 0 20px rgba(51, 255, 51, 0.5);
    animation: highlight-pulse 2s ease-in-out infinite;
    cursor: default;
}

@keyframes highlight-pulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(51, 255, 51, 0.5);
    }
    50% {
        box-shadow: 0 0 30px rgba(51, 255, 51, 0.8);
    }
}

.col-rank {
    font-size: 24px;
    font-weight: bold;
    color: #00FF00;
    text-align: center;
    min-width: 0;
}

.col-picture {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

.profile-picture {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 2px solid #00FF00;
    object-fit: cover;
    filter: brightness(1.2) contrast(1.1) sepia(1) hue-rotate(90deg) saturate(2);
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
}

.col-name {
    font-size: 20px;
    color: #00FF00;
    display: flex;
    align-items: center;
    padding-left: 10px;
    min-width: 0;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 1px;
    gap: 10px;
}

.col-miles,
.col-flights,
.col-time {
    font-size: 18px;
    color: #33FF33;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

/* Disqualification Badge */
.disqualification-badge {
    font-size: 14px;
    color: #FF3333;
    text-shadow: 0 0 10px rgba(255, 51, 51, 0.8);
    letter-spacing: 1px;
    font-weight: bold;
    margin-left: 10px;
}

/* Disqualified styling - subtle colors */
.table-row.disqualified .col-name,
.table-row.disqualified .col-miles,
.table-row.disqualified .col-flights,
.table-row.disqualified .col-time,
.table-row.disqualified .col-rank {
    color: #33AA33;
    opacity: 0.6;
}

.table-row.disqualified:hover {
    background: rgba(0, 255, 0, 0.02);
}

.profile-card.disqualified .profile-name-large,
.profile-card.disqualified .profile-quote {
    color: #33AA33;
    opacity: 0.7;
}

.profile-card.disqualified .stat-label,
.profile-card.disqualified .stat-value {
    color: #33AA33;
    opacity: 0.6;
}

.profile-card.disqualified .stat-item {
    border-color: #33AA33;
    opacity: 0.6;
}

/* Buttons */
.terminal-button {
    background: transparent;
    border: 2px solid #00FF00;
    color: #00FF00;
    font-family: 'VT323', monospace;
    font-size: 20px;
    padding: 10px 20px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.terminal-button:hover {
    background: rgba(0, 255, 0, 0.1);
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.6);
    border-color: #33FF33;
    color: #33FF33;
}

.terminal-button:active {
    transform: scale(0.98);
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.4);
}

.controls {
    text-align: center;
    margin: 30px 0;
}

/* Help State */
.help-state {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
}

.help-content {
    max-width: 700px;
    width: 100%;
}

.help-content pre {
    font-size: 16px;
    color: #00FF00;
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
    line-height: 1.6;
    margin-bottom: 20px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .container {
        padding: 20px 10px;
    }
    
    .page-header {
        font-size: 20px;
        top: 10px;
        left: 10px;
        letter-spacing: 2px;
    }
    
    .terminal-input {
        width: 90vw;
        font-size: 20px;
    }
    
    .search-button-mobile {
        display: block;
    }
    
    .leaderboard-table {
        overflow-x: visible;
        width: 100%;
    }
    
    .table-header,
    .table-row {
        grid-template-columns: 40px 60px minmax(100px, 1fr) 80px 70px 70px;
        font-size: 14px;
        padding: 10px 5px;
        min-width: 0;
    }
    
    .col-rank {
        font-size: 16px;
    }
    
    .col-name {
        font-size: 16px;
        padding-left: 5px;
        min-width: 0;
        overflow: visible;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .disqualification-badge {
        margin-left: 0;
        margin-top: 2px;
        font-size: 12px;
    }
    
    .col-miles,
    .col-flights,
    .col-time {
        font-size: 14px;
        text-align: center;
    }
    
    .profile-picture {
        width: 40px;
        height: 40px;
    }
    
    .profile-stats {
        grid-template-columns: 1fr;
    }
    
    .profile-actions {
        flex-direction: column;
    }
    
    .profile-quote-section {
        flex-direction: column;
        gap: 15px;
    }
    
    .profile-map-button {
        align-self: flex-start;
        font-size: 20px;
        padding: 12px 24px;
    }
    
    .system-time {
        font-size: 14px;
        top: 60px;
        left: 30px;
        right: auto;
    }
    
    /* Hide ASCII box on mobile and show just the text */
    .ascii-title pre {
        display: none;
    }
    
    .ascii-title::before {
        content: "FLIGHT STATISTICS LEADERBOARD 2025";
        display: block;
        font-family: 'VT323', monospace;
        font-size: 24px;
        color: #00FF00;
        text-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
        text-align: left;
        letter-spacing: 2px;
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {
    .table-header,
    .table-row {
        grid-template-columns: 40px 60px 1fr 90px;
        font-size: 12px;
    }
    
    .col-flights,
    .col-time {
        display: none;
    }
    
    .table-header .col-flights,
    .table-header .col-time {
        display: none;
    }
    
    .col-miles {
        font-size: 12px;
        text-align: center;
    }
    
    .system-time {
        font-size: 12px;
        top: 55px;
        left: 30px;
    }
}

/* Character reveal animation */
.char-reveal {
    animation: char-reveal 0.05s steps(1);
}

@keyframes char-reveal {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Flicker effect for authenticity */
.flicker {
    animation: flicker 0.15s infinite;
}

@keyframes flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.95; }
}

/* Error Modal */
.error-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fade-in 0.3s ease-in;
}

.error-modal {
    background: #000000;
    border: 3px solid #00FF00;
    box-shadow: 0 0 30px rgba(0, 255, 0, 0.6), inset 0 0 20px rgba(0, 255, 0, 0.1);
    padding: 40px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    animation: modal-appear 0.4s ease-out;
}

@keyframes modal-appear {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.error-modal-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.error-icon {
    font-size: 16px;
    color: #00FF00;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.8);
    line-height: 1.2;
    margin-bottom: 10px;
}

.error-icon pre {
    margin: 0;
    font-family: 'VT323', monospace;
    color: #00FF00;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.8);
}

.error-title {
    font-size: 32px;
    color: #FF3333;
    text-shadow: 0 0 15px rgba(255, 51, 51, 0.8);
    letter-spacing: 3px;
    font-weight: bold;
    animation: text-flicker 0.1s infinite;
}

.error-message {
    font-size: 20px;
    color: #00FF00;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
    letter-spacing: 2px;
    line-height: 1.5;
    margin: 10px 0;
}

.error-modal .terminal-button {
    margin-top: 10px;
}

/* Warning Modal */
.warning-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fade-in 0.3s ease-in;
}

.warning-modal {
    background: #000000;
    border: 3px solid #FFAA00;
    box-shadow: 0 0 30px rgba(255, 170, 0, 0.6), inset 0 0 20px rgba(255, 170, 0, 0.1);
    padding: 40px;
    max-width: 600px;
    width: 90%;
    text-align: center;
    animation: modal-appear 0.4s ease-out;
}

.warning-modal-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.warning-icon {
    font-size: 20px;
    color: #FFAA00;
    text-shadow: 0 0 10px rgba(255, 170, 0, 0.8);
    line-height: 1.2;
    margin-bottom: 10px;
}

.warning-icon pre {
    margin: 0;
    font-family: 'VT323', monospace;
    color: #FFAA00;
    text-shadow: 0 0 10px rgba(255, 170, 0, 0.8);
}

.warning-title {
    font-size: 32px;
    color: #FFAA00;
    text-shadow: 0 0 15px rgba(255, 170, 0, 0.8);
    letter-spacing: 3px;
    font-weight: bold;
    animation: text-flicker 0.1s infinite;
}

.warning-message {
    font-size: 20px;
    color: #00FF00;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
    letter-spacing: 2px;
    line-height: 1.6;
    margin: 10px 0;
}

.warning-modal-button {
    margin-top: 10px;
    font-size: 24px;
    padding: 15px 40px;
    background: transparent !important;
    color: #FFAA00 !important;
    border: 2px solid #FFAA00 !important;
    box-shadow: 0 0 20px rgba(255, 170, 0, 0.8);
    text-shadow: 0 0 10px rgba(255, 170, 0, 0.8);
}

.warning-modal-button:hover {
    background: rgba(255, 170, 0, 0.1) !important;
    color: #FFCC00 !important;
    border-color: #FFCC00 !important;
    box-shadow: 0 0 25px rgba(255, 204, 0, 0.9);
    text-shadow: 0 0 15px rgba(255, 204, 0, 0.9);
}

/* ============================================
   MAP PAGE STYLES
   ============================================ */

/* Map Container */
.map-container {
    padding-top: 100px;
}

/* Map Header */
.map-header {
    margin-bottom: 30px;
    position: relative;
}

.map-title-section {
    margin-bottom: 20px;
}

.map-subheader {
    font-size: 20px;
    color: #33FF33;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
    letter-spacing: 2px;
    margin-top: 10px;
}

.map-controls-top {
    margin-bottom: 20px;
}

/* Map Loading State */
.map-loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
}

.map-loading-state .loading-message {
    font-size: 24px;
    margin-bottom: 20px;
    color: #00FF00;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
    animation: typewriter 0.1s steps(20);
}

.map-loading-state .loading-status {
    font-size: 18px;
    color: #33FF33;
    min-height: 25px;
}

/* Map Section */
.map-section {
    animation: fade-in 0.5s ease-in;
    position: relative;
}

.flight-map {
    width: 100%;
    height: 600px;
    border: 2px solid #00FF00;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.3);
    background: #000000;
    margin: 20px 0;
    position: relative;
    z-index: 1;
}

/* Override Leaflet default styles for terminal aesthetic */
.flight-map .leaflet-container {
    background: #000000 !important;
    font-family: 'VT323', monospace !important;
    height: 100% !important;
    width: 100% !important;
}

/* Style Leaflet tiles to have green terminal aesthetic */
.flight-map .leaflet-tile-container img {
    filter: grayscale(100%) brightness(0.2) sepia(100%) hue-rotate(50deg) saturate(300%);
    opacity: 0.6;
}

/* Ensure tiles are visible */
.flight-map .leaflet-tile {
    visibility: visible !important;
}

/* Style map pane */
.flight-map .leaflet-pane {
    z-index: auto;
}

/* Ensure map tiles load and are visible */
.flight-map .leaflet-tile-container {
    opacity: 1;
}

/* Style flight route lines */
.flight-route-line {
    fill: none;
    cursor: pointer !important;
    pointer-events: all !important;
}

.flight-route-hover {
    stroke: transparent;
    stroke-width: 2px; /* Exact same width as visible line for precise clicking */
    fill: none;
    cursor: pointer !important;
    pointer-events: all !important;
}

/* Selected route styling with glow effect */
.selected-route {
    filter: drop-shadow(0 0 8px #00FF00);
    animation: pulse-route 2s ease-in-out infinite;
}

/* Hovered route styling with strong glow effect */
.hovered-route path {
    stroke: #66FF66 !important;
    stroke-width: 8px !important;
    opacity: 1 !important;
}

.hovered-route {
    filter: drop-shadow(0 0 20px #66FF66) drop-shadow(0 0 30px #66FF66) drop-shadow(0 0 40px #33FF33) !important;
}

@keyframes pulse-route {
    0%, 100% {
        filter: drop-shadow(0 0 8px #00FF00);
        opacity: 1;
    }
    50% {
        filter: drop-shadow(0 0 12px #00FF00);
        opacity: 1;
    }
}

.leaflet-interactive {
    cursor: pointer !important;
}

/* Airport Labels */
.airport-label {
    pointer-events: auto !important;
}

.airport-code-label {
    font-family: 'VT323', monospace;
    font-size: 14px;
    color: #00FF00;
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.8);
    background: rgba(0, 0, 0, 0.8);
    padding: 2px 6px;
    border: 1px solid #00FF00;
    cursor: pointer;
    pointer-events: auto;
    white-space: nowrap;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    display: inline-block;
}

.airport-code-label:hover {
    background: rgba(0, 255, 0, 0.2);
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.6);
    transform: scale(1.1);
    color: #33FF33;
}

/* Map Legend */
.map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding: 15px;
    border: 2px solid #00FF00;
    background: rgba(0, 255, 0, 0.05);
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
    margin: 20px 0;
    justify-content: center;
    align-items: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    color: #00FF00;
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
}

.legend-dot {
    color: #00FF00;
    font-size: 16px;
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.8);
}

.legend-line {
    color: #00FF00;
    font-size: 16px;
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.8);
}

.legend-hover {
    color: #33FF33;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(51, 255, 51, 0.8);
}

.legend-label {
    letter-spacing: 1px;
}

.legend-progress {
    color: #33FF33;
    font-weight: bold;
    letter-spacing: 2px;
}

/* Miles Counter */
.map-miles-counter {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 24px;
    color: #33FF33;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.8);
    letter-spacing: 2px;
    padding: 10px 15px;
    z-index: 1000;
    text-align: left;
    animation: counter-update 0.3s ease;
}

/* Routes Counter */
.map-routes-counter {
    position: absolute;
    top: 64px;
    left: 20px;
    font-size: 18px;
    color: #33FF33;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.8);
    letter-spacing: 2px;
    padding: 0 15px;
    z-index: 1000;
    text-align: left;
}

@keyframes counter-update {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 25px rgba(0, 255, 0, 0.6);
    }
    100% {
        transform: scale(1);
    }
}

/* Flight Modal - Right Side Panel */
.flight-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent; /* No overlay, map stays visible */
    display: flex;
    align-items: stretch;
    justify-content: flex-end;
    z-index: 3000;
    pointer-events: none; /* Allow clicks to pass through overlay */
}

.flight-modal-overlay > * {
    pointer-events: all; /* But modal itself is clickable */
}

.flight-modal {
    background: #000000;
    border-left: 3px solid #00FF00;
    border-top: 3px solid #00FF00;
    border-bottom: 3px solid #00FF00;
    border-right: none;
    box-shadow: -5px 0 30px rgba(0, 255, 0, 0.6), inset 0 0 20px rgba(0, 255, 0, 0.1);
    padding: 0;
    width: 450px;
    max-width: 40vw;
    height: 100vh;
    position: fixed;
    top: 0;
    right: 0;
    transform: translateX(100%); /* Start off-screen to the right */
    transition: transform 0.3s ease-out;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Panel slides in from right when open */
.flight-modal.modal-panel-open {
    transform: translateX(0); /* Slide into view */
}

/* Fallback for class on overlay instead */
.flight-modal-overlay.modal-panel-open .flight-modal {
    transform: translateX(0);
}

.flight-modal-content {
    padding: 20px;
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Plane Marker Animation */
.plane-marker {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.plane-marker div {
    transition: transform 0.1s ease-out;
    filter: drop-shadow(0 0 8px rgba(0, 255, 0, 0.8));
}

.flight-modal-header {
    margin-bottom: 20px;
    position: relative;
    padding-right: 45px; /* Make room for close button */
}

.flight-modal-title {
    font-size: 32px;
    color: #00FF00;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
    margin: 0;
    font-family: 'VT323', monospace;
    text-align: left;
    letter-spacing: 2px;
}

.flight-modal-body {
    margin: 20px 0;
    flex: 1;
    overflow-y: auto;
}

.flight-detail-row {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 15px;
    margin: 15px 0;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0, 255, 0, 0.2);
}

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

.flight-detail-label {
    font-size: 18px;
    color: #33FF33;
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
    letter-spacing: 1px;
    font-weight: bold;
}

.flight-detail-value {
    font-size: 18px;
    color: #00FF00;
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
    letter-spacing: 1px;
    word-break: break-word;
}

.flight-modal-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(0, 255, 0, 0.2);
}

.flight-modal-hint {
    font-size: 14px;
    color: #33FF33;
    text-align: center;
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
    letter-spacing: 1px;
    opacity: 0.7;
}

/* Modal Close Button */
.flight-modal-header .modal-close {
    position: absolute;
    top: 5px;
    right: 5px;
    color: #00FF00;
    cursor: pointer;
    font-family: 'VT323', monospace;
    font-size: 18px;
    background: none;
    border: none;
    padding: 5px 10px;
    line-height: 1;
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
    transition: all 0.2s ease;
    z-index: 10;
}

.modal-close {
    color: #00FF00;
    cursor: pointer;
    font-family: 'VT323', monospace;
    font-size: 16px;
    background: none;
    border: none;
    padding: 5px 8px;
    line-height: 1;
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
    transition: all 0.2s ease;
}

.modal-close:hover {
    color: #33FF33;
    text-shadow: 0 0 10px rgba(51, 255, 51, 0.8);
    transform: scale(1.1);
}

.modal-close:active {
    transform: scale(0.95);
}

/* Leaflet Custom Styles */
.leaflet-container {
    font-family: 'VT323', monospace !important;
    background: #000000 !important;
}

.leaflet-popup-content-wrapper {
    background: #000000 !important;
    border: 2px solid #00FF00 !important;
    color: #00FF00 !important;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.6) !important;
}

.leaflet-popup-tip {
    background: #000000 !important;
    border: 2px solid #00FF00 !important;
}

.leaflet-popup-close-button {
    color: #00FF00 !important;
    font-size: 24px !important;
}

.leaflet-popup-close-button:hover {
    color: #33FF33 !important;
}

/* Style zoom controls */
.leaflet-control-zoom {
    border: 2px solid #00FF00 !important;
    background: rgba(0, 0, 0, 0.8) !important;
}

.leaflet-control-zoom a {
    background-color: rgba(0, 0, 0, 0.8) !important;
    color: #00FF00 !important;
    border: 1px solid #00FF00 !important;
    font-family: 'VT323', monospace !important;
    font-size: 18px !important;
    line-height: 26px !important;
}

.leaflet-control-zoom a:hover {
    background-color: rgba(0, 255, 0, 0.1) !important;
    color: #33FF33 !important;
}

/* Remove Leaflet attribution control (could be white box) */
.leaflet-control-attribution {
    display: none !important;
    visibility: hidden !important;
}

/* Ensure no white backgrounds anywhere */
.leaflet-container,
.leaflet-pane,
.leaflet-map-pane,
.leaflet-tile-pane,
.leaflet-overlay-pane {
    background: #000000 !important;
}

/* Ensure no default button backgrounds */
button:not(.profile-map-button),
.terminal-button:not(.profile-map-button),
.map-controls-top button {
    background: transparent !important;
    background-color: transparent !important;
}

/* Fix any white boxes from Leaflet default styling */
.leaflet-control-container * {
    background-color: transparent !important;
}

.leaflet-bar {
    background: rgba(0, 0, 0, 0.8) !important;
    border: 2px solid #00FF00 !important;
}

.leaflet-bar a {
    background-color: rgba(0, 0, 0, 0.8) !important;
    color: #00FF00 !important;
    border-bottom: 1px solid #00FF00 !important;
}

/* Responsive Design for Map Page */
@media (max-width: 768px) {
    .flight-map {
        height: 400px;
    }
    
    .map-legend {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .legend-item {
        font-size: 16px;
    }
    
    .map-miles-counter {
        font-size: 20px;
        top: 10px;
        left: 10px;
        padding: 8px 12px;
    }
    
    .map-routes-counter {
        font-size: 16px;
        top: 50px;
        left: 10px;
        padding: 0 12px;
    }
    
    .flight-modal {
        width: 100vw;
        max-width: 100vw;
        border-left: 3px solid #00FF00;
        border-top: 3px solid #00FF00;
        border-bottom: 3px solid #00FF00;
        border-right: none;
    }
    
    .flight-modal.modal-panel-open {
        transform: translateX(0);
    }
    
    .flight-detail-row {
        grid-template-columns: 100px 1fr;
        gap: 10px;
        font-size: 16px;
    }
    
    .flight-detail-label,
    .flight-detail-value {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .flight-map {
        height: 300px;
    }
    
    .map-subheader {
        font-size: 16px;
    }
    
    .map-miles-counter {
        font-size: 18px;
        top: 10px;
        left: 10px;
        padding: 8px 12px;
    }
    
    .map-routes-counter {
        font-size: 14px;
        top: 46px;
        left: 10px;
        padding: 0 12px;
    }
    
    .legend-item {
        font-size: 14px;
    }
    
    .flight-detail-row {
        grid-template-columns: 80px 1fr;
        font-size: 14px;
    }
    
    .flight-detail-label,
    .flight-detail-value {
        font-size: 14px;
    }
}

