:root {
    --accent-red: #d32f2f;
    --dark-bg: #121212;
    --panel-bg: rgba(25, 25, 25, 0.9);
    --border-color: #333;
}

body, html { margin: 0; padding: 0; height: 100%; font-family: 'Segoe UI', sans-serif; background: var(--dark-bg); color: white; overflow: hidden; }

/* HEADER CENTRAT */
.app-header {
    position: absolute; top: 0; left: 0; right: 0; height: 60px;
    background: var(--accent-red); display: flex; align-items: center;
    justify-content: center; z-index: 1100;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}
.app-header h1 { margin: 0; font-size: 1.3rem; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; }

#map { position: absolute; top: 60px; bottom: 0; width: 100%; z-index: 1; }

/* PANOU STÂNGA: SESIZĂRI ZONALE */
#left-panel {
    position: absolute; top: 80px; left: 20px; z-index: 1000;
    width: 340px; max-height: calc(100vh - 120px);
    background: var(--panel-bg); border-radius: 12px;
    border: 1px solid var(--border-color); border-left: 5px solid var(--accent-red);
    backdrop-filter: blur(10px); display: flex; flex-direction: column; overflow: hidden;
}

/* PANOU DREAPTA: CHANGELOG / VERSIUNI */
#right-panel {
    position: absolute; top: 80px; right: 20px; z-index: 1000;
    width: 280px; max-height: calc(100vh - 120px);
    background: var(--panel-bg); border-radius: 12px;
    border: 1px solid var(--border-color); border-right: 5px solid #00d4ff;
    backdrop-filter: blur(10px); display: flex; flex-direction: column;
}

.panel-header { padding: 15px; border-bottom: 1px solid var(--border-color); font-weight: bold; font-size: 0.85rem; display: flex; align-items: center; gap: 8px; }
.scroll-area { overflow-y: auto; flex-grow: 1; padding: 5px; }

