/**
 * /assets/css/character-map.css
 *
 * Purpose:  Glassmorphism-Styles fuer Charakter-Karte Tab mit Fog-of-War
 * Deps:     app.css (Variablen)
 * Load:     index.php
 * Version:  1.0.0
 */

/* ================================================================
   FILTER BAR
   ================================================================ */
.cmap-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background:
        linear-gradient(135deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01)),
        radial-gradient(circle at top left, rgba(255,255,255,0.04), transparent 70%);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 0.75rem;
}

.cmap-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.3rem 0.6rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: rgba(255,255,255,0.5);
    background: transparent;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.cmap-filter-btn:hover {
    color: rgba(255,255,255,0.8);
    border-color: rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.04);
}

.cmap-filter-btn.active {
    color: var(--filter-color, var(--accent, #5dd6c9));
    border-color: var(--filter-color, var(--accent, #5dd6c9));
    background: rgba(255,255,255,0.06);
    box-shadow: 0 0 8px rgba(93,214,201,0.1);
}

.cmap-filter-count {
    font-size: 0.65rem;
    opacity: 0.7;
    font-weight: 400;
}


/* ================================================================
   CATEGORY HEADER
   ================================================================ */
.cmap-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.cmap-category-header .fw-bold {
    color: var(--text, #e6edf3);
    font-size: 0.95rem;
}


/* ================================================================
   WORLD MAP
   ================================================================ */
.cmap-worldmap-container {
    background:
        linear-gradient(135deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01)),
        radial-gradient(circle at top left, rgba(255,255,255,0.06), transparent 70%);
    backdrop-filter: blur(12px) saturate(1.3);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 0.85rem;
    border-left: 3px solid rgba(93,214,201,0.4);
    padding: 1rem;
    box-shadow: 0 2px 12px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.05);
}

.cmap-worldmap-header {
    display: flex;
    align-items: center;
    font-size: 0.95rem;
    color: var(--text, #e6edf3);
}

.cmap-worldmap-wrap {
    position: relative;
    border-radius: 0.5rem;
    overflow: hidden;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.08);
}

.cmap-worldmap-img {
    width: 100%;
    height: auto;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
}

.cmap-worldmap-markers {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}


/* ================================================================
   MAP MARKERS
   ================================================================ */
.cmap-marker {
    position: absolute;
    transform: translate(-50%, -100%);
    pointer-events: auto;
    cursor: pointer;
    transition: transform 0.15s ease;
    z-index: 2;
}

.cmap-marker:hover {
    transform: translate(-50%, -100%) scale(1.2);
    z-index: 10;
}

.cmap-marker-pin {
    width: 28px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.cmap-marker-pin::before {
    content: '';
    position: absolute;
    top: 0;
    left: 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);
}

.cmap-marker-pin i {
    position: relative;
    z-index: 1;
    font-size: 0.6rem;
    color: #fff;
    margin-top: -8px;
}

.cmap-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;
}

/* Fog marker */
.cmap-marker--fog {
    opacity: 0.4;
    cursor: default;
}

.cmap-marker--fog .cmap-marker-pin::before {
    background: rgba(255,255,255,0.15);
    border-style: dashed;
    border-color: rgba(255,255,255,0.3);
}

.cmap-marker--fog:hover {
    transform: translate(-50%, -100%);
}


/* ================================================================
   REGION SECTIONS
   ================================================================ */
.cmap-region {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    overflow: hidden;
}

.cmap-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);
}

.cmap-region-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);
}

.cmap-region-info {
    flex: 1;
    min-width: 0;
}

.cmap-region-name {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
}

.cmap-region-desc {
    font-size: 0.75rem;
    color: var(--bs-secondary-color);
    line-height: 1.3;
}

/* Region Map */
.cmap-region-map {
    position: relative;
    overflow: hidden;
}

.cmap-region-map-img {
    width: 100%;
    height: auto;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
}


/* ================================================================
   CARDS GRID
   ================================================================ */
.cmap-cards-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.6rem;
    padding: 16px;
}

@media (min-width: 576px) {
    .cmap-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}


/* ================================================================
   ENTITY CARD (Unlocked)
   ================================================================ */
