/**
 * ═══════════════════════════════════════════════════════════════════════════
 * STANSHARE - EARTH AT NIGHT GLOBE STYLES
 * ═══════════════════════════════════════════════════════════════════════════
 *
 * APPLE LIQUID GLASS + STARLINK THEME
 * Realistic NASA night lights, glass-morphism UI
 *
 * CREATED: January 18, 2026
 * ═══════════════════════════════════════════════════════════════════════════
 */

/* ═════════════════ GLOBE SECTION ═════════════════ */
#globe-section {
    position: relative;
    width: 100vw !important;
    min-height: 100vh !important;
    height: 100vh !important;
    background: linear-gradient(180deg, #000000 0%, #0a0e27 50%, #000814 100%);
    overflow: hidden;
    padding: 0 !important;
    margin: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 !important;
}

/* ═════════════════ GLOBE CONTAINER ═════════════════ */
#globe-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 1;
    border-radius: 0 !important;
    overflow: visible;
    cursor: grab;
    margin: 0 !important;
    padding: 0 !important;
}

#globe-container:active {
    cursor: grabbing;
}

#globe-container canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
}

/* ═════════════════ LIQUID GLASS LEGEND ═════════════════ */
#fundFlowLegend,
.fund-flow-legend {
    position: absolute;
    top: 120px;
    right: 20px;
    width: 240px;
    max-height: 400px;
    overflow-y: auto;
    padding: 16px;
    z-index: 10;

    /* Apple Liquid Glass Effect */
    background: rgba(10, 14, 39, 0.25);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);

    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);

    color: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;

    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

#fundFlowLegend:hover,
.fund-flow-legend:hover {
    background: rgba(10, 14, 39, 0.5);
    border-color: rgba(0, 212, 255, 0.2);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* ═════════════════ CITY GUIDE PANEL ═════════════════ */
#cityGuide {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 212, 255, 0.3) rgba(255, 255, 255, 0.1);
}

#cityGuide::-webkit-scrollbar {
    width: 6px;
}

#cityGuide::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

#cityGuide::-webkit-scrollbar-thumb {
    background: rgba(0, 212, 255, 0.3);
    border-radius: 10px;
}

#cityGuide::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 212, 255, 0.5);
}

/* ═════════════════ LOADING STATE ═════════════════ */
#globe-loading,
.globe-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #00d4ff;
    font-size: 18px;
    font-weight: 600;
    z-index: 15;
    padding: 30px;

    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    border: 1px solid rgba(0, 212, 255, 0.2);
    transition: opacity 0.5s ease;
    pointer-events: none;
}

#globe-loading::before {
    content: '🌍';
    display: block;
    font-size: 48px;
    margin-bottom: 16px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

/* Globe Overlay Content */
.globe-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10;
    pointer-events: none;
    max-width: 800px;
    padding: 0 20px;
    opacity: 0;
    display: none;
}

.globe-title {
    font-size: 4rem;
    font-weight: 800;
    color: #ffffff;
    margin: 0 0 20px;
    text-shadow:
        0 0 40px rgba(0, 212, 255, 0.6),
        0 0 80px rgba(0, 212, 255, 0.4),
        0 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: -1px;
    line-height: 1.1;
    /* Smooth text rendering */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.globe-subtitle {
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.8);
    margin: 0 0 40px;
    text-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
}

.globe-stats {
    display: flex;
    justify-content: center;
    gap: 60px;
    flex-wrap: wrap;
}

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

.globe-stat-number {
    font-size: 3rem;
    font-weight: 800;
    color: #00d4ff;
    text-shadow: 0 0 30px rgba(0, 212, 255, 0.6);
    line-height: 1;
    margin-bottom: 10px;
}

