/* IWM Interactive World Map Style */

.iwm-wrapper {
    position: relative;
    width: 100%;
    margin: 0 auto;
    font-family: 'Inter', 'Outfit', sans-serif;
}

.iwm-map-container {
    width: 100%;
    background: #ffffff;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.05);
    border: 1px solid #f1f5f9;
}

/* Flex Layout 8/2 */
.iwm-layout-flex {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

.iwm-map-section {
    flex: 0 0 80%;
    width: 80%;
    position: relative;
}

.iwm-legend-section {
    flex: 0 0 calc(20% - 40px);
    width: calc(20% - 40px);
    max-height: 600px;
    overflow-y: auto;
    padding-right: 15px;
}

/* Custom Scrollbar for Legend */
.iwm-legend-section::-webkit-scrollbar {
    width: 4px;
}

.iwm-legend-section::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

.iwm-legend-section::-webkit-scrollbar-thumb {
    background: #bea150;
    border-radius: 10px;
}

#iwm-map-wrapper {
    width: 100%;
    position: relative;
}

/* Clip Antarctica — SVG viewBox is 1010x870, we want to show top 660px only */
#iwm-map-wrapper {
    position: relative;
    overflow: hidden;
    /* padding-bottom = (660/1010)*100 = 65.35% to create the clipping frame */
    padding-bottom: 65.35%;
    height: 0;
}

#iwm-map-wrapper>svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    /* SVG at 100% width has natural height = 86.14% of width.
       Container height = 65.35% of width.
       So SVG height relative to container = (86.14/65.35)*100 = 131.82% */
    height: 131.82%;
}

.iwm-map-container svg {
    display: block;
}

/* Country Styles */
.iwm-map-container svg path,
.iwm-map-container svg circle {
    fill: #f1f5f9;
    /* Clean background */
    stroke: #ffffff;
    stroke-width: 0.5;
    transition: all 0.3s ease;
    cursor: pointer;
}

/* Inactive Hover */
.iwm-map-container svg path:not(.is-active):hover,
.iwm-map-container svg circle:not(.is-active):hover {
    fill: #e2e8f0;
}

/* Active Country */
.iwm-map-container svg .is-active {
    fill: #858585;
}

/* Enhanced Active State for visibility */
.iwm-map-container svg .land.is-active {
    stroke: #858585;
    stroke-width: 0.8px;
    paint-order: stroke fill;
}

/* Selected state (on click via legend or map) */
.iwm-map-container svg .land.is-active.is-selected {
    fill: #bea150 !important;
    filter: drop-shadow(0 0 12px rgba(190, 161, 80, 0.4));
    stroke: #a68a3f;
    stroke-width: 1px;
}

/* Small marker special handling */
.iwm-map-container svg .iwm-small-marker {
    display: none;
}

.iwm-map-container svg .iwm-small-marker.is-active {
    display: block;
    fill: #858585;
    stroke: #ffffff;
    stroke-width: 0.5;
}

.iwm-map-container svg .iwm-small-marker.is-active.is-selected {
    fill: #bea150 !important;
    filter: drop-shadow(0 0 8px rgba(190, 161, 80, 0.6));
}

/* Active Hover */
.iwm-map-container svg .is-active:hover {
    fill: #737373;
    filter: drop-shadow(0 0 8px rgba(130, 130, 130, 0.3));
}

.is-hovered {
    fill: #bea150 !important;
    filter: drop-shadow(0 0 8px rgba(190, 161, 80, 0.6)) !important;
}

