/* ==========================================================
   SOLO VALLEI - PETA STYLE
   File: /assets/css/peta.css
   Fungsi:
   - Styling halaman /peta-indikatif.php
   - Dashboard peta publik Solo Vallei
   - Sidebar kiri, peta utama Leaflet, panel detail kanan
   - Panel detail default tertutup
   ========================================================== */

:root {
    --sv-map-navy: #061827;
    --sv-map-navy-2: #0B2236;
    --sv-map-primary: #0B3D5C;
    --sv-map-accent: #D6A045;
    --sv-map-green: #1F7A4D;
    --sv-map-muted: #64748B;
    --sv-map-border: #E2E8F0;
    --sv-map-bg: #F8FAFC;
    --sv-map-soft: #EEF3F7;
    --sv-map-stage-bg: #E5E7EB;
}

/* ==========================================================
   BASE
   ========================================================== */

body.peta-dashboard-page {
    background: var(--sv-map-bg);
}

.text-sv-primary {
    color: var(--sv-map-primary) !important;
}

.btn-sv-primary {
    background: var(--sv-map-primary);
    border-color: var(--sv-map-primary);
    color: #fff;
    font-weight: 700;
}

.btn-sv-primary:hover,
.btn-sv-primary:focus {
    background: #08324c;
    border-color: #08324c;
    color: #fff;
}

.sv-map-app {
    min-height: calc(100vh - 80px);
    background: var(--sv-map-soft);
    color: #0f172a;
}

/* ==========================================================
   MAIN LAYOUT
   ========================================================== */

.sv-map-shell {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr) 390px;
    min-height: calc(100vh - 80px);
    background: var(--sv-map-soft);
}

/* Kondisi awal / detail tertutup */
.sv-map-shell.detail-closed,
body.sv-detail-closed .sv-map-shell {
    grid-template-columns: 320px minmax(0, 1fr) !important;
}

.sv-left-panel,
.sv-detail-panel {
    background: rgba(255, 255, 255, .96);
    border-color: var(--sv-map-border);
    overflow-y: auto;
    max-height: calc(100vh - 80px);
}

.sv-left-panel {
    border-right: 1px solid var(--sv-map-border);
    display: flex;
    flex-direction: column;
    z-index: 5;
}

.sv-left-content {
    padding: 18px;
    flex: 1;
}

.sv-left-footer {
    background: var(--sv-map-navy);
    color: rgba(255, 255, 255, .85);
    padding: 16px 18px;
    font-size: .82rem;
}

/* ==========================================================
   MAP STAGE
   ========================================================== */

.sv-map-stage {
    position: relative;
    min-height: calc(100vh - 80px);
    background: var(--sv-map-stage-bg);
    overflow: hidden;
}

#mapSoloVallei {
    width: 100%;
    height: calc(100vh - 80px);
    min-height: 664px;
    background: #dbeafe;
    z-index: 1;
}

/* Leaflet correction */
.leaflet-container {
    font-family: inherit;
}

.leaflet-control-attribution {
    font-size: 10px;
}

/* ==========================================================
   MAP FLOATING ELEMENTS
   ========================================================== */

.sv-map-note {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 601;
    max-width: 320px;
    background: rgba(255, 255, 255, .94);
    border: 1px solid rgba(226, 232, 240, .95);
    border-radius: 14px;
    padding: 10px 14px;
    box-shadow: 0 10px 26px rgba(15, 23, 42, .16);
    font-size: .78rem;
    color: #475569;
}

.sv-map-search-float {
    position: absolute;
    top: 18px;
    left: 18px;
    z-index: 600;
    width: min(430px, calc(100% - 36px));
}

.sv-map-search-float .input-group {
    box-shadow: 0 12px 34px rgba(15, 23, 42, .22);
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
}

.sv-map-search-float input {
    font-size: .92rem;
}