.globe-stat-label {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

/* Fund Flow Legend */
.fund-flow-legend {
    position: absolute;
    bottom: 120px;
    left: 40px;
    background: rgba(10, 14, 39, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid rgba(0, 212, 255, 0.2);
    max-width: 300px;
    z-index: 20;
}

.fund-flow-legend h3 {
    margin: 0 0 15px;
    font-size: 1.1rem;
    color: #00d4ff;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.fund-flow-legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
}

.fund-flow-legend-color {
    width: 24px;
    height: 3px;
    margin-right: 12px;
    border-radius: 2px;
    box-shadow: 0 0 8px currentColor;
}

/* Globe Controls */
.globe-controls {
    position: absolute;
    bottom: 40px;
    right: 40px;
    display: flex;
    gap: 15px;
    z-index: 20;
}

.globe-control-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: rgba(10, 14, 39, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 8px;
    color: #00d4ff;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
}

.globe-control-btn:hover {
    background: rgba(0, 212, 255, 0.1);
    border-color: #00d4ff;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
    transform: translateY(-2px);
}

.globe-control-btn .icon {
    font-size: 1.2rem;
}

/* Scroll Indicator */
.scroll-indicator {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 20;
}

.scroll-indicator-text {
    display: block;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 10px;
    font-weight: 500;
}

.scroll-indicator-arrow {
    width: 30px;
    height: 30px;
    margin: 0 auto;
    border-left: 2px solid rgba(0, 212, 255, 0.6);
    border-bottom: 2px solid rgba(0, 212, 255, 0.6);
    transform: rotate(-45deg);
    /* Removed bounce animation */
}

/* Removed globe-bounce keyframes - no longer needed */

/* Responsive Design */
@media (max-width: 1024px) {
    .globe-title {
        font-size: 3rem;
    }

    .globe-subtitle {
        font-size: 1.2rem;
    }

    .globe-stat-number {
        font-size: 2.5rem;
    }

    .globe-stats {
        gap: 40px;
    }

    .fund-flow-legend {
        bottom: 100px;
        left: 20px;
        max-width: 250px;
    }

    .globe-controls {
        bottom: 20px;
        right: 20px;
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    .globe-title {
        font-size: 2.5rem;
    }

    .globe-subtitle {
        font-size: 1rem;
        margin-bottom: 30px;
    }

    .globe-stats {
        gap: 30px;
    }

    .globe-stat-number {
        font-size: 2rem;
    }

    .globe-stat-label {
        font-size: 0.85rem;
    }

    .fund-flow-legend {
        bottom: 80px;
        left: 10px;
        padding: 15px;
        max-width: 200px;
    }

    .fund-flow-legend h3 {
        font-size: 1rem;
    }

    .fund-flow-legend-item {
        font-size: 0.8rem;
    }

    .globe-controls {
        bottom: 10px;
        right: 10px;
    }

    .globe-control-btn {
        padding: 10px 20px;
        font-size: 0.85rem;
    }

    .scroll-indicator {
        bottom: 20px;
    }
}

@media (max-width: 480px) {
    #globe-section {
        min-height: 500px;
    }

    .globe-title {
        font-size: 2rem;
    }

    .globe-subtitle {
        font-size: 0.9rem;
    }

    .globe-stats {
        gap: 20px;
    }

    #cityGuide {
        display: none !important; /* Hidden on mobile by default */
    }

    .globe-stat-number {
        font-size: 1.5rem;
    }

    .globe-stat-label {
        font-size: 0.75rem;
    }

    .fund-flow-legend {
        display: none; /* Hide on very small screens */
    }

    .globe-control-btn span:not(.icon) {
        display: none; /* Icon only on mobile */
    }
}

/* Performance Optimizations */
* {
    /* Enable GPU acceleration for all elements */
    -webkit-backface-visibility: hidden;
    -moz-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-perspective: 1000;
    -moz-perspective: 1000;
    perspective: 1000;
}

/* High-DPI Display Support (Retina) */
@media only screen and (-webkit-min-device-pixel-ratio: 2),
       only screen and (min--moz-device-pixel-ratio: 2),
       only screen and (-o-min-device-pixel-ratio: 2/1),
       only screen and (min-device-pixel-ratio: 2),
       only screen and (min-resolution: 192dpi),
       only screen and (min-resolution: 2dppx) {

    /* Ensure crisp rendering on Retina displays */
    #globe-container canvas {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    #globe-section {
        background: linear-gradient(180deg, #050811 0%, #0f1425 50%, #050811 100%);
    }
}
