/* =============================================
   MAPA.CSS — Mapa interactiu de Gualba
   Panells flotants, arrossegar i zoom
   ============================================= */

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

body {
    overflow: hidden;
    background: #ffffff;
    font-family: Georgia, serif;
    font-size: 0.82rem;
    color: #333;
}

/* ==================== ESCENA ==================== */
.mapa-escena {
    position: fixed;
    inset: 0;
    overflow: hidden;
    cursor: grab;
    user-select: none;
}

.mapa-escena:active {
    cursor: grabbing;
}

/* ==================== CONTENIDOR DEL MAPA ==================== */
.mapa-contenidor {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
}

.mapa-contenidor img {
    position: absolute;
    top: 0;
    left: 0;
    height: 100vh;
    width: auto;
    display: block;
}


/* ==================== PANELLS FLOTANTS ==================== */
.panell-flotant {
    position: fixed;
    z-index: 50;
    background: rgba(253, 250, 245, 0.97);
    border: 1px solid #d5c9b8;
    border-radius: 8px;
    box-shadow: 0 6px 28px rgba(0, 0, 0, 0.22), 0 1px 4px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* — Panell esquerra — */
.panell-e {
    top: 12px;
    left: 12px;
    bottom: 12px;
    width: 260px;
}

/* — Panell dreta — */
.panell-d {
    top: 12px;
    right: 12px;
    bottom: 12px;
    width: 460px;
    overflow: hidden;
}

/* ==================== CAPÇALERA PANELL ==================== */
.pf-cap {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #5d2e0a;
    color: #f4f1ea;
    padding: 9px 10px 9px 13px;
    font-size: 0.80rem;
    font-weight: bold;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-align: center;
}

.pf-cap span {
    flex: 1;
    text-align: center;
}

.btn-tancar {
    align-self: center;
    padding: 7px 18px;
    background: #ede4d8;
    border: 1px solid #d5c9b8;
    border-radius: 4px;
    color: #5d2e0a;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: background 0.15s;
    flex-shrink: 0;
    margin-top: 14px;
    margin-bottom: 30px;
}

.btn-tancar:hover {
    background: #ddd0c0;
}

/* ==================== COS PANELL ==================== */
.pf-cos {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0 6px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Scrollbar discreta */
.pf-cos::-webkit-scrollbar { width: 5px; }
.pf-cos::-webkit-scrollbar-track { background: transparent; }
.pf-cos::-webkit-scrollbar-thumb { background: #d5c9b8; border-radius: 3px; }

/* ==================== SECCIONS ==================== */
.pf-seccio {
    padding: 6px 12px 10px;
    border-bottom: 1px solid #e8e0d5;
}

.pf-seccio:last-child {
    border-bottom: none;
}

.pf-h3 {
    font-size: 0.72rem;
    font-weight: bold;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #5d2e0a;
    margin-bottom: 8px;
    padding-bottom: 3px;
    border-bottom: 1px solid #e5e0d8;
}

/* ==================== FILES DE CAPA ==================== */
.capa-fila {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 6px;
    padding: 4px 6px;
    border-radius: 4px;
    transition: background 0.2s;
}

.capa-fila.activa {
    background: rgba(93, 46, 10, 0.07);
}

.capa-fila label {
    font-size: 0.80rem;
    color: #444;
    cursor: pointer;
    transition: color 0.15s;
    padding: 0;
    border: none;
    background: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.capa-fila label:hover {
    color: #5d2e0a;
    border: none;
    background: none;
}

.capa-fila input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: #5d2e0a;
    cursor: pointer;
    flex-shrink: 0;
    margin: 0;
}

.capa-fila input[type="range"] {
    width: 72px;
    height: 4px;
    accent-color: #5d2e0a;
    cursor: pointer;
    flex-shrink: 0;
}

/* ==================== SLIDER ZOOM DEL PANELL ==================== */
.zoom-slider {
    width: 100%;
    height: 5px;
    accent-color: #5d2e0a;
    cursor: pointer;
    margin-top: 4px;
}

/* ==================== PEU PANELL ==================== */
.pf-peu {
    flex-shrink: 0;
    padding: 10px 12px 12px;
    border-top: 1px solid #e5e0d8;
    margin-top: auto;
}

.btn-inici {
    display: block;
    text-align: center;
    padding: 7px 10px;
    background: #faf8f4;
    border: 1px solid #d5c9b8;
    border-radius: 4px;
    color: #5d2e0a;
    text-decoration: none;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    transition: background 0.15s;
}

.btn-inici:hover {
    background: #f0e6da;
}

/* ==================== BOTÓ ☰ FLOTANT ==================== */
.btn-menu-flotant {
    position: fixed;
    z-index: 55;
    top: 12px;
    left: 12px;
    width: 38px;
    height: 38px;
    background: #5d2e0a;
    color: #f4f1ea;
    border: none;
    border-radius: 6px;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.btn-menu-flotant:hover {
    background: #3a1b05;
}

/* ==================== BARRA ZOOM INFERIOR ==================== */
.barra-inf {
    display: none !important;
    position: fixed;
    z-index: 55;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(93, 46, 10, 0.92);
    border-radius: 30px;
    padding: 7px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.35);
}

.barra-inf-etiq {
    font-size: 0.75rem;
    color: #f4e8dc;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
}

.barra-inf input[type="range"] {
    width: 180px;
    height: 5px;
    accent-color: #f4e8dc;
    cursor: pointer;
}

/* ==================== ANIMACIÓ FADE-IN ==================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ==================== PANELL DRETA — CARDS ==================== */
.pd-card {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    padding: 12px 12px 14px;
    overflow: hidden;
    gap: 10px;
    animation: fadeIn 0.3s ease;
}

.pd-texte {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 10px 12px;
    border: 1px solid #e5e0d8;
    border-radius: 4px;
    background: #ffffff;
    cursor: grab;
}

.pd-texte::-webkit-scrollbar { width: 5px; }
.pd-texte::-webkit-scrollbar-track { background: transparent; }
.pd-texte::-webkit-scrollbar-thumb { background: #d5c9b8; border-radius: 3px; }

.pd-card h2 {
    font-size: 0.85rem;
    font-weight: bold;
    color: #5d2e0a;
    margin-bottom: 8px;
    text-align: center;
    letter-spacing: 0.03em;
}

.pd-card img {
    width: 100%;
    height: auto;
    max-height: 60%;
    flex-shrink: 0;
    border: 6px solid white;
    outline: 1px solid #d5c9b8;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    display: block;
    margin-bottom: 10px;
}

.pd-card p {
    font-size: 0.78rem;
    color: #555;
    line-height: 1.5;
    margin-bottom: 0.5rem;
    text-align: justify;
    text-indent: 1.5em;
}

.pd-card p:last-child {
    margin-bottom: 0;
}

.btn-tancar-mobil  { display: none; }
.btn-tancar-desktop { display: inline; }

/* ==================== RESPONSIVE MÒBIL ==================== */
@media (max-width: 768px) {
    .btn-tancar-mobil  { display: inline; }
    .btn-tancar-desktop { display: none; }

    /* Panell dret ocult sempre */
    #panellDreta {
        display: none !important;
    }

    /* Panell esquerre: pantalla completa quan visible */
    .panell-e {
        top: 0;
        left: 0;
        bottom: 0;
        right: 0;
        width: 100%;
        border-radius: 0;
        z-index: 100;
    }

    /* Botó ☰ més gran per a dits */
    .btn-menu-flotant {
        width: 48px;
        height: 48px;
        font-size: 1.3rem;
        top: 10px;
        left: 10px;
    }

    /* Sliders més llargs en mòbil */
    .capa-fila input[type="range"] {
        width: 100px;
    }

    .zoom-slider {
        width: 100%;
    }
}

/* ==================== RESET GLOBALS HERETATS ==================== */
label {
    transition: none;
    padding: 0;
    border: none;
}

label:hover {
    border: none;
    background: none;
    color: inherit;
}

h1, h2, h3 {
    font-size: inherit;
    text-align: left;
}
