/*
==========================================================================
   1. Core Page Layout & Centering
==========================================================================
*/
body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #000000; 
    margin: 0;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;       /* Centers the header and map horizontally */
    min-height: 100vh;
    box-sizing: border-box;
}

header {
    text-align: center;
    margin-bottom: 32px;
}

header h1 {
    color: #ffffff;
    margin: 0 0 8px 0;
    font-size: 2.5rem;
}

header p {
    color: #c0c0c0;
    margin: 0;
    font-size: 1.1rem;
}

/* Container limits the maximum growth of the map on massive screens */
.app-layout {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
}

/*
==========================================================================
   2. Map Container & SVG Formatting
==========================================================================
*/
.map-container {
    position: relative; /* Crucial for positioning the zoom buttons inside */
    background: #0f172a; /* Dark slate/black background */
    border: 1px solid #334155; /* Darker border to match */
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3); /* Softened shadow for dark mode */
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
}

svg {
    width: 100%;
    height: auto;
    max-height: 75vh; /* Prevents map from overflowing the bottom viewport */
    user-select: none;
    -webkit-user-drag: none;
    cursor: grab; /* Shows the hand icon over the map naturally */
}

/* While the user is actively clicking and dragging, show a closed fist */
svg:active {
    cursor: grabbing;
}

/* Default state for all map countries */
path {
    fill: #cbd5e1; /* Default slate-gray for countries with pending data */
    stroke: #94a3b8;
    stroke-width: 0.5px;
    vector-effect: non-scaling-stroke; 
    transition: fill-opacity 0.2s ease, stroke 0.2s ease, stroke-width 0.2s ease;
}
    
/* Interactive Hover States */
path:hover {
    fill-opacity: 1;              /* Keeps the black background from bleeding through */
    stroke: #334155;           /* A soft, premium light-gray border instead of bright white */
    stroke-width: 0.5px;       /* Just thick enough to highlight the country shape */
    vector-effect: non-scaling-stroke;
    filter: brightness(1.12);  /* Gently lifts the country's color to a lighter, richer shade */
}

/*
==========================================================================
   3. Language Color Legend (Choropleth Classes)
==========================================================================
*/
path.lang-english    { fill: #0041c2 !important; } /* Blue */
path.lang-spanish    { fill: #ffdf00 !important; } /* Yellow */
path.lang-portuguese { fill: #12ad2b !important; } /* Green */
path.lang-chinese    { fill: #ef4444 !important; } /* Vibrant Red */
path.lang-french     { fill: #a855f7 !important; } /* Purple */
path.lang-japanese   { fill: #ffb2d0 !important; } /* Pink */
path.lang-german     { fill: #ffbf00 !important; } /* Orange */

/*
==========================================================================
   4. Floating Tooltip UI & Controls
==========================================================================
*/
#tooltip {
    position: absolute;
    background-color: rgba(15, 23, 42, 0.95); /* Dark slate with slight transparency */
    color: #ffffff;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.4;
    
    /* FIX: Set to none !important to stop the edge-vibration loop */
    pointer-events: none !important; 
    
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    z-index: 9999;
}
 
#tooltip strong {
    color: #f8fafc;
    font-size: 15px;
}

/* Class applied by JavaScript when mouse leaves map geometry */
.hidden {
    display: none !important;
}

/* Control box styling */
.zoom-controls {
    position: absolute;
    top: 20px;
    left: 20px; /* Moved zoom button setup to top left */
    display: flex;
    flex-direction: column;
    gap: 5px;
    z-index: 10;
}

.zoom-controls button {
    width: 36px;
    height: 36px;
    background-color: #1e293b; /* Dark mode button background */
    border: 1px solid #475569; /* Muted border */
    border-radius: 6px;
    font-size: 18px;
    font-weight: bold;
    color: #f8fafc; /* Crisp white icons */
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.zoom-controls button:hover {
    background-color: #334155; /* Slightly lighter slate on hover */
    color: #ffffff;
    border-color: #64748b;
}

.zoom-controls button:active {
    transform: scale(0.95);
}