/* ==========================================================
   Conan Radar – Layout & Styling (FINAL FIXED VERSION)
   ========================================================== */

.radar-body {
    margin: 0;
    background: #05070b;
    color: #f5f5f5;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Layout unterhalb der Navbar (Home | Join | Mods | Radar) */
#radarLayout {
    display: flex;
    height: calc(100vh - 80px);  /* 80px = deine Navbar-Höhe */
    overflow: hidden;
    margin-top: 0;
}

/* ========================= SIDEBAR ========================= */

#sidebar {
    width: 260px;
    background: #0e1119;
    border-right: 1px solid #232636;
    padding: 14px 14px 10px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    position: relative;
    z-index: 2;
}

/* Sidebar header */
.sidebar-header h1 {
    margin: 0;
    font-size: 16px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.sidebar-sub {
    font-size: 12px;
    opacity: 0.8;
    margin-top: 4px;
}

/* Mobile toggle button */
.sidebar-toggle {
    display: none;
    margin-top: 10px;
    width: 100%;
    border-radius: 999px;
    border: 1px solid #2f354a;
    background: #171b26;
    color: #f5f5f5;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
}

/* Sidebar content */
#sidebarContent {
    margin-top: 12px;
}

.sidebar-section {
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #232636;
}

.sidebar-section:last-child {
    border-bottom: none;
}

.sidebar-section h2 {
    margin: 0 0 8px 0;
    font-size: 14px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #f0d8a2;
}

.section-help {
    margin: 6px 0 0 0;
    font-size: 11px;
    opacity: 0.75;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* ========== Buttons ========== */

.btn {
    border-radius: 999px;
    border: 1px solid #2f354a;
    background: #171b26;
    color: #f5f5f5;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.07s;
}

.btn:hover {
    background: #222633;
}

.btn:active {
    transform: translateY(1px);
}

.btn-chip {
    background: #151827;
}

.btn-chip.active {
    background: #f6a623;
    border-color: #f6a623;
    color: #111318;
}

.btn-chip-secondary {
    border-color: #37405a;
    background: #11131b;
}

.btn-primary {
    background: linear-gradient(90deg, #f6a623, #ffd479);
    border-color: #f6a623;
    color: #111318;
    font-weight: 600;
    box-shadow: 0 0 16px rgba(246, 166, 35, 0.35);
}

.btn-primary:hover {
    background: linear-gradient(90deg, #ffcf7a, #ffe6b5);
}

.w-full { width: 100%; }

/* ========================= MAIN ========================= */

#main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#topbar {
    background: #0e1119;
    border-bottom: 1px solid #232636;
    padding: 8px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.topbar-title { font-weight: 600; }
.topbar-stats { opacity: 0.8; }

/* ===== Map container ===== */

#mapContainer {
    position: relative;
    flex: 1;
    overflow: hidden;
    background: #05070b;
}

#rasterView {
    pointer-events: none;
    position: absolute;
    inset: 0;
    z-index: 1;
}

/* === Canvas ABSOLUT positioniert === */
#map {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    z-index: 1;
}

/* Raster oben drüber, blockiert aber nichts */
#rasterView {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
}

/* Popup darüber */
#popup {
    z-index: 10;
}

/* BaseInfo darüber */
.base-info {
    z-index: 12;
}


/* Popup */
#popup {
    position: absolute;
    background: rgba(15, 18, 29, 0.96);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    pointer-events: none;
    /* WICHTIG: keine transform, JS setzt left/top direkt */
    border: 1px solid #4a5370;
    box-shadow: 0 0 12px rgba(0,0,0,0.6);
    min-width: 120px;
    z-index: 5;
}

/* Base info card */
.base-info {
    position: absolute;
    right: 14px;
    bottom: 14px;
    width: 260px;
    background: rgba(6, 8, 14, 0.98);
    border-radius: 10px;
    padding: 10px 12px;
    border: 1px solid #2f354a;
    box-shadow: 0 0 12px rgba(0,0,0,0.7);
    font-size: 12px;
    max-height: 70%;
    overflow-y: auto;
    z-index: 8;
}

.detail-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 4px;
}

.detail-row .label {
    font-weight: 600;
    font-size: 11px;
    opacity: 0.9;
}

.detail-row .value {
    font-size: 12px;
}

.tp {
    font-family: monospace;
    font-size: 11px;
    cursor: pointer;
    padding: 3px 5px;
    border-radius: 4px;
    background: #11131b;
    border: 1px solid #303550;
    word-break: break-all;
}

.tp:hover {
    background: #1a1f33;
}

.hidden { display: none !important; }

/* ========================= PIECES SLIDER ========================= */

.pieces-filter { display: flex; flex-direction: column; gap: 6px; }

.range-slider {
    position: relative;
    height: 26px;
}

.range-slider input[type="range"] {
    position: absolute;
    left: 0; right: 0; top: 7px;
    width: 100%;
    background: none;
    -webkit-appearance: none;
    pointer-events: none;
}

.range-slider input::-webkit-slider-runnable-track {
    height: 4px; background: #2a3145; border-radius: 999px;
}

.range-slider input::-moz-range-track {
    height: 4px; background: #2a3145; border-radius: 999px;
}

.range-slider input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px; height: 14px; border-radius: 50%;
    background: #f6a623;
    border: 1px solid #111318;
    pointer-events: auto;
}

.range-slider input::-moz-range-thumb {
    width: 14px; height: 14px; border-radius: 50%;
    background: #f6a623;
    border: 1px solid #111318;
    pointer-events: auto;
}

.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    opacity: 0.85;
}

/* ========================= SELECTS ========================= */

.select {
    width: 100%;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid #2f354a;
    background: #11131b;
    color: #f5f5f5;
    font-size: 12px;
    margin-bottom: 6px;
}

.select:focus {
    outline: none;
    border-color: #f6a623;
}

/* ========================= HELP ========================= */

.help-list {
    list-style: disc;
    margin: 0 0 0 16px;
    padding: 0;
    font-size: 11px;
    opacity: 0.82;
}

.help-list li { margin-bottom: 3px; }

/* Toast */
.toast {
    position: fixed;
    bottom: 26px;
    left: 50%;
    transform: translateX(-50%);
    background: #11131b;
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 13px;
    border: 1px solid #3b4260;
    opacity: 0;
    transition: opacity .3s;
    z-index: 20;
}

/* ========================= RESPONSIVE ========================= */

@media (max-width: 900px) {
    #radarLayout {
        flex-direction: column;
        height: calc(100vh - 80px);
    }

    #sidebar {
        width: 100%;
        max-height: 40vh;
        border-right: none;
        border-bottom: 1px solid #232636;
        overflow-y: visible;
    }

    #main {
        flex: 1;
    }
}

@media (max-width: 768px) {
    #sidebar {
        width: 100%;
        max-height: none;
        border-right: none;
    }

    .sidebar-toggle {
        display: block;
    }

    #sidebarContent {
        display: none;
    }

    #sidebarContent.open {
        display: block;
    }

    .base-info {
        right: 10px;
        left: 10px;
        top: 10px;
        bottom: auto;
        width: auto;
    }

    #popup {
        font-size: 11px;
        max-width: 200px;
    }
}
