/* ============================================================
 * RPG Map — Plugin-Stylesheet
 * Autor: Rogue RPG BB
 * ============================================================ */

/* Layout-Wrapper -------------------------------------------- */
.rpgmap-wrapper {
    position: relative;            /* Anker für absolute Detail-Sidebar */
    display: flex;
    width: 100%;
    max-width: 100%;
    height: 85vh;
    min-height: 600px;
    overflow: hidden;              /* clipt die wegtranslate'te Detail-Sidebar */
    box-sizing: border-box;
    background: #0d0f14;
    color: #d8d8d8;
    font-family: 'DM Mono', monospace;
}

.rpgmap-wrapper *, .rpgmap-wrapper *::before, .rpgmap-wrapper *::after {
    box-sizing: border-box;
}

.rpgmap-main {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;                  /* erlaubt Schrumpfen unter intrinsische Breite */
    overflow: hidden;
}

/* Karten-Canvas --------------------------------------------- */
#rpgmap-canvas {
    width: 100%;
    height: 100%;
    background: #0d0f14;
}

.rpgmap-overlay-title {
    position: absolute;
    top: 20px;
    left: 30px;
    z-index: 500;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 42px;
    letter-spacing: 4px;
    color: #f4f4f4;
    text-shadow: 0 0 12px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}

.rpgmap-pin-counter {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 500;
    padding: 6px 14px;
    background: rgba(20, 22, 28, 0.85);
    border: 1px solid #2a2d35;
    font-size: 12px;
    letter-spacing: 1px;
    color: #d8d8d8;
}

/* Sidebars -------------------------------------------------- */
.rpgmap-sidebar {
    background: #14161c;
    border-color: #22252d;
    overflow-y: auto;
    padding: 24px 20px;
}

.rpgmap-sidebar-left {
    width: 240px;
    flex: 0 0 240px;
    border-right: 1px solid #22252d;
}

/* Detail-Sidebar: Overlay rechts über der Karte — NICHT im Flex-Flow */
.rpgmap-sidebar-right {
    position: absolute;
    top: 0;
    right: 0;
    width: 340px;
    max-width: 100%;
    height: 100%;
    border-left: 1px solid #22252d;
    transform: translateX(100%);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    z-index: 500;
    box-shadow: none;
}

.rpgmap-sidebar-right.is-open {
    transform: translateX(0);
    box-shadow: -12px 0 30px rgba(0, 0, 0, 0.55);
}

.rpgmap-sidebar h3,
.rpgmap-sidebar h4 {
    font-family: 'Bebas Neue', sans-serif;
    letter-spacing: 2px;
    color: #f4f4f4;
    margin: 0 0 12px 0;
}

.rpgmap-sidebar h4 {
    font-size: 14px;
    color: #a0a4ad;
    margin-top: 20px;
}

/* Suchfeld -------------------------------------------------- */
.rpgmap-search-wrap { margin: 0 0 18px 0; }
.rpgmap-search {
    width: 100%;
    padding: 8px 10px;
    background: #0d0f14;
    border: 1px solid #2a2d35;
    color: #f4f4f4;
    font-family: 'DM Mono', monospace;
    font-size: 12px;
    box-sizing: border-box;
}
.rpgmap-search::placeholder { color: #6c7079; }
.rpgmap-search:focus { outline: none; border-color: #c8973a; }

/* Filter ---------------------------------------------------- */
.rpgmap-filter-buttons {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rpgmap-filter-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: transparent;
    border: 1px solid #2a2d35;
    border-left: 3px solid var(--rpgmap-pin-color, #c8973a);
    color: #d8d8d8;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s ease;
}

.rpgmap-filter-btn:hover { background: #1c1f26; }
.rpgmap-filter-btn:not(.is-active) { opacity: 0.4; }

.rpgmap-filter-btn-label { flex: 1; }
.rpgmap-filter-btn-count {
    color: #6c7079;
    font-size: 11px;
}
.rpgmap-district-item-count {
    color: #6c7079;
    font-size: 11px;
    margin-left: auto;
}

.rpgmap-district-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 240px;
    overflow-y: auto;
}

.rpgmap-district-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 13px;
    cursor: pointer;
}

/* Legende --------------------------------------------------- */
.rpgmap-legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 13px;
}

.rpgmap-legend-marker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    color: #fff;
    font-size: 11px;
}