.cmap-card {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    background:
        linear-gradient(135deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01)),
        radial-gradient(circle at top left, rgba(255,255,255,0.06), transparent 70%);
    backdrop-filter: blur(12px) saturate(1.3);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 0.85rem;
    border-left: 3px solid var(--cmap-accent, rgba(93,214,201,0.4));
    box-shadow: 0 2px 12px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.05);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.cmap-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 40%;
    background: linear-gradient(to bottom, rgba(255,255,255,0.03), transparent);
    pointer-events: none;
    border-radius: inherit;
}

.cmap-card--unlocked {
    cursor: pointer;
}

.cmap-card--unlocked:hover {
    border-color: rgba(255,255,255,0.2);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.07),
                0 0 15px rgba(var(--cmap-accent-rgb, 93,214,201), 0.1);
}

/* Card Icon */
.cmap-card-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 0.6rem;
    background: rgba(255,255,255,0.05);
    color: var(--cmap-accent, var(--accent, #5dd6c9));
    font-size: 1.05rem;
}

/* Card Body */
.cmap-card-body {
    flex: 1;
    min-width: 0;
}

.cmap-card-name {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--text, #e6edf3);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 0.2rem;
}

.cmap-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.25rem;
}

.cmap-meta-tag {
    display: inline-flex;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(255,255,255,0.55);
    padding: 0.1rem 0.4rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 0.35rem;
}

.cmap-card-desc {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.45);
    line-height: 1.35;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-bottom: 0.25rem;
}

.cmap-card-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 0.2rem;
}

.cmap-pill {
    display: inline-flex;
    align-items: center;
    font-size: 0.65rem;
    color: rgba(255,255,255,0.5);
    padding: 0.1rem 0.35rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 0.3rem;
}

.cmap-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.cmap-tag {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 600;
    color: rgba(255,255,255,0.45);
    padding: 0.05rem 0.3rem;
    background: rgba(255,255,255,0.04);
    border-radius: 0.25rem;
}

/* Card Action Arrow */
.cmap-card-action {
    flex-shrink: 0;
    align-self: center;
    color: rgba(255,255,255,0.2);
    font-size: 0.7rem;
    transition: color 0.2s ease, transform 0.2s ease;
}

.cmap-card--unlocked:hover .cmap-card-action {
    color: var(--cmap-accent, var(--accent, #5dd6c9));
    transform: translateX(2px);
}


/* ================================================================
   FOG OF WAR CARD
   ================================================================ */
.cmap-card--fog {
    border-left-color: rgba(108,117,125,0.2);
    cursor: default;
    position: relative;
    overflow: hidden;
}

.cmap-card--fog:hover {
    border-color: rgba(255,255,255,0.1);
}

.cmap-card-icon--fog {
    background: rgba(108,117,125,0.1);
    color: rgba(108,117,125,0.4);
}

.cmap-fog-text {
    color: rgba(108,117,125,0.4) !important;
    font-style: italic;
}

/* Animated fog overlay */
.cmap-fog-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    overflow: hidden;
    border-radius: inherit;
}

.cmap-fog-overlay::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(ellipse 30% 40% at 20% 50%, rgba(108,117,125,0.12) 0%, transparent 70%),
        radial-gradient(ellipse 25% 35% at 70% 30%, rgba(108,117,125,0.10) 0%, transparent 70%),
        radial-gradient(ellipse 35% 30% at 50% 70%, rgba(108,117,125,0.08) 0%, transparent 70%);
    animation: cmap-fog-drift 12s ease-in-out infinite alternate;
}

.cmap-fog-overlay::after {
    content: '';
    position: absolute;
    top: -30%;
    left: -30%;
    width: 160%;
    height: 160%;
    background:
        radial-gradient(ellipse 40% 30% at 60% 40%, rgba(108,117,125,0.10) 0%, transparent 70%),
        radial-gradient(ellipse 30% 40% at 30% 60%, rgba(108,117,125,0.08) 0%, transparent 70%);
    animation: cmap-fog-drift2 15s ease-in-out infinite alternate;
}

@keyframes cmap-fog-drift {
    0%   { transform: translate(0, 0) scale(1); }
    50%  { transform: translate(5%, -3%) scale(1.05); }
    100% { transform: translate(-3%, 5%) scale(0.98); }
}

@keyframes cmap-fog-drift2 {
    0%   { transform: translate(0, 0) rotate(0deg); }
    50%  { transform: translate(-4%, 3%) rotate(2deg); }
    100% { transform: translate(3%, -2%) rotate(-1deg); }
}


