/**
 * Ukraine Map Section Styles (jVectorMap Integration)
 */

.map-section {
    padding: 100px 0;
    background-color: #ffffff;
    overflow: hidden;
}

.map-section .section-title {
    text-align: center;
    margin-bottom: 60px;
    font-size: 42px;
    font-weight: 800;
    color: #173750;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.map-wrapper {
    position: relative;
    max-width: 1000px;
    margin: 0 auto;
}

#ukraine-map {
    background: transparent !important;
    position: relative;
}

/* Fix jVectorMap SVG sizing */
#ukraine-map .jvectormap-container {
    width: 100% !important;
    height: 100% !important;
    position: relative;
    z-index: 1;
}

#ukraine-map svg {
    width: 100% !important;
    height: 100% !important;
    max-height: 600px;
    filter: drop-shadow(1px 0 0 #002E5D) drop-shadow(-1px 0 0 #002E5D) drop-shadow(0 1px 0 #002E5D) drop-shadow(0 -1px 0 #002E5D) drop-shadow(0 10px 20px rgba(0, 46, 93, 0.15));
}

/* Map markers */
.map-marker-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 5;
}

.map-marker {
    position: absolute;
    width: 52px;
    height: 66px;
    transform: translate(-50%, -100%);
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    pointer-events: auto;
    z-index: 6;
}

.pin {
    position: absolute;
    left: 50%;
    top: 4px;
    width: 26px;
    height: 26px;
    border-radius: 50% 50% 50% 0;
    background: #173750;
    transform: translateX(-50%) rotate(-45deg);
    box-shadow: 0 10px 18px rgba(23, 55, 80, 0.2);
    animation-name: map-bounce;
    animation-fill-mode: both;
    animation-duration: 1s;
}

.pin::after {
    content: "";
    position: absolute;
    width: 12px;
    height: 12px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: #ffffff;
    border-radius: 50%;
}

.map-marker__thumb {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 12px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #ffffff;
    background-origin: content-box;
    padding: 1px;
}

.map-marker__thumb--empty {
    background: #ffffff;
}

.pulse {
    background: rgba(23, 55, 80, 0.2);
    border-radius: 50%;
    height: 14px;
    width: 14px;
    position: absolute;
    left: 50%;
    top: 50%;
    margin: 11px 0 0 -12px;
    transform: rotateX(55deg);
    z-index: -1;
}

.pulse::after {
    content: "";
    border-radius: 50%;
    height: 40px;
    width: 40px;
    position: absolute;
    margin: -13px 0 0 -13px;
    animation: map-pulsate 2.6s ease-out infinite;
    opacity: 0;
    box-shadow: 0 0 1px 1px rgba(23, 55, 80, 0.35);
    animation-delay: 0.8s;
}

.map-marker__info {
    position: absolute;
    left: 50%;
    top: 58px;
    transform: translateX(-50%);
    background: #ffffff;
    border: 1px solid rgba(23, 55, 80, 0.12);
    border-radius: 10px;
    padding: 8px 10px;
    min-width: 160px;
    text-align: center;
    box-shadow: 0 12px 30px rgba(23, 55, 80, 0.18);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    transform: translate(-50%, 6px);
}

.map-marker__info::after {
    content: "";
    position: absolute;
    left: 50%;
    top: -6px;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    background: #ffffff;
    border-left: 1px solid rgba(23, 55, 80, 0.12);
    border-top: 1px solid rgba(23, 55, 80, 0.12);
    transform: translateX(-50%) rotate(45deg);
}

.map-marker__city {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(23, 55, 80, 0.7);
    font-weight: 700;
    margin-bottom: 4px;
}

.map-marker__name {
    font-weight: 700;
    font-size: 14px;
    color: #173750;
    margin-bottom: 4px;
}

.map-marker__services {
    font-size: 12px;
    color: rgba(23, 55, 80, 0.72);
}

.map-marker:hover .pin,
.map-marker:focus-visible .pin {
    background: #0f2b44;
    box-shadow: 0 12px 24px rgba(23, 55, 80, 0.3);
}

