/**
 * Introl 3D Globe Styles
 * Coverage area globe widget with fullscreen overlay
 */

/* =============================================================================
   Hero Section - 50/50 Split Layout
   ============================================================================= */

.coverage-hero {
    padding: 6rem 0 4rem;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

.coverage-hero::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at 70% 30%, rgba(0, 242, 0, 0.06) 0%, transparent 50%);
    pointer-events: none;
}

.coverage-hero-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6rem;
    align-items: center;
    position: relative;
    z-index: 1;
}

.coverage-hero-text {
    max-width: 600px;
}

.coverage-hero-text .section-label {
    margin-bottom: 1rem;
}

.coverage-hero-text .display-huge {
    margin-bottom: 1.5rem;
}

.coverage-hero-text p {
    font-size: 1.125rem;
    color: var(--text-gray);
    line-height: 1.7;
    margin-bottom: 2rem;
}

.coverage-hero-globe {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* =============================================================================
   Globe Preview Container
   ============================================================================= */

.globe-preview {
    width: 100%;
    max-width: 500px;
    aspect-ratio: 1;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.globe-preview:hover {
    border-color: var(--border-color-strong);
    box-shadow: 0 0 40px rgba(0, 242, 0, 0.1);
}

.globe-preview canvas {
    border-radius: var(--radius);
}

/* Expand hint */
.globe-expand-hint {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 10;
}

.globe-preview:hover .globe-expand-hint {
    opacity: 1;
}

/* =============================================================================
   Fullscreen Overlay
   ============================================================================= */

.globe-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    z-index: 10001;
    display: flex;
    transition: opacity 0.3s, visibility 0.3s;
    pointer-events: none;
}

.globe-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Body class when fullscreen is active */
body.globe-fullscreen-active {
    overflow: hidden;
}

/* Move globe container in fullscreen */
body.globe-fullscreen-active #globe-container {
    position: fixed;
    top: 0;
    left: 320px; /* Account for filter panel width */
    width: calc(100vw - 320px);
    height: 100vh;
    max-width: none;
    z-index: 10000;
    border: none;
    border-radius: 0;
    background: var(--bg-primary);
    /* Override preview constraints that conflict with fullscreen dimensions */
    aspect-ratio: auto;
    overflow: visible;
}

/* =============================================================================
   Close Button
   ============================================================================= */

.globe-close-btn {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    width: 48px;
    height: 48px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-white);
    font-size: 1.25rem;
    cursor: pointer;
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    pointer-events: auto;
}

.globe-close-btn:hover {
    background: rgba(0, 242, 0, 0.2);
    border-color: var(--text-primary);
    color: var(--text-primary);
}

/* =============================================================================
   Filter Panel
   ============================================================================= */

.globe-filter-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 320px;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem;
    overflow-y: auto;
    z-index: 10002;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    pointer-events: auto;
}

.globe-filter-panel h2 {
    font-size: 1rem;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 0;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

/* Search Box */
.globe-search-box {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-white);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    transition: var(--transition);
}

.globe-search-box::placeholder {
    color: var(--text-dim);
}

.globe-search-box:focus {
    outline: none;
    border-color: var(--text-primary);
    box-shadow: 0 0 0 2px rgba(0, 242, 0, 0.1);
}

/* Filter Groups */
.globe-filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.globe-filter-label {
    font-size: 0.75rem;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.globe-filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Filter Buttons */
.globe-filter-btn {
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-white);
    font-family: var(--font-sans);
    font-size: 0.6875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.globe-filter-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.globe-filter-btn.active {
    background: var(--text-primary);
    color: var(--bg-primary);
    border-color: var(--text-primary);
    font-weight: 700;
}

/* Stats Footer */
.globe-filter-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.globe-filter-stats span {
    font-size: 0.75rem;
    color: var(--text-gray);
}

.globe-filter-stats .globe-visible-count {
    color: var(--text-primary);
    font-weight: 700;
}

/* Clear Filters Button */
.globe-clear-btn {
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-white);
    font-family: var(--font-sans);
    font-size: 0.6875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-transform: uppercase;
}

.globe-clear-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