/* Detail-Sidebar ------------------------------------------- */
.rpgmap-close {
    position: absolute;
    top: 10px;
    right: 14px;
    background: transparent;
    border: none;
    color: #d8d8d8;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
}
.rpgmap-close:hover { color: #fff; }

.rpgmap-detail-placeholder {
    color: #6c7079;
    font-style: italic;
    margin-top: 60px;
    text-align: center;
}

/* Leaflet-DivIcon-Marker ----------------------------------- */
.rpgmap-marker {
    background: transparent !important;
    border: none !important;
}

.rpgmap-marker-dot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.85);
    color: #fff;
    font-size: 14px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.rpgmap-marker:hover .rpgmap-marker-dot {
    transform: scale(1.15);
}

.rpgmap-marker.is-active .rpgmap-marker-dot {
    transform: scale(1.3);
    box-shadow: 0 0 14px 4px currentColor;
}

/* Detail-Sidebar — Inhalts-Komponenten --------------------- */
.rpgmap-detail-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 26px;
    letter-spacing: 1.5px;
    color: #f4f4f4;
    margin: 0 0 4px 0;
}

.rpgmap-detail-badge {
    display: inline-block;
    padding: 3px 10px;
    margin-bottom: 18px;
    border-radius: 12px;
    color: #fff;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.rpgmap-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid #22252d;
    font-size: 13px;
}

.rpgmap-detail-label {
    color: #a0a4ad;
}

.rpgmap-detail-value {
    color: #f4f4f4;
    font-weight: 600;
}

.rpgmap-detail-description {
    margin: 16px 0;
    color: #c8c8c8;
    font-size: 13px;
    line-height: 1.5;
}

.rpgmap-detail-link {
    display: inline-block;
    margin-top: 12px;
    padding: 8px 14px;
    background: #1c1f26;
    border: 1px solid #2a2d35;
    color: #f4f4f4;
    text-decoration: none;
    font-size: 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: background 0.2s ease;
}
.rpgmap-detail-link:hover {
    background: #2a2d35;
    color: #fff;
}

/* Header-Menue-Link ----------------------------------------- */
.rpgmap-menu-link-wrap {
    display: inline-block;
}
.rpgmap-menu-link {
    text-decoration: none;
}
.rpgmap-menu-link i {
    margin-right: 4px;
}

