/* ==========================================================================
   1. MAIN CONTAINER & WRAPPER LAYOUT
   ========================================================================== */
#chemox-global-wrapper {
    position: relative;
    min-height: 700px;
    background: #020817;
    border-radius: 24px;
    overflow: hidden;
    padding: 40px;
    font-family: 'Poppins', sans-serif;
    box-sizing: border-box;
}

/* Base structural boundary used by ThreeJS projected coordinate vectors */
#globeViz {
    position: relative; 
    width: 100%;
    height: 700px;
    min-height: 700px;
    z-index: 10;
}

/* ==========================================================================
   2. LEFT SIDE PANEL & ELEMENTS
   ========================================================================== */
.chemox-left {
    position: absolute;
    top: 40px;
    left: 40px;
    z-index: 20;
    max-width: 450px;
}

.chemox-tag {
    display: inline-block;
    background: #4D5CA6;
    color: #fff;
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 13px;
    letter-spacing: 1px;
    margin-bottom: 20px;
    text-transform: uppercase;
    font-weight: 500;
}

.chemox-left h2 {
    color: #fff;
    font-size: 42px; 
    line-height: 1.2;
    margin: 0 0 15px;
    font-weight: 700;
}

.chemox-left p {
    color: #cbd5e1;
    font-size: 16px;
    line-height: 1.7;
    margin: 0;
}

/* ==========================================================================
   3. STATISTICS GRID
   ========================================================================== */
.chemox-stats {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 30px;
}

.chemox-stat {
    background: rgba(255, 255, 255, .08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 18px;
    border-radius: 16px;
    min-width: 120px;
    flex: 1;
}

.chemox-stat span {
    display: block;
    color: #4D5CA6 !important;
    font-size: 34px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 5px;
}

.chemox-stat small {
    color: #fff;
    font-size: 14px;
}

/* ==========================================================================
   4. SEARCH BAR COMPONENT
   ========================================================================== */
#chemox-search {
    margin-top: 25px;
    width: 100%;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.95);
    border-radius: 14px;
    font-size: 15px;
    color: #020817;
    outline: none;
    box-sizing: border-box;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

#chemox-search:focus {
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(77, 92, 166, 0.4);
}

/* ==========================================================================
   5. RIGHT DETAIL INFO PANEL
   ========================================================================== */
#chemox-country-panel {
    position: absolute;
    right: 40px;
    top: 40px;
    width: 340px;
    background: #fff;
    border-radius: 20px;
    padding: 25px;
    z-index: 20;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
    box-sizing: border-box;
}

#chemox-country-panel h3 {
    margin: 0 0 10px;
    font-size: 28px;
    color: #020817;
    font-weight: 600;
}

#chemox-country-panel p {
    color: #64748b;
    line-height: 1.7;
    margin: 0 0 15px;
}

#chemox-country-panel a {
    display: inline-block;
    background: #4D5CA6;
    color: #fff;
    text-decoration: none;
    padding: 12px 18px;
    border-radius: 10px;
    font-weight: 500;
    transition: background 0.2s ease;
}

#chemox-country-panel a:hover {
    background: #3b4782;
}

/* ==========================================================================
   6. VIEWPORT-LOCKED COUNTRY BADGE
   ========================================================================== */
/* ==========================================================================
   6. VIEWPORT-LOCKED COUNTRY BADGE
   ========================================================================== */
#chemox-active-country {
    display: none; /* FIX: Guarantees badge is invisible on initial load without a search */
    position: fixed !important; 
    background: #EA7E2E;
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
    z-index: 999999;
    box-shadow: 0 8px 20px rgba(234, 126, 46, .35);
    transition: opacity 0.2s ease;
    
    -webkit-transform: translate(-50%, -140%) translateZ(0); 
    transform: translate(-50%, -140%) translateZ(0); 
    will-change: transform, left, top, opacity;
}

#chemox-active-country:before {
    content: '';
    position: absolute;
    bottom: -5px; 
    left: 50%;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #EA7E2E;
    transform: translateX(-50%);
}

/* Static point labels */
.chemox-country-tag {
    background: #EA7E2E;
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
    transform: translate(-50%, -130%);
    box-shadow: 0 8px 20px rgba(234, 126, 46, .35);
}

/* ==========================================================================
   7. RESPONSIVE LAYOUT BREAKPOINTS
   ========================================================================== */
@media (max-width: 991px) {
    #chemox-global-wrapper {
        padding: 20px;
        min-height: auto;
        display: flex;
        flex-direction: column;
    }

    .chemox-left {
        position: relative;
        left: auto;
        top: auto;
        max-width: 100%;
        margin-bottom: 25px;
        z-index: 20;
    }

    .chemox-left h2 {
        font-size: 32px;
    }

    #globeViz {
        position: relative;
        height: 500px;
        min-height: 500px;
        margin-top: 10px;
        order: 2; 
    }

    #chemox-country-panel {
        position: relative;
        right: auto;
        top: auto;
        width: 100%;
        margin-top: 25px;
        box-shadow: none;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.1);
        order: 3;
    }

    #chemox-country-panel h3, 
    #chemox-country-panel p {
        color: #fff;
    }
}

/* Responsive Overhaul for Mobile Devices (Fixed Pointer Logic) */
@media (max-width: 767px) {
    #globeViz {
        height: 400px;
        min-height: 400px;
    }

    #chemox-active-country {
        font-size: 11px;
        padding: 5px 12px;
        /* Mobile: Lock precisely to the right side of the marker instead of top */
        transform: translate(15px, -50%); 
    }

    #chemox-active-country:before {
        bottom: auto;
        top: 50%;
        left: -5px; 
        border-top: 5px solid transparent;
        border-bottom: 5px solid transparent;
        border-right: 5px solid #EA7E2E; 
        border-left: none; 
        transform: translateY(-50%);
    }

    .chemox-country-tag {
        transform: translate(-50%, 20%);
        font-size: 11px;
        padding: 5px 10px;
    }
}