/* STIL SESIZARE LISTĂ */
.unlocated-item {
    padding: 12px; border-bottom: 1px solid #222; cursor: pointer; transition: 0.2s;
}
.unlocated-item:hover { background: rgba(211, 47, 47, 0.1); }
.unlocated-item strong { color: #ff5252; font-size: 0.9rem; }
.unlocated-item .id-tag { float: right; font-size: 0.7rem; color: #666; }
.unlocated-item p { margin: 5px 0; font-size: 0.8rem; color: #ccc; line-height: 1.3; }

/* ISTORIC ÎN LISTĂ */
.list-history {
    margin-top: 8px; padding: 8px; background: rgba(0,0,0,0.3);
    border-radius: 6px; font-size: 0.75rem; border-left: 2px solid #ff9800;
}

/* CHANGELOG STYLE */
.version-item { padding: 10px; border-bottom: 1px solid #222; font-size: 0.8rem; }
.version-tag { color: #00d4ff; font-weight: bold; }

/* POPUP MAP SCROLL */
.leaflet-popup-content { width: 300px !important; margin: 0; }
.popup-container { padding: 15px; color: #333; }
.popup-scroll { max-height: 250px; overflow-y: auto; padding-right: 5px; }

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-thumb { background: #444; border-radius: 10px; }

@media (max-width: 768px) {
    #left-panel, #right-panel { display: none; } /* Ascundem panourile pe mobil pentru spațiu */
}

/* Containerul Galeriei din Popup */
.popup-galerie {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* Două coloane egale */
    gap: 5px; /* Spațiu mic între poze */
    margin-top: 10px;
    margin-bottom: 5px;
}

/* Stilul pentru link-ul Lightbox */
.popup-galerie a {
    display: block;
    overflow: hidden;
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.05);
    transition: transform 0.2s ease;
}

.popup-galerie a:hover {
    transform: scale(1.03); /* Efect discret la trecerea mouse-ului */
    border-color: var(--accent-red);
}

/* Stilul pentru imaginea mică (Thumbnail) */
.popup-galerie img {
    width: 100%;
    height: 70px; /* Înălțime fixă, mică */
    object-fit: cover; /* Taie imaginea central, fără s-o deformeze */
    display: block;
}



/* Stil Buton Theme */
.btn-theme {
    background: rgba(255,255,255,0.2);
    border: 1px solid white;
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: 0.3s;
}
.btn-theme:hover { background: white; color: var(--accent-red); }

/* REGULI LIGHT MODE */
body.light-theme {
    background: #f4f4f4;
    color: #333;
}
body.light-theme #left-panel, 
body.light-theme #right-panel {
    background: rgba(255, 255, 255, 0.95);
    border-color: #ccc;
    color: #333;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}
body.light-theme .panel-header { background: #eee; border-bottom: 1px solid #ddd; color: #555; }
body.light-theme .unlocated-item { border-bottom: 1px solid #eee; }
body.light-theme .unlocated-item p { color: #666; }
body.light-theme .version-item { border-bottom: 1px solid #eee; }

/* Container Căutare Centrat */
.search-container {
    position: absolute; top: 75px; left: 50%; transform: translateX(-50%);
    z-index: 1050; width: 400px;
}
.search-box {
    background: var(--panel-bg); backdrop-filter: blur(10px);
    border: 1px solid var(--border-color); border-radius: 25px;
    padding: 8px 15px; display: flex; align-items: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
.search-box i { color: var(--accent-red); margin-right: 10px; }
.search-box input {
    background: transparent; border: none; color: white; width: 100%;
    outline: none; font-size: 0.85rem;
}

/* Rezultate Căutare */
.search-results {
    position: absolute; top: 45px; left: 0; right: 0;
    background: var(--panel-bg); border-radius: 12px;
    max-height: 250px; overflow-y: auto; display: none;
    border: 1px solid var(--border-color);
}
.search-item {
    padding: 10px 15px; font-size: 0.8rem; cursor: pointer; border-bottom: 1px solid #333;
}
.search-item:hover { background: rgba(211, 47, 47, 0.2); }

/* Adaptare Light Mode */
body.light-theme .search-box { background: white; border-color: #ccc; }
body.light-theme .search-box input { color: #333; }
body.light-theme .search-results { background: white; border-color: #ccc; }
body.light-theme .search-item { border-bottom-color: #eee; color: #333; }

/* Badge-uri pentru temei legal */
.badge-og27 { background-color: #0dcaf0; color: #000; padding: 2px 6px; border-radius: 4px; font-weight: bold; }
.badge-l544 { background-color: #ffc107; color: #000; padding: 2px 6px; border-radius: 4px; font-weight: bold; }
.auth-label { color: #d32f2f; font-weight: bold; font-size: 0.75rem; display: block; margin-top: 5px; }


@media (max-width: 768px) { .search-container { width: 90%; top: 70px; } }
/* Ajustări pentru ecrane mici (Mobil) */
@media (max-width: 768px) {
    .side-panel {
        position: fixed;
        top: 60px;
        left: -100%; /* Ascunse în afara ecranului lateral */
        width: 85%;
        height: calc(100vh - 80px);
        transition: left 0.3s ease;
        z-index: 2000;
    }

    /* Când panoul primește clasa .active, glisează pe ecran */
    .side-panel.active {
        left: 0;
    }

    #right-panel {
        right: -100%;
        left: auto;
    }

    #right-panel.active {
        right: 0;
    }

    /* Butoane plutitoare pentru a deschide panourile pe mobil */
    .mobile-toggle {
        display: flex !important;
        position: fixed;
        bottom: 20px;
        z-index: 1500;
        background: var(--accent-red);
        color: white;
        border: none;
        width: 50px;
        height: 50px;
        border-radius: 50%;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    }
    
    #btn-open-left { left: 20px; }
    #btn-open-right { right: 20px; background: #00d4ff; }
}

/* Ascundem butoanele de mobil pe Desktop */
.mobile-toggle { display: none; }

@media (max-width: 768px) {
    /* Setarea de bază: ascundem panourile */
    #left-panel, #right-panel {
        display: none; /* Scoate !important de aici dacă există */
        position: fixed;
        top: 60px;
        width: 85%;
        height: calc(100vh - 70px);
        z-index: 2000;
    }

    /* Regula care "bate" display: none */
    #left-panel.active, #right-panel.active {
        display: flex !important; /* Forțăm afișarea când este activ */
        left: 0;
    }
    
    #right-panel.active {
        right: 0;
        left: auto;
    }
}

/* Overlay-ul negru transparent */
#panel-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1900; /* Sub panouri, dar peste hartă */
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#panel-overlay.active {
    display: block;
    opacity: 1;
}

/* Butonul de închidere din interiorul panoului */
.btn-close-panel {
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 1.2rem;
    cursor: pointer;
    display: none; /* Apare doar pe mobil */
}

@media (max-width: 768px) {
    .btn-close-panel { display: block; }
    
    /* Efect de blur pe harta din spate când panoul e activ */
    body.panel-open #map {
        filter: blur(2px);
    }
}