.map-marker:hover .map-marker__info,
.map-marker:focus-visible .map-marker__info {
    opacity: 1;
    transform: translate(-50%, 0);
}

.map-marker:focus-visible {
    outline: 2px solid rgba(23, 55, 80, 0.35);
    outline-offset: 4px;
    border-radius: 16px;
}

.map-marker-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.map-marker-modal.is-open {
    display: flex;
}

.map-marker-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(12, 24, 38, 0.55);
}

.map-marker-modal__body {
    position: relative;
    background: #ffffff;
    border-radius: 20px;
    padding: 22px;
    width: min(760px, 94%);
    box-shadow: 0 30px 60px rgba(10, 20, 30, 0.25);
    z-index: 2;
    font-family: 'Open Sans', Arial, sans-serif;
}

.map-marker-modal__nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 14px;
}

.map-marker-modal__nav-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: rgba(23, 55, 80, 0.1);
    color: #173750;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.map-marker-modal__counter {
    min-width: 72px;
    text-align: center;
    font-size: 13px;
    color: rgba(23, 55, 80, 0.8);
    font-weight: 700;
}

.map-marker-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(23, 55, 80, 0.08);
    color: #173750;
    font-size: 18px;
    cursor: pointer;
}

.map-marker-modal__header {
    display: grid;
    grid-template-columns: 35% 65%;
    gap: 18px;
    margin-bottom: 6px;
    align-items: stretch;
    min-height: 210px;
}

.map-marker-modal__header--no-thumb {
    grid-template-columns: 1fr;
    min-height: initial;
}

.map-marker-modal__media {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.map-marker-modal__header--no-thumb .map-marker-modal__media {
    display: none;
}

.map-marker-modal__meta {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.map-marker-modal__thumb {
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    background-origin: content-box;
    padding: 10px;
}

.map-marker-modal__thumb--circle {
    width: clamp(110px, 72%, 180px);
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    background-color: #ffffff;
    border: 2px solid rgba(23, 55, 80, 0.12);
    background-size: contain;
}

.map-marker-modal__city {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(23, 55, 80, 0.6);
    font-weight: 700;
    margin-bottom: 6px;
}

.map-marker-modal__name {
    font-size: 26px;
    line-height: 1.2;
    font-weight: 800;
    color: #173750;
    margin-bottom: 12px;
    font-family: 'Lato', 'Open Sans', Arial, sans-serif;
}

.map-marker-modal__address {
    font-size: 13px;
    color: rgba(23, 55, 80, 0.75);
    margin-bottom: 6px;
}

.map-marker-modal__contact-row {
    font-size: 15px;
    line-height: 1.45;
    color: rgba(23, 55, 80, 0.85);
    margin-bottom: 10px;
}

.map-marker-modal__contact-row a {
    color: #1f5f9a;
    text-decoration: none;
}

.map-marker-modal__contact-row a:hover {
    color: #173750;
}

.map-marker-modal__label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    color: #173750;
}

.map-marker-modal__field-icon {
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
    display: inline-block;
    background-size: 14px 14px;
    background-repeat: no-repeat;
    background-position: center;
}

.map-marker-modal__field-icon--map {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23173750' d='M10.7 2.1a.6.6 0 0 1 .4.1l3 1.2c.2 0 .3.3.3.5v8.8a.6.6 0 0 1-.8.6L10.5 12 5.7 13.9a.6.6 0 0 1-.4 0l-3-1.2a.6.6 0 0 1-.3-.5V3.4a.6.6 0 0 1 .8-.6L5.5 4l4.8-1.9h.4Zm-.8 1.2L6.2 4.8v7.9l3.7-1.5V3.3Zm-5 1.2L3.2 3.8v7.9l1.7.7V4.5Zm6.2 7 2 .8V4.4l-2-.8v7.9Z'/%3E%3C/svg%3E");
}

.map-marker-modal__field-icon--phone {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23173750' d='M11.8 10a12 12 0 0 1-2-.8.8.8 0 0 0-.8.1l-.9.9a10.4 10.4 0 0 1-2.4-2.4l.9-.9a.8.8 0 0 0 .1-.8 12 12 0 0 1-.8-2 .8.8 0 0 0-.7-.5H3.8a.8.8 0 0 0-.8.8 10.2 10.2 0 0 0 8.6 8.6.8.8 0 0 0 .8-.8v-1.4a.8.8 0 0 0-.6-.8Z'/%3E%3C/svg%3E");
}

.map-marker-modal__services {
    font-size: 13px;
    color: rgba(23, 55, 80, 0.75);
    margin-bottom: 12px;
}

.map-marker-modal__description {
    font-size: 14px;
    line-height: 1.5;
    color: rgba(23, 55, 80, 0.85);
}

@media (max-width: 640px) {
    .map-marker-modal__body {
        width: min(96vw, 96vw);
        padding: 16px;
    }

    .map-marker-modal__header {
        grid-template-columns: 1fr;
        min-height: initial;
    }

    .map-marker-modal__media {
        height: 160px;
    }

    .map-marker-modal__name {
        font-size: 22px;
    }
}

/* jVectorMap Tooltip Customization */
.jvectormap-tip {
    background: #173750;
    border: 1px solid #FFBE2E;
    border-radius: 8px;
    color: white;
    font-family: inherit;
    padding: 12px 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    /* Ensure tooltip doesn't show default content when empty */
    min-width: 150px;
}

/* Hide default jvectormap-tip when custom content is used */
.jvectormap-tip:empty {
    display: none !important;
}

/* Custom tooltip content styling */
.map-tooltip {
    /* Ensure the custom tooltip takes full control */
    width: 100%;
}

.map-tooltip .tooltip-title {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 4px;
    color: #FFBE2E;
    /* Prevent any default text from showing through */
    white-space: nowrap;
}

.map-tooltip .tooltip-hint {
    font-size: 12px;
    opacity: 0.8;
    /* Ensure proper text wrapping */
    white-space: normal;
    line-height: 1.4;
}

/* Marker Pulse Animation using CSS */
/* Note: jVectorMap uses SVG for markers, but we can target them if needed */
/* For now, we rely on the markerStyle defined in JS */

/* Responsive */
@media (max-width: 1200px) {
    #ukraine-map {
        height: 450px !important;
    }
}