.sv-map-toolbar {
    position: absolute;
    top: 92px;
    left: 18px;
    z-index: 600;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sv-map-toolbtn {
    width: 42px;
    height: 42px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, .12);
    color: #0f172a;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .18);
    cursor: pointer;
    transition: background .15s ease, color .15s ease, transform .15s ease;
}

.sv-map-toolbtn:hover,
.sv-map-toolbtn:focus {
    background: #f8fafc;
    color: var(--sv-map-primary);
    transform: translateY(-1px);
}

.sv-mini-map {
    position: absolute;
    left: 18px;
    bottom: 94px;
    z-index: 600;
    width: 230px;
    height: 150px;
    background: rgba(255, 255, 255, .9);
    border-radius: 14px;
    border: 1px solid rgba(15, 23, 42, .16);
    box-shadow: 0 12px 34px rgba(15, 23, 42, .22);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sv-mini-map-inner {
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 25% 45%, rgba(14, 165, 233, .35), transparent 20%),
        radial-gradient(circle at 70% 50%, rgba(34, 197, 94, .35), transparent 24%),
        linear-gradient(135deg, #e2e8f0, #f8fafc);
    position: relative;
}

.sv-mini-map-inner::after {
    content: "";
    position: absolute;
    left: 86px;
    top: 54px;
    width: 42px;
    height: 42px;
    border: 2px solid #ef4444;
    background: rgba(239, 68, 68, .08);
}

.sv-scale-box {
    position: absolute;
    bottom: 94px;
    left: 270px;
    z-index: 600;
    color: #fff;
    background: rgba(15, 23, 42, .7);
    padding: 8px 14px;
    border-radius: 10px;
    font-size: .82rem;
}

/* ==========================================================
   BOTTOM ACTION CARDS
   ========================================================== */

.sv-bottom-actions {
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 18px;
    z-index: 600;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
}

.sv-action-card {
    background: rgba(255, 255, 255, .94);
    border: 1px solid rgba(226, 232, 240, .9);
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 26px rgba(15, 23, 42, .16);
    text-decoration: none;
    color: #0f172a;
    min-height: 72px;
    transition: transform .15s ease, color .15s ease, box-shadow .15s ease;
}

.sv-action-card:hover,
.sv-action-card:focus {
    color: var(--sv-map-primary);
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(15, 23, 42, .2);
    text-decoration: none;
}

.sv-action-card i {
    color: var(--sv-map-primary);
    font-size: 1.35rem;
}

.sv-action-card .small {
    line-height: 1.2;
}

/* ==========================================================
   LEFT PANEL - LAYER, BASEMAP, LEGEND
   ========================================================== */

.sv-layer-row {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 0;
    border-bottom: 1px solid #eef2f7;
    cursor: pointer;
}

.sv-layer-row:last-child {
    border-bottom: 0;
}

.sv-layer-icon {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.sv-layer-title {
    font-weight: 700;
    font-size: .9rem;
    line-height: 1.1;
}

.sv-layer-desc {
    font-size: .74rem;
    color: var(--sv-map-muted);
    line-height: 1.1;
    margin-top: 2px;
}

.sv-basemap-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.sv-basemap-card {
    border: 2px solid transparent;
    background: #fff;
    padding: 4px;
    border-radius: 10px;
    text-align: center;
    font-size: .72rem;
    color: #334155;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}

.sv-basemap-card:hover,
.sv-basemap-card:focus {
    background: #f8fafc;
}

.sv-basemap-card.active {
    border-color: #22c55e;
}

.sv-basemap-thumb {
    height: 48px;
    border-radius: 7px;
    margin-bottom: 5px;
    background: linear-gradient(135deg, #e2e8f0, #fff);
}

.sv-thumb-osm {
    background:
        linear-gradient(90deg, rgba(37, 99, 235, .35) 1px, transparent 1px),
        linear-gradient(rgba(37, 99, 235, .20) 1px, transparent 1px),
        #f8fafc;
    background-size: 16px 16px;
}

.sv-thumb-sat {
    background:
        radial-gradient(circle at 30% 30%, #84cc16, transparent 18%),
        radial-gradient(circle at 70% 60%, #166534, transparent 25%),
        linear-gradient(135deg, #14532d, #64748b);
}

.sv-thumb-drone {
    background:
        radial-gradient(circle at 20% 20%, #86efac, transparent 22%),
        radial-gradient(circle at 70% 55%, #22c55e, transparent 20%),
        linear-gradient(135deg, #bbf7d0, #f8fafc);
}

.sv-legend-line {
    display: inline-block;
    width: 34px;
    height: 0;
    border-top: 3px solid #2563eb;
    margin-right: 8px;
    vertical-align: middle;
}

.sv-legend-dash {
    border-top-style: dashed;
    border-top-color: #f97316;
}

.sv-legend-dot {
    display: inline-block;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
    background: #22c55e;
}

/* ==========================================================
   DETAIL PANEL
   ========================================================== */

.sv-detail-panel {
    border-left: 1px solid var(--sv-map-border);
    position: relative;
    z-index: 10;
    background: rgba(255, 255, 255, .96);
}

/* Default closed / forced closed */
.sv-detail-panel[hidden],
.sv-detail-panel.is-closed,
body.sv-detail-closed .sv-detail-panel {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    overflow: hidden !important;
    border-left: 0 !important;
    padding: 0 !important;
}

/* Open state */
.sv-detail-panel.active:not(.is-closed) {
    display: block;
    visibility: visible;
    width: auto;
    min-width: 0;
    max-width: none;
    overflow-y: auto;
    border-left: 1px solid var(--sv-map-border);
}

.sv-detail-header {
    padding: 18px 18px 14px;
    border-bottom: 1px solid var(--sv-map-border);
}

.sv-detail-title {
    color: #15803d;
    font-weight: 800;
    font-size: 1.35rem;
    margin: 0;
    padding-right: 34px;
}

.sv-detail-close {
    position: absolute;
    top: 18px;
    right: 16px;
    border: 0;
    background: transparent;
    font-size: 1.25rem;
    color: #334155;
    cursor: pointer;
    z-index: 9999 !important;
    pointer-events: auto !important;
}

.sv-detail-close:hover,
.sv-detail-close:focus {
    color: #dc2626;
}

.sv-detail-tabs {
    display: flex;
    border-bottom: 1px solid var(--sv-map-border);
    padding: 0 14px;
    gap: 6px;
    overflow-x: auto;
}

.sv-detail-tab {
    border: 0;
    background: transparent;
    padding: 12px 8px;
    font-size: .78rem;
    font-weight: 800;
    color: #64748b;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    white-space: nowrap;
}

.sv-detail-tab.active {
    color: #15803d;
    border-bottom-color: #22c55e;
}

.sv-detail-body {
    padding: 16px 18px 24px;
}

.sv-info-row {
    display: grid;
    grid-template-columns: 24px 110px 1fr;
    gap: 8px;
    padding: 10px 0;
    border-bottom: 1px solid #eef2f7;
    align-items: start;
    font-size: .86rem;
}

.sv-info-row i {
    color: #64748b;
}

.sv-info-label {
    color: #64748b;
    font-weight: 700;
}

.sv-tag {
    display: inline-flex;
    padding: 4px 8px;
    border-radius: 999px;
    background: #ffedd5;
    color: #c2410c;
    font-size: .72rem;
    font-weight: 800;
}

.sv-cross-svg {
    width: 100%;
    height: auto;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}

.sv-photo-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.sv-photo-grid img {
    width: 100%;
    height: 70px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

/* ==========================================================
   MAP MARKERS
   ========================================================== */

.sv-marker-pin {
    border: 2px solid #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .30);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 12px;
}

.sv-marker-label {
    background: rgba(15, 23, 42, .78);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .24);
    padding: 3px 7px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 11px;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .24);
    line-height: 1.15;
    text-align: center;
}

/* ==========================================================
   RESPONSIVE - TABLET
   ========================================================== */

@media (max-width: 1199.98px) {
    .sv-map-shell {
        grid-template-columns: 300px minmax(0, 1fr);
    }

    .sv-map-shell.detail-closed,
    body.sv-detail-closed .sv-map-shell {
        grid-template-columns: 300px minmax(0, 1fr) !important;
    }

    .sv-detail-panel {
        position: fixed;
        right: 12px;
        top: 82px;
        width: min(390px, calc(100vw - 24px));
        max-height: calc(100vh - 100px);
        z-index: 1100;
        border: 1px solid var(--sv-map-border);
        border-radius: 16px;
        box-shadow: 0 18px 50px rgba(15, 23, 42, .25);
        display: none;
    }

    .sv-detail-panel.active:not(.is-closed) {
        display: block;
        visibility: visible;
        width: min(390px, calc(100vw - 24px));
        max-width: calc(100vw - 24px);
        overflow-y: auto;
        border: 1px solid var(--sv-map-border);
    }

    .sv-bottom-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sv-map-note {
        display: none;
    }
}

/* ==========================================================
   RESPONSIVE - MOBILE
   ========================================================== */

@media (max-width: 767.98px) {
    .sv-map-app {
        min-height: auto;
    }

    .sv-map-shell,
    .sv-map-shell.detail-closed,
    body.sv-detail-closed .sv-map-shell {
        grid-template-columns: 1fr !important;
        min-height: auto;
    }

    .sv-left-panel {
        max-height: none;
        border-right: 0;
        border-bottom: 1px solid var(--sv-map-border);
    }

    .sv-map-stage {
        min-height: 720px;
    }

    #mapSoloVallei {
        height: 720px;
        min-height: 720px;
    }

    .sv-map-search-float,
    .sv-map-toolbar,
    .sv-mini-map,
    .sv-scale-box {
        display: none;
    }

    .sv-bottom-actions {
        position: static;
        padding: 12px;
        background: #0f172a;
        grid-template-columns: 1fr;
    }

    .sv-detail-panel {
        top: 12px;
        right: 12px;
        left: 12px;
        width: auto;
        max-width: none;
        max-height: calc(100vh - 24px);
    }

    .sv-detail-panel.active:not(.is-closed) {
        width: auto;
        max-width: none;
    }

    .sv-photo-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .sv-info-row {
        grid-template-columns: 22px 95px 1fr;
        font-size: .82rem;
    }
}

/* ==========================================================
   PRINT
   ========================================================== */

@media print {
    .sv-left-panel,
    .sv-detail-panel,
    .sv-map-search-float,
    .sv-map-toolbar,
    .sv-mini-map,
    .sv-scale-box,
    .sv-bottom-actions,
    .sv-map-note {
        display: none !important;
    }

    .sv-map-shell {
        display: block;
    }

    .sv-map-stage,
    #mapSoloVallei {
        width: 100% !important;
        height: 95vh !important;
        min-height: 95vh !important;
    }

    body {
        background: #fff !important;
    }
}

/* ==========================================================
   LEAFLET SCALE CONTROL
   ========================================================== */

.leaflet-control-scale {
    margin-right: 18px !important;
    margin-bottom: 14px !important;
}

.leaflet-control-scale-line {
    border: 0 !important;
    border-bottom: 3px solid #0f172a !important;
    border-left: 2px solid #0f172a !important;
    border-right: 2px solid #0f172a !important;
    background: rgba(255, 255, 255, .94) !important;
    color: #0f172a !important;
    font-weight: 700;
    font-size: 11px;
    line-height: 1.2;
    padding: 4px 8px 5px;
    border-radius: 6px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .18);
}