/* =============================================================================
   Location Popup
   ============================================================================= */

.globe-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    min-width: 280px;
    z-index: 10003;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.globe-popup h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin: 0 0 1rem;
}

.globe-popup p {
    font-size: 0.875rem;
    color: var(--text-gray);
    margin: 0.5rem 0;
}

.globe-popup p strong {
    color: var(--text-white);
}

.globe-popup-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 28px;
    height: 28px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-gray);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.globe-popup-close:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
}

/* =============================================================================
   Responsive Styles
   ============================================================================= */

@media (max-width: 1024px) {
    .coverage-hero-grid {
        gap: 4rem;
    }

    .globe-preview {
        max-width: 400px;
    }
}

@media (max-width: 768px) {
    .coverage-hero {
        padding: 4rem 0 3rem;
    }

    .coverage-hero-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }

    .coverage-hero-text {
        max-width: 100%;
    }

    .coverage-hero-globe {
        width: 100%;
        display: flex;
        justify-content: center;
        padding: 0 1rem;
        box-sizing: border-box;
    }

    .globe-preview {
        width: calc(100vw - 4rem);
        max-width: 320px;
        margin: 0 auto;
        aspect-ratio: 1;
    }

    .globe-preview canvas {
        width: 100% !important;
        height: 100% !important;
    }

    /* Fullscreen filter panel - bottom sheet on mobile */
    .globe-filter-panel {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: auto;
        max-height: 60vh;
        border-right: none;
        border-top: 1px solid var(--border-color);
        border-radius: 16px 16px 0 0;
        padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
    }

    .globe-close-btn {
        top: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
    }

    /* Mobile fullscreen globe - maintain aspect ratio, fill available space */
    body.globe-fullscreen-active #globe-container {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: calc(100vh - 80px);
        height: calc(100dvh - 80px);
        max-width: none;
        z-index: 10000;
        border: none;
        border-radius: 0;
        background: var(--bg-primary);
        aspect-ratio: auto;
        overflow: hidden;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    body.globe-fullscreen-active #globe-container canvas {
        max-width: 100%;
        max-height: 100%;
        width: auto !important;
        height: auto !important;
        object-fit: contain;
    }

    /* Collapsed filter panel - minimal bar at bottom */
    .globe-filter-panel {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 80px;
        max-height: 80px;
        background: #000;
        border-right: none;
        border-top: 1px solid var(--border-color);
        border-radius: 16px 16px 0 0;
        padding: 1rem 1.5rem;
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
        overflow: hidden;
        transition: max-height 0.3s ease, height 0.3s ease;
    }

    /* Expanded state for filter panel */
    .globe-filter-panel.expanded {
        height: auto;
        max-height: 70vh;
        overflow-y: auto;
    }

    /* Hide most content when collapsed */
    .globe-filter-panel:not(.expanded) .globe-filter-group,
    .globe-filter-panel:not(.expanded) .globe-search-box,
    .globe-filter-panel:not(.expanded) .globe-filter-stats {
        display: none;
    }

    /* Add expand handle */
    .globe-filter-panel::before {
        content: "";
        display: block;
        width: 40px;
        height: 4px;
        background: var(--border-color-strong);
        border-radius: 2px;
        margin: 0 auto 0.75rem;
    }
}

@media (max-width: 480px) {
    .coverage-hero {
        padding: 3rem 0 2rem;
    }

    .coverage-hero-globe {
        padding: 0 0.5rem;
    }

    .globe-preview {
        width: calc(100vw - 3rem);
        max-width: 280px;
    }

    .globe-filter-panel {
        padding: 0.75rem 1rem;
        height: 70px;
        max-height: 70px;
    }

    .globe-filter-panel.expanded {
        max-height: 75vh;
    }

    .globe-filter-btn {
        padding: 0.375rem 0.5rem;
        font-size: 0.625rem;
    }
}

/* =============================================================================
   Reduced Motion
   ============================================================================= */

@media (prefers-reduced-motion: reduce) {
    .globe-overlay,
    .globe-preview,
    .globe-filter-btn,
    .globe-close-btn,
    .globe-popup {
        transition: none;
    }
}