/* Pin platzieren — Sidebar-Button -------------------------- */
.rpgmap-place-btn {
    display: block;
    width: 100%;
    padding: 10px 14px;
    margin-bottom: 16px;
    background: #1c1f26;
    border: 1px solid #2a2d35;
    color: #f4f4f4;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 14px;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}
.rpgmap-place-btn:hover { background: #2a2d35; }
.rpgmap-place-btn.is-active {
    background: #c8973a;
    border-color: #c8973a;
    color: #14161c;
}

/* Crosshair-Cursor solange wir im Platzieren-Modus sind ---- */
body.rpgmap-placing #rpgmap-canvas,
body.rpgmap-placing .leaflet-container { cursor: crosshair !important; }

/* Modal ------------------------------------------------- */
.rpgmap-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}
.rpgmap-modal-backdrop.is-open { display: flex; }

.rpgmap-modal {
    position: relative;
    width: 420px;
    max-width: 92vw;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
    background: #14161c;
    border: 1px solid #2a2d35;
    color: #d8d8d8;
    font-family: 'DM Mono', monospace;
}

.rpgmap-modal-title {
    margin: 0 0 18px 0;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 22px;
    letter-spacing: 2px;
    color: #f4f4f4;
}

.rpgmap-modal-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: transparent;
    border: none;
    color: #d8d8d8;
    font-size: 26px;
    cursor: pointer;
    line-height: 1;
}
.rpgmap-modal-close:hover { color: #fff; }

.rpgmap-modal-form label {
    display: block;
    margin-bottom: 12px;
    font-size: 12px;
    color: #a0a4ad;
    letter-spacing: 0.5px;
}
.rpgmap-modal-form input[type="text"],
.rpgmap-modal-form input[type="color"],
.rpgmap-modal-form select,
.rpgmap-modal-form textarea {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 6px 8px;
    background: #0d0f14;
    border: 1px solid #2a2d35;
    color: #f4f4f4;
    font-family: inherit;
    font-size: 13px;
    box-sizing: border-box;
}
.rpgmap-modal-form input[type="color"] {
    height: 32px;
    padding: 2px;
}
.rpgmap-modal-form input[readonly] {
    color: #888;
    background: #16181f;
}

.rpgmap-modal-row {
    display: flex;
    gap: 12px;
}
.rpgmap-modal-row > label { flex: 1; }

.rpgmap-modal-repick {
    display: block;
    width: 100%;
    margin: 4px 0 12px;
    padding: 6px 10px;
    background: #1c1f26;
    border: 1px dashed #2a2d35;
    color: #a0a4ad;
    font-family: inherit;
    font-size: 11px;
    letter-spacing: 0.5px;
    cursor: pointer;
}
.rpgmap-modal-repick:hover { background: #2a2d35; color: #f4f4f4; }

.rpgmap-modal-error {
    margin: 8px 0 12px;
    padding: 8px 10px;
    background: #3a1818;
    border-left: 3px solid #c83a3a;
    color: #f4d8d8;
    font-size: 12px;
}

.rpgmap-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}
.rpgmap-modal-actions button {
    padding: 8px 16px;
    background: #1c1f26;
    border: 1px solid #2a2d35;
    color: #f4f4f4;
    font-family: inherit;
    font-size: 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
}
.rpgmap-modal-actions button:hover { background: #2a2d35; }
.rpgmap-modal-save {
    background: #c8973a !important;
    border-color: #c8973a !important;
    color: #14161c !important;
}
.rpgmap-modal-save:hover { background: #d4a64a !important; }
.rpgmap-modal-save:disabled { opacity: 0.5; cursor: wait; }

/* Detail-Sidebar — Owner-Actions --------------------------- */
.rpgmap-detail-owner-actions {
    display: flex;
    gap: 8px;
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid #22252d;
}
.rpgmap-detail-action {
    padding: 6px 12px;
    background: #1c1f26;
    border: 1px solid #2a2d35;
    color: #f4f4f4;
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
}
.rpgmap-detail-action:hover { background: #2a2d35; }
.rpgmap-detail-action-danger {
    border-color: #4a2222;
    color: #f4d8d8;
}
.rpgmap-detail-action-danger:hover {
    background: #3a1818;
    color: #fff;
}

/* Responsive ----------------------------------------------- */

/* Laptop / mittlere Bildschirme — kompaktere Sidebars */
@media (max-width: 1200px) {
    .rpgmap-sidebar-left   { width: 210px; flex-basis: 210px; padding: 18px 14px; }
    .rpgmap-sidebar-right  { width: 320px; }
    .rpgmap-overlay-title  { font-size: 32px; }
}

/* Tablet / schmale Laptops */
@media (max-width: 900px) {
    .rpgmap-wrapper { height: 75vh; min-height: 500px; }
    .rpgmap-sidebar-left  { width: 180px; flex-basis: 180px; padding: 14px 10px; }
    .rpgmap-sidebar-right { width: 100%; max-width: 420px; }
    .rpgmap-sidebar h3, .rpgmap-sidebar h4 { letter-spacing: 1px; }
    .rpgmap-filter-btn { font-size: 11px; padding: 6px 8px; }
}

/* Mobile — linke Sidebar als kollabierbares Drawer ueber dem Karten-Overlay */
@media (max-width: 700px) {
    .rpgmap-wrapper { height: auto; min-height: 0; flex-direction: column; }
    .rpgmap-sidebar-left {
        width: 100%;
        flex: 0 0 auto;
        max-height: 220px;
        overflow-y: auto;
        border-right: none;
        border-bottom: 1px solid #22252d;
    }
    .rpgmap-main { height: 60vh; min-height: 400px; }
    .rpgmap-sidebar-right { width: 100%; max-width: 100%; }
    .rpgmap-modal { width: 100%; }
}