/* ================================================================
   FOG FULL (Region Map overlay)
   ================================================================ */
.cmap-region-map--fog {
    position: relative;
}

.cmap-fog-full {
    position: relative;
    width: 100%;
    min-height: 120px;
    background: rgba(20,20,30,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.cmap-fog-anim {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(ellipse 40% 50% at 25% 50%, rgba(108,117,125,0.2) 0%, transparent 60%),
        radial-gradient(ellipse 35% 45% at 75% 40%, rgba(108,117,125,0.15) 0%, transparent 60%),
        radial-gradient(ellipse 45% 35% at 50% 70%, rgba(80,80,100,0.12) 0%, transparent 60%);
    animation: cmap-fog-region 18s ease-in-out infinite alternate;
}

@keyframes cmap-fog-region {
    0%   { transform: translate(0, 0) scale(1) rotate(0deg); }
    33%  { transform: translate(3%, -2%) scale(1.03) rotate(1deg); }
    66%  { transform: translate(-2%, 3%) scale(0.97) rotate(-1deg); }
    100% { transform: translate(1%, -1%) scale(1.01) rotate(0.5deg); }
}

.cmap-fog-icon {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255,255,255,0.25);
    text-align: center;
    padding: 2rem;
}

.cmap-fog-icon span {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.03em;
}


/* ================================================================
   DETAIL MODAL
   ================================================================ */
.cmap-modal-header-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.6rem;
    background: rgba(255,255,255,0.08);
    font-size: 1.1rem;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.cmap-modal-section {
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.cmap-modal-section:last-child {
    border-bottom: none;
}

.cmap-modal-section-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255,255,255,0.4);
    margin-bottom: 0.3rem;
}

.cmap-modal-section-value {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.85);
    line-height: 1.5;
}

.cmap-modal-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 0.4rem;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
}

.cmap-modal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.cmap-modal-tag {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(255,255,255,0.6);
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 0.35rem;
}


/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 576px) {
    .cmap-region-header {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 12px;
    }

    .cmap-region-icon {
        width: 30px;
        height: 30px;
        font-size: 0.85rem;
    }

    .cmap-region-name {
        font-size: 0.9rem;
    }

    .cmap-cards-grid {
        padding: 10px;
    }

    .cmap-marker-label {
        font-size: 0.55rem;
    }

    .cmap-marker-pin {
        width: 22px;
        height: 28px;
    }

    .cmap-marker-pin::before {
        width: 18px;
        height: 18px;
    }

    .cmap-marker-pin i {
        font-size: 0.5rem;
    }

    .cmap-worldmap-container {
        padding: 0.75rem;
    }

    .cmap-fog-full {
        min-height: 80px;
    }
}


/* ================================================================
   REDUCED MOTION
   ================================================================ */
/* ================================================================
   CLICKABLE MARKERS
   ================================================================ */
.cmap-marker--clickable {
    cursor: pointer;
    pointer-events: auto;
}

.cmap-marker--clickable:hover .cmap-marker-pin {
    box-shadow: 0 0 12px rgba(255,255,255,0.3);
}

/* NPC Markers (smaller pins) */
.cmap-marker--npc .cmap-marker-pin,
.cmap-marker-pin--small {
    width: 18px;
    height: 18px;
    font-size: 0.5rem;
}

.cmap-marker--npc .cmap-marker-label {
    font-size: 0.5rem;
    max-width: 60px;
}

/* Quest Markers */
.cmap-marker--quest .cmap-marker-pin {
    width: 18px;
    height: 18px;
    font-size: 0.55rem;
    animation: cmap-quest-pulse 2s ease-in-out infinite;
}

.cmap-marker--quest .cmap-marker-label {
    font-size: 0.5rem;
    max-width: 60px;
    color: #ffd36b;
}

@keyframes cmap-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); }
}


@media (prefers-reduced-motion: reduce) {
    .cmap-fog-overlay::before,
    .cmap-fog-overlay::after {
        animation: none;
    }

    .cmap-fog-anim {
        animation: none;
    }

    .cmap-marker {
        transition: none;
    }

    .cmap-card {
        transition: none;
    }

    .cmap-card-action {
        transition: none;
    }

    .cmap-filter-btn {
        transition: none;
    }

    .cmap-marker--quest .cmap-marker-pin {
        animation: none;
    }
}
