/* Thailand Map - Frontend Styles */

.tmap-container {
    max-width: 500px;
    margin: 0 auto;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    overflow: visible;
}

.tmap-map-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 0.55;
    overflow: visible;
}

/* SVG Map */
.tmap-svg-map {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

/* Pins */
.tmap-pin {
    position: absolute;
    transform: translate(-50%, -50%);
    z-index: 10;
    cursor: pointer;
}

.tmap-pin-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2.5px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.35);
    position: relative;
    z-index: 2;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.tmap-pin:hover,
.tmap-pin.active {
    z-index: 50;
}

.tmap-pin:hover .tmap-pin-dot {
    transform: scale(1.35);
    box-shadow: 0 3px 10px rgba(0,0,0,0.45);
}

/* Pin pulse animation */
.tmap-pin-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid;
    opacity: 0;
    animation: tmap-pulse 2.5s ease-out infinite;
    z-index: 1;
}

@keyframes tmap-pulse {
    0% {
        width: 14px;
        height: 14px;
        opacity: 0.6;
    }
    100% {
        width: 40px;
        height: 40px;
        opacity: 0;
    }
}

/* Pin Labels */
.tmap-pin-label {
    position: absolute;
    white-space: nowrap;
    background: none;
    padding: 0;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    z-index: 5;
    pointer-events: none;
    top: 50%;
    transform: translateY(-50%);
    direction: rtl;
}

.tmap-pin-label[data-side="left"] {
    right: calc(100% + 6px);
}

.tmap-pin-label[data-side="right"] {
    left: calc(100% + 6px);
}

/* Tooltip */
.tmap-tooltip {
    position: absolute;
    bottom: calc(100% + 15px);
    left: 50%;
    transform: translateX(-50%);
    width: 240px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.08);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
    transform: translateX(-50%) translateY(8px);
    z-index: 100;
    overflow: hidden;
    direction: rtl;
    pointer-events: none;
}

.tmap-pin:hover .tmap-tooltip,
.tmap-pin.active .tmap-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

/* Tooltip arrow */
.tmap-tooltip::after {
    content: '';
    position: absolute;
    bottom: -7px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 14px;
    height: 14px;
    background: #fff;
    box-shadow: 3px 3px 6px rgba(0,0,0,0.06);
}

/* Tooltip image */
.tmap-tooltip-image {
    width: 100%;
    height: 120px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.tmap-tooltip-image::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: linear-gradient(transparent, #fff);
}

/* Tooltip content */
.tmap-tooltip-content {
    padding: 12px 16px 16px;
}

.tmap-tooltip-region {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    margin-bottom: 4px;
}

.tmap-tooltip-title {
    margin: 0 0 2px;
    font-size: 18px;
    font-weight: 700;
    color: #222;
    line-height: 1.3;
}

.tmap-tooltip-subtitle {
    font-size: 12px;
    color: #999;
    display: block;
    margin-bottom: 8px;
}

.tmap-tooltip-desc {
    margin: 0 0 10px;
    font-size: 13px;
    line-height: 1.5;
    color: #555;
}

.tmap-tooltip-link {
    display: inline-block;
    font-size: 13px;
    font-weight: 600;
    color: #0073aa;
    text-decoration: none;
    transition: color 0.2s;
}

.tmap-tooltip-link:hover {
    color: #005177;
    text-decoration: underline;
}

/* Legend */
.tmap-legend {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    gap: 12px;
    background: rgba(255,255,255,0.92);
    padding: 8px 14px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    direction: rtl;
}

.tmap-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    color: #555;
}

.tmap-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Tooltip position adjustments for edge pins */
.tmap-pin[style*="left: 2"],
.tmap-pin[style*="left: 1"] {
    /* Left side pins - tooltip shifts right */
}

.tmap-pin .tmap-tooltip {
    /* Smart positioning handled by JS */
}

/* Responsive */
@media (max-width: 600px) {
    .tmap-container {
        max-width: 100%;
        padding: 0 10px;
    }

    .tmap-pin-label {
        font-size: 10px;
    }

    .tmap-tooltip {
        width: 200px;
    }

    .tmap-tooltip-image {
        height: 90px;
    }

    .tmap-tooltip-title {
        font-size: 15px;
    }

    .tmap-pin-dot {
        width: 11px;
        height: 11px;
    }

    .tmap-legend {
        gap: 8px;
        padding: 6px 10px;
        font-size: 10px;
    }
}

@media (max-width: 400px) {
    .tmap-container {
        padding: 0 50px;
    }

    .tmap-pin-label {
        font-size: 9px;
    }

    .tmap-tooltip {
        width: 170px;
    }

    .tmap-tooltip-content {
        padding: 8px 12px 12px;
    }
}
