/* ==========================================================================
   MÓDULO CSS: SINGLE CENTROS LOGISTICOS
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. CORRECCIÓN: TEXTURA DEL HERO CORPORATIVO
   -------------------------------------------------------------------------- */
.single-centro-logistico .page-hero,
.single-centro-logistico .hero-section {
    padding: 85px 4vw 85px 4vw;
    /* Patrón oscuro estandarizado de MercoSurLTDA */
    background: radial-gradient(black 15%, transparent 16%) 0 0,
                radial-gradient(black 15%, transparent 16%) 8px 8px,
                radial-gradient(rgba(255,255,255,.05) 15%, transparent 20%) 0 1px,
                radial-gradient(rgba(255,255,255,.05) 15%, transparent 20%) 8px 9px !important;
    background-color: #141414 !important;
    color: var(--color-white, #ffffff);
    background-size: 16px 16px !important;
    /* Cierre corporativo */
    border-bottom: 3px solid var(--color-red, #e3001b) !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --------------------------------------------------------------------------
   1. CONTENEDOR PRINCIPAL Y UTILIDADES
   -------------------------------------------------------------------------- */
.single-centro-logistico .sitios-section {
    padding: 60px 4vw 120px 4vw;
    background-color: var(--color-light, #f8f9fa);
}

.relative-container {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
}

/* Botón de Retorno */
.action-bar-top {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 30px;
    
}

.btn-retorno-ghost {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #555555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-decoration: none;
    transition: color 0.3s ease, transform 0.3s ease;
}

.btn-retorno-ghost svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

.btn-retorno-ghost:hover {
    color: var(--color-red, #e3001b);
}

.btn-retorno-ghost:hover svg {
    transform: translateX(-4px); 
}

/* --------------------------------------------------------------------------
   2. SELECTOR DE SITIOS (Pill Tabs)
   -------------------------------------------------------------------------- */
.sitios-pill-nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 50px;
}

.btn-pill-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    border: 2px solid #e0e0e0;
    color: var(--color-darker, #111111);
    padding: 12px 25px;
    border-radius: 50px;
    font-weight: 800;
    font-size: 0.8rem;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pill-icon {
    width: 18px;
    height: 18px;
    color: var(--color-red, #e3001b);
    transition: color 0.3s ease;
}

.btn-pill-tab:hover {
    border-color: var(--color-darker, #111111);
}

.btn-pill-tab.active {
    background: var(--color-red, #e3001b);
    border-color: var(--color-red, #e3001b);
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(227, 0, 27, 0.25);
}

.btn-pill-tab.active .pill-icon {
    color: #ffffff;
}

/* --------------------------------------------------------------------------
   3. PANELES DE CONTENIDO (Maestro/Detalle)
   -------------------------------------------------------------------------- */
.sitios-panels-container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}

.sitio-panel {
    display: none;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #eef0f2;
    box-shadow: 0 20px 40px rgba(0,0,0,0.05);
    overflow: hidden;
    animation: fadeInPanel 0.4s ease forwards;
}

.sitio-panel.active {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
    gap: 0;
    /* La altura de .sitio-panel.active se fija por JS (ver script al final
       del template), igualándola a la altura natural de .sitio-panel-left.
       Así la columna derecha puede tener scroll interno sin que la tarjeta
       crezca cuando el texto es largo. */
}

@keyframes fadeInPanel {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Lado Izquierdo: Galería y Ubicación */
.sitio-panel-left {
    background-color: #f8f9fa; 
    display: flex;
    flex-direction: column;
    justify-content: center; 
    padding: 40px;
    gap: 20px; 
    border-right: 1px solid #eef0f2;
    min-height: 0; /* necesario dentro de un grid item */
}

.sitio-title-header {
    display: flex;
    justify-content: space-between;
    align-items: center; 
    padding-bottom: 20px;
    border-bottom: 2px solid rgba(227, 0, 27, 0.1); 
    position: relative;
    margin-bottom: 0; 
}

.sitio-title-header::after {
    content: '';
    position: absolute;
    bottom: -2px; 
    left: 0;
    width: 60px;
    height: 4px;
    background-color: var(--color-red, #e3001b);
    border-radius: 2px;
}

.sitio-name {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--color-darker, #111111);
    text-transform: uppercase;
    line-height: 1.2;
    margin: 0;
}

.title-icon {
    width: 40px;
    height: 40px;
    color: var(--color-red, #e3001b);
    flex-shrink: 0;
    margin-left: 15px;
}

/* Imágenes */
.sitio-gallery-main {
    position: relative;
    width: 100%;
    height: 380px; 
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    flex-shrink: 0;
}

.sitio-gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sitio-badge {
    position: absolute;
    top: 20px;
    left: 20px;
    background-color: var(--color-darker, #111111);
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    padding: 6px 14px;
    border-radius: 4px;
    letter-spacing: 1px;
    z-index: 2;
}

.sitio-gallery-thumbs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    flex-shrink: 0;
}

.thumb-card {
    position: relative;
    height: 140px;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05); 
    cursor: zoom-in;
    transform: translateY(0);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.thumb-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.thumb-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.thumb-card:hover img {
    transform: scale(1.1);
}

.thumb-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(17, 17, 17, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2;
}

.thumb-overlay svg {
    width: 24px;
    height: 24px;
    color: #ffffff;
    transform: scale(0.5);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.thumb-card:hover .thumb-overlay {
    opacity: 1;
}

.thumb-card:hover .thumb-overlay svg {
    transform: scale(1);
}

/* Caja de Ubicación */
.location-box-dark {
    background-color: #1a1a1a;
    border-radius: 6px;
    padding: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-top: 0; 
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.location-data {
    display: flex;
    flex-direction: column;
}

.loc-title {
    font-size: 0.85rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 5px;
}

.loc-address {
    font-size: 0.95rem;
    color: #a0a0a0;
    line-height: 1.4;
}

.btn-location-red {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: var(--color-red, #e3001b);
    color: #ffffff;
    padding: 12px 20px;
    font-size: 0.75rem;
    font-weight: 800;
    border-radius: 50px;
    text-decoration: none;
    transition: all 0.3s ease;
    white-space: nowrap;
    border: none;
}

.btn-location-red:hover {
    background-color: #ffffff;
    color: var(--color-red, #e3001b);
}

/* Lado Derecho: Contenido descriptivo */
.sitio-panel-right {
    padding: 50px 8%;
    display: flex;
    flex-direction: column;
    min-height: 0; /* necesario dentro de un grid item para que el scroll interno funcione */
}

.sitio-desc-formated {
    font-size: 1rem;
    color: #555555; 
    line-height: 1.8;
    margin-bottom: 0;
    /* Área con scroll propio: ocupa todo el espacio disponible dentro del
       panel y deja el botón de abajo (.sitio-actions) siempre visible */
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 10px;
    scrollbar-gutter: stable;
}

.sitio-desc-formated p:first-of-type {
    font-weight: 800;
    font-size: 1.05rem;
    margin-bottom: 20px;
}

.sitio-desc-formated ul {
    list-style: none;
    padding: 0;
    margin: 30px 0;
}

.sitio-desc-formated ul li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 15px;
}

.sitio-desc-formated ul li::before {
    content: "•";
    color: var(--color-red, #e3001b);
    font-weight: bold;
    font-size: 1.2rem;
    position: absolute;
    left: 0;
    top: -2px;
}

.sitio-desc-formated ul li strong {
    color: var(--color-darker, #111111);
    font-weight: 900;
}

/* Scrollbar de marca para la descripción (Webkit: Chrome/Edge/Safari) */
.sitio-desc-formated::-webkit-scrollbar {
    width: 6px;
}
.sitio-desc-formated::-webkit-scrollbar-track {
    background: transparent;
}
.sitio-desc-formated::-webkit-scrollbar-thumb {
    background-color: var(--color-red, #e3001b);
    border-radius: 10px;
}
/* Scrollbar de marca (Firefox) */
.sitio-desc-formated {
    scrollbar-width: thin;
    scrollbar-color: var(--color-red, #e3001b) transparent;
}

.sitio-actions {
    margin-top: 0;
    flex-shrink: 0; /* nunca se comprime, siempre visible fuera del área con scroll */
    padding-top: 20px;
    border-top: 1px solid #eef0f2;
}

.btn-sitio-primary-dark {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    background-color: #1a1a1a;
    color: #ffffff;
    padding: 18px 30px;
    font-size: 0.95rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.btn-sitio-primary-dark:hover {
    background-color: var(--color-red, #e3001b);
}

/* --------------------------------------------------------------------------
   4. LIGHTBOX
   -------------------------------------------------------------------------- */
.sitio-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(5px);
}

.sitio-lightbox-overlay.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-close {
    position: absolute;
    top: 30px;
    right: 40px;
    background: transparent;
    border: none;
    color: #ffffff;
    cursor: pointer;
    transition: transform 0.3s ease, color 0.3s ease;
    z-index: 2;
    padding: 10px;
}

.lightbox-close svg {
    width: 36px;
    height: 36px;
}

.lightbox-close:hover {
    transform: rotate(90deg);
    color: var(--color-red, #e3001b);
}

.lightbox-content {
    max-width: 90%;
    max-height: 90%;
    position: relative;
}

.lightbox-content img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    transform: scale(0.95);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.sitio-lightbox-overlay.active .lightbox-content img {
    transform: scale(1);
}

/* --------------------------------------------------------------------------
   5. RESPONSIVIDAD MÓVIL
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
    .sitio-panel.active {
        grid-template-columns: 1fr;
        height: auto !important; /* en móvil el layout ya apila las columnas, no necesita altura fija */
    }
    .sitio-gallery-main {
        height: 300px;
    }
    .sitio-panel-right {
        padding: 40px 6%;
    }
    .sitio-desc-formated {
        overflow-y: visible;
    }
}

@media (max-width: 768px) {
    .action-bar-top {
        justify-content: center;
    }
    .sitios-pill-nav {
        flex-direction: column;
        gap: 10px;
    }
    .btn-pill-tab {
        width: 100%;
        justify-content: center;
    }
    .sitio-panel-left {
        padding: 20px;
        gap: 15px;
    }
    .sitio-gallery-main {
        height: 250px;
    }
    .thumb-card {
        height: 100px;
    }
    .location-box-dark {
        flex-direction: column;
        align-items: flex-start;
        padding: 20px;
    }
    .btn-location-red {
        width: 100%;
        justify-content: center;
    }
    .lightbox-close {
        top: 15px;
        right: 15px;
    }
}