/* ─── Variables (paleta compartida con index) ─── */
:root {
    --bg-1: #1f4037;
    --bg-2: #99f2c8;
    --accent: #f9d423;
    --accent-text: #1f4037;
    --glass: rgba(255, 255, 255, .10);
    --glass-hover: rgba(255, 255, 255, .16);
    --border: rgba(255, 255, 255, .15);
    --text: #ffffff;
    --text-dim: rgba(255, 255, 255, .70);
    --radius: 14px;
    --shadow: 0 8px 24px rgba(0, 0, 0, .28);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    height: 100%;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    overflow: hidden;
}

/* ─── Layout principal ─── */
.mapa-container {
    display: flex;
    height: 100vh;
}

/* ─── Sidebar ─── */
.sidebar {
    width: 300px;
    min-width: 300px;
    min-height: 0;
    background: linear-gradient(160deg, rgba(31,64,55,.98) 0%, rgba(20,48,40,.99) 100%);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1000;
}

.sidebar-header {
    padding: 18px 18px 14px;
    border-bottom: 1px solid var(--border);
    background: rgba(0,0,0,.15);
    flex-shrink: 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
    font-size: 18px;
    font-weight: 900;
    letter-spacing: .2px;
    margin-bottom: 4px;
}

.sidebar-logo span {
    color: var(--accent);
}

.sidebar-subtitle {
    font-size: 12px;
    color: var(--text-dim);
    letter-spacing: .3px;
}

.sidebar-content {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.sidebar-content::-webkit-scrollbar {
    width: 4px;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.20);
    border-radius: 4px;
}

/* ─── Filtro categorías ─── */
.section-label {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--accent);
    margin-bottom: 10px;
}

.categorias-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 20px;
}

.categoria-btn {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--glass);
    color: var(--text);
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    transition: background .15s, border-color .15s, transform .12s;
    white-space: nowrap;
}

.categoria-btn:hover {
    background: var(--glass-hover);
    transform: translateY(-1px);
}

.categoria-btn.active {
    background: var(--accent);
    color: var(--accent-text);
    border-color: var(--accent);
}

/* ─── Lista de lugares ─── */
.lugares-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.lugares-count {
    background: var(--accent);
    color: var(--accent-text);
    font-size: 11px;
    font-weight: 900;
    padding: 2px 8px;
    border-radius: 999px;
}

.lugar-item {
    padding: 11px 12px;
    margin-bottom: 7px;
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background .15s, border-color .15s, transform .12s;
}

.lugar-item:hover {
    background: var(--glass-hover);
    border-color: rgba(249,212,35,.35);
    transform: translateX(3px);
}

.lugar-item.selected {
    background: rgba(249,212,35,.18);
    border-color: rgba(249,212,35,.60);
}

.lugar-item h4 {
    margin: 0 0 3px 0;
    font-size: 13px;
    font-weight: 800;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lugar-item p {
    margin: 0;
    font-size: 11px;
    color: var(--text-dim);
}

/* ─── Mapa ─── */
#map {
    flex: 1;
    height: 100vh;
    position: relative;
}

/* ─── Botón volver al inicio (flotante sobre el mapa) ─── */
.btn-inicio {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 2500;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 18px;
    background: rgba(31,64,55,.90);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    border: 1px solid var(--border);
    border-radius: 999px;
    text-decoration: none;
    box-shadow: var(--shadow);
    transition: background .15s, transform .12s;
}

.btn-inicio:hover {
    background: rgba(249,212,35,.90);
    color: var(--accent-text);
    transform: translateY(-1px);
}

.btn-inicio svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
    flex-shrink: 0;
}

/* ─── Panel de información ─── */
.panel-info {
    position: fixed;
    right: -540px;
    top: 0;
    width: 500px;
    height: 100vh;
    background: linear-gradient(180deg, rgba(14,36,28,.99) 0%, rgba(10,26,20,1) 100%);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-left: 1px solid rgba(255,255,255,.09);
    z-index: 2000;
    transition: right .32s cubic-bezier(.4,0,.2,1);
    overflow-y: auto;
    overflow-x: hidden;
    color: var(--text);
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 48px rgba(0,0,0,.55);
}

.panel-info.active {
    right: 0;
}

.panel-info::-webkit-scrollbar { width: 4px; }
.panel-info::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 4px; }

/* ── Botón cerrar (flotante sobre la imagen) ── */
.btn-cerrar-panel {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 30;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 10px;
    color: rgba(255,255,255,.92);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .4px;
    padding: 8px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background .15s, border-color .15s;
}