/* Tooltip Essentials */
.iwm-tooltip {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.iwm-tooltip.show {
    opacity: 1;
    transform: translateY(0);
}

.iwm-tooltip-inner {
    background: #ffffff;
    color: #1e293b;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    width: 280px;
    border: 1px solid #f1f5f9;
}

/* Legend Styling */
.iwm-map-legend {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.iwm-legend-item {
    background: #ffffff;
    border-radius: 50px;
    padding: 8px 10px 8px 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid #f1f5f9;
}

.iwm-legend-item:hover,
.iwm-legend-item.is-selected {
    background: #ffffff;
    box-shadow: 0 8px 20px rgba(190, 161, 80, 0.15);
    border-color: #bea150;
}

.iwm-legend-number {
    background: #1e293b;
    color: #ffffff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
    transition: background 0.3s ease;
}

.iwm-legend-separator {
    width: 12px;
    height: 2px;
    background: #cbd5e1;
    border-radius: 1px;
    flex-shrink: 0;
}

.iwm-legend-name {
    color: #1e293b;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    transition: color 0.3s ease;
}

.iwm-legend-item:hover .iwm-legend-number,
.iwm-legend-item.is-selected .iwm-legend-number {
    background: #bea150;
}

.iwm-legend-item:hover .iwm-legend-name,
.iwm-legend-item.is-selected .iwm-legend-name {
    color: #bea150;
}

.iwm-legend-item:hover .iwm-legend-separator,
.iwm-legend-item.is-selected .iwm-legend-separator {
    background: #bea150;
}

.is-hovered {
    fill: #a68a3f !important;
    filter: drop-shadow(0 0 12px rgba(190, 161, 80, 0.6)) !important;
}

/* Mobile Adjustments */
@media screen and (max-width: 1024px) {
    .iwm-layout-flex {
        flex-direction: column;
        gap: 20px;
    }

    .iwm-map-section,
    .iwm-legend-section {
        width: 100%;
        flex: none;
    }

    .iwm-legend-section {
        max-height: 400px;
        flex-direction: row;
        flex-wrap: wrap;
        display: flex;
        gap: 10px;
    }

    .iwm-map-legend {
        flex-direction: row;
        flex-wrap: wrap;
        width: 100%;
    }
}

@media (max-width: 767px) {
    .iwm-map-legend {
        flex-direction: row;
        flex-wrap: initial;
        width: 100%;
    }
}

/* ===== Modal Popup ===== */
.iwm-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(6px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    padding: 20px;
}

.iwm-modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.iwm-modal {
    background: #ffffff;
    border-radius: 20px;
    width: 100%;
    max-width: 620px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    padding: 40px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.2);
    transform: translateY(30px) scale(0.97);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.iwm-modal-overlay.show .iwm-modal {
    transform: translateY(0) scale(1);
}

.iwm-modal-close {
    position: absolute;
    top: 20px;
    right: 24px;
    background: #f1f5f9;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.iwm-modal-close:hover {
    background: #bea150;
    color: #ffffff;
}

.iwm-modal-header {
    border-bottom: 2px solid #bea150;
    padding-bottom: 16px;
    margin-bottom: 24px;
}

.iwm-modal-title {
    font-size: 26px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 6px 0;
    letter-spacing: -0.02em;
}

.iwm-modal-company {
    font-size: 14px;
    font-weight: 600;
    color: #bea150;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.iwm-modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.iwm-modal-row {
    display: flex;
    gap: 16px;
}

.iwm-modal-label {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    min-width: 130px;
    padding-top: 2px;
}

.iwm-modal-value {
    font-size: 14px;
    color: #334155;
    line-height: 1.6;
}

.iwm-modal-value a {
    color: #bea150;
    text-decoration: none;
    font-weight: 600;
}

.iwm-modal-value a:hover {
    text-decoration: underline;
}

.iwm-modal-socials {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: -4px;
}

.iwm-modal-socials a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f1f5f9;
    color: #64748b;
    font-size: 14px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.iwm-modal-socials a:hover {
    background: #bea150;
    color: #ffffff;
    text-decoration: none;
}

/* Modal Skeleton */
.iwm-modal-skeleton .iwm-skeleton-title,
.iwm-modal-skeleton .iwm-skeleton-text {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: iwm-skeleton 1.5s infinite;
    border-radius: 6px;
    margin-bottom: 14px;
}

.iwm-modal-skeleton .iwm-skeleton-title {
    height: 28px;
    width: 60%;
}

.iwm-modal-skeleton .iwm-skeleton-text {
    height: 14px;
    width: 100%;
}

.iwm-modal-skeleton .iwm-skeleton-text.short {
    width: 70%;
}

@keyframes iwm-skeleton {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}