/**
 * /assets/css/world-maps.css
 *
 * Purpose:  Styles for world maps, region maps, location markers,
 *           region headers, and interactive map viewer
 * Deps:     app.css (variables), world-common.css
 * Load:     index.php
 * Version:  1.0.0
 */

/* ============================================================
   1) REGION SECTION (in Locations tab)
   ============================================================ */
.world-region-section {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    overflow: hidden;
}

.world-region-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(255,255,255,0.04);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    border-left: 3px solid var(--region-color, #28a745);
}

.world-region-header-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--region-color, #28a745);
}

.world-region-header-info {
    flex: 1;
    min-width: 0;
}

.world-region-header-name {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
    line-height: 1.3;
}

.world-region-header-desc {
    font-size: 0.75rem;
    color: var(--bs-secondary-color);
    line-height: 1.3;
}

.world-region-level-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    white-space: nowrap;
}

.world-region-section .race-cards-grid {
    padding: 16px;
}


/* ============================================================
   2) MAP CONTAINER (Interactive Map Viewer)
   ============================================================ */
.world-map-container {
    position: relative;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    cursor: default;
}

.world-map-container[data-can-manage="1"] {
    cursor: crosshair;
}

.world-map-image {
    width: 100%;
    height: auto;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
}

.world-map-markers {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}


/* ============================================================
   3) MAP MARKERS
   ============================================================ */
.world-map-marker {
    position: absolute;
    transform: translate(-50%, -100%);
    pointer-events: auto;
    cursor: pointer;
    transition: transform 0.15s ease;
    z-index: 2;
}

.world-map-marker:hover {
    transform: translate(-50%, -100%) scale(1.2);
    z-index: 10;
}

.world-map-marker__pin {
    width: 28px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.world-map-marker__pin::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 24px;
    border-radius: 50% 50% 50% 0;
    transform: translateX(-50%) rotate(-45deg);
    background: var(--marker-color, #17a2b8);
    border: 2px solid rgba(255,255,255,0.6);
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.world-map-marker__pin i {
    position: relative;
    z-index: 1;
    font-size: 0.6rem;
    color: #fff;
    margin-top: -8px;
}

.world-map-marker__label {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-size: 0.65rem;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0,0,0,0.8), 0 0 2px rgba(0,0,0,0.6);
    padding: 2px 6px;
    margin-top: 2px;
    pointer-events: none;
}

/* Discoverable marker (ghost appearance) */
.world-map-marker--discoverable {
    opacity: 0.5;
}

.world-map-marker--discoverable .world-map-marker__pin::before {
    border-style: dashed;
    background: rgba(255,255,255,0.15);
}

/* Marker tooltip on hover */
.world-map-marker__tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.9);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    padding: 8px 12px;
    min-width: 140px;
    max-width: 220px;
    z-index: 20;
    pointer-events: none;
}

.world-map-marker:hover .world-map-marker__tooltip {
    display: block;
}

.world-map-marker__tooltip-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 2px;
}

.world-map-marker__tooltip-type {
    font-size: 0.65rem;
    color: var(--bs-secondary-color);
}

.world-map-marker__tooltip-danger {
    font-size: 0.65rem;
    margin-top: 2px;
}


/* ============================================================
   4) MAP PLACEMENT INDICATOR
   ============================================================ */
.world-map-placement {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: rgba(93,214,201,0.5);
    transform: translate(-50%, -50%);
    pointer-events: none;
    animation: map-pulse 1.5s ease infinite;
    z-index: 15;
}

@keyframes map-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(93,214,201,0.4); }
    50% { box-shadow: 0 0 0 10px rgba(93,214,201,0); }
}


/* ============================================================
   5) RESPONSIVE
   ============================================================ */
@media (max-width: 576px) {
    .world-region-header {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 12px;
    }

    .world-region-header-icon {
        width: 30px;
        height: 30px;
        font-size: 0.85rem;
    }

    .world-region-header-name {
        font-size: 0.9rem;
    }

    .world-region-section .race-cards-grid {
        padding: 10px;
    }

    .world-map-marker__label {
        font-size: 0.55rem;
    }

    .world-map-marker__pin {
        width: 22px;
        height: 28px;
    }

    .world-map-marker__pin::before {
        width: 18px;
        height: 18px;
    }

    .world-map-marker__pin i {
        font-size: 0.5rem;
    }
}

/* ================================================================
   NPC MARKERS
   ================================================================ */
.world-map-marker--npc .world-map-marker__pin,
.world-map-marker__pin--small {
    width: 18px;
    height: 22px;
}

.world-map-marker--npc .world-map-marker__pin::before {
    width: 14px;
    height: 14px;
}

.world-map-marker--npc .world-map-marker__pin i {
    font-size: 0.45rem;
}

.world-map-marker--npc .world-map-marker__label {
    font-size: 0.5rem;
    max-width: 60px;
}

/* ================================================================
   QUEST MARKERS
   ================================================================ */
.world-map-marker--quest .world-map-marker__pin {
    width: 18px;
    height: 22px;
    animation: wmap-quest-pulse 2s ease-in-out infinite;
}

.world-map-marker--quest .world-map-marker__pin::before {
    width: 14px;
    height: 14px;
}

.world-map-marker--quest .world-map-marker__pin i {
    font-size: 0.5rem;
}

.world-map-marker--quest .world-map-marker__label {
    font-size: 0.5rem;
    max-width: 60px;
    color: #ffd36b;
}

@keyframes wmap-quest-pulse {
    0%, 100% { box-shadow: 0 0 4px rgba(255,211,107,0.3); }
    50%      { box-shadow: 0 0 12px rgba(255,211,107,0.6); }
}

/* ================================================================
   REGION ZOOM MARKERS
   ================================================================ */
.world-map-marker--region {
    cursor: pointer;
    pointer-events: auto;
}

.world-map-marker__pin--region {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--marker-color, #28a745);
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    transform: none;
    font-size: 0.7rem;
    color: var(--marker-color, #28a745);
    transition: transform 0.2s, box-shadow 0.2s;
}

.world-map-marker--region:hover .world-map-marker__pin--region {
    transform: scale(1.2);
    box-shadow: 0 0 12px var(--marker-color, #28a745);
}

/* ================================================================
   REGION FLASH (scroll-to highlight)
   ================================================================ */
.cmap-region-flash {
    animation: region-flash-glow 1.5s ease-out;
}

@keyframes region-flash-glow {
    0%   { box-shadow: 0 0 0 0 rgba(93,214,201,0.4); }
    30%  { box-shadow: 0 0 20px 4px rgba(93,214,201,0.3); }
    100% { box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
    .world-map-marker {
        transition: none;
    }
    .world-map-placement {
        animation: none;
    }
    .world-map-marker--quest .world-map-marker__pin {
        animation: none;
    }
    .cmap-region-flash {
        animation: none;
    }
}