@media (max-width: 992px) {
    .map-section {
        padding: 80px 0;
    }

    .map-section .section-title {
        font-size: 32px;
        margin-bottom: 40px;
    }

    #ukraine-map {
        height: 400px !important;
    }

    .map-marker {
        width: 48px;
        height: 60px;
    }

    .pin {
        width: 22px;
        height: 22px;
    }

    .map-marker__thumb {
        width: 10px;
        height: 10px;
    }
}

@media (max-width: 768px) {
    .map-section {
        padding: 60px 0;
    }

    .map-section .section-title {
        font-size: 26px;
        margin-bottom: 30px;
    }

    #ukraine-map {
        height: 350px !important;
    }

    .map-marker {
        width: 44px;
        height: 56px;
    }

    .pin {
        width: 20px;
        height: 20px;
    }

    .map-marker__thumb {
        width: 10px;
        height: 10px;
    }
}

@media (max-width: 480px) {
    #ukraine-map {
        height: 250px !important;
    }

    .map-marker {
        width: 38px;
        height: 50px;
    }

    .pin {
        width: 18px;
        height: 18px;
    }

    .map-marker__thumb {
        width: 9px;
        height: 9px;
    }
}

@keyframes map-pulsate {
    0% {
        transform: scale(0.2, 0.2);
        opacity: 0;
    }
    50% {
        opacity: 0.35;
    }
    100% {
        transform: scale(0.9, 0.9);
        opacity: 0;
    }
}

@keyframes map-bounce {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(-2000px) rotate(-45deg);
    }
    60% {
        opacity: 1;
        transform: translateX(-50%) translateY(30px) rotate(-45deg);
    }
    80% {
        transform: translateX(-50%) translateY(-10px) rotate(-45deg);
    }
    100% {
        transform: translateX(-50%) translateY(0) rotate(-45deg);
    }
}