.btn-cerrar-panel:hover {
    background: rgba(0,0,0,.80);
    border-color: rgba(255,255,255,.38);
    color: #fff;
}

/* ── Hero imagen de portada ── */
.info-hero {
    position: relative;
    width: 100%;
    height: 280px;
    overflow: hidden;
    flex-shrink: 0;
}

.info-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .7s ease;
}

.panel-info:hover .info-hero img {
    transform: scale(1.04);
}

.info-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(0,0,0,.04)   0%,
        rgba(0,0,0,.12)  45%,
        rgba(10,26,20,.97) 100%
    );
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 22px;
    gap: 8px;
}

.info-hero-overlay h2 {
    margin: 0;
    font-size: 26px;
    font-weight: 900;
    color: #fff;
    line-height: 1.18;
    text-shadow: 0 2px 14px rgba(0,0,0,.75);
    letter-spacing: -.4px;
}

/* ── Cabecera plana (sin imagen) ── */
.info-header-plain {
    padding: 60px 22px 22px;
    border-bottom: 1px solid rgba(255,255,255,.07);
    background: rgba(0,0,0,.18);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.info-header-plain h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 900;
    color: var(--text);
    line-height: 1.2;
}

/* ── Badge de categoría ── */
.info-categoria {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    background: rgba(249,212,35,.18);
    border: 1px solid rgba(249,212,35,.42);
    color: var(--accent);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .4px;
    width: fit-content;
}

/* ── Contenido del panel ── */
#panel-info-content {
    padding: 22px 22px 80px;
    flex: 1;
}

.info-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,.07);
}

.info-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.info-section h3 {
    margin: 0 0 10px 0;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--accent);
    opacity: .82;
}

.info-section p {
    margin: 5px 0;
    color: rgba(255,255,255,.72);
    line-height: 1.60;
    font-size: 14px;
    display: flex;
    gap: 10px;
    align-items: baseline;
}

.info-section p .lbl {
    display: inline-block;
    min-width: 70px;
    color: rgba(255,255,255,.36);
    font-size: 12px;
    flex-shrink: 0;
}

.info-coordenadas {
    background: rgba(0,0,0,.28);
    padding: 8px 14px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: rgba(255,255,255,.36);
    margin-top: 10px;
    border: 1px solid rgba(255,255,255,.07);
    letter-spacing: .6px;
}

/* ── Acciones ── */
.info-acciones {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ─── Botón Guardar / Favorito ─── */
.btn-fav {
    width: 100%;
    padding: 12px;
    margin-bottom: 8px;
    background: rgba(255,255,255,.10);
    border: 1px solid rgba(255,255,255,.20);
    border-radius: var(--radius);
    color: rgba(255,255,255,.85);
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background .15s, border-color .15s;
}

.btn-fav svg {
    width: 18px;
    height: 18px;
    fill: rgba(255,255,255,.4);
    transition: fill .15s;
}

.btn-fav:hover {
    background: rgba(255,80,80,.14);
    border-color: rgba(255,80,80,.3);
}

.btn-fav.is-fav {
    background: rgba(255,80,80,.22);
    border-color: rgba(255,80,80,.5);
}

.btn-fav.is-fav svg {
    fill: #ff6b6b;
}

.btn-direcciones {
    width: 100%;
    padding: 13px;
    background: var(--accent);
    color: var(--accent-text);
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    margin-top: 8px;
    transition: filter .15s, transform .12s;
}

.btn-direcciones:hover {
    filter: brightness(1.07);
    transform: translateY(-1px);
}

/* ─── Popup en el mapa ─── */
.custom-popup h3 {
    margin: 0 0 8px 0;
    color: var(--bg-1);
    font-size: 15px;
}

.custom-popup p {
    margin: 4px 0;
    font-size: 13px;
    color: #444;
}

.custom-popup .categoria-badge {
    display: inline-block;
    padding: 3px 10px;
    background: var(--bg-1);
    color: white;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    margin-top: 6px;
}

.popup-img {
    display: block;
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
    margin-top: 10px;
}

/* ─── Responsive sidebar ─── */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -300px;
        top: 0;
        height: 100%;
        transition: left .28s cubic-bezier(.4,0,.2,1);
        z-index: 1500;
    }

    .sidebar.open {
        left: 0;
    }

    .btn-toggle-sidebar {
        position: fixed;
        z-index: 1600;
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        background: rgba(31, 64, 55, .92);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border: 1px solid var(--border);
        border-radius: 14px;
        color: #fff;
        font-size: 20px;
        cursor: pointer;
        box-shadow: var(--shadow);
        top: 14px;
        right: 14px;
    }
}

.btn-toggle-sidebar { display: none; }
