:root {
    --cafe-institucional: #8b5a2b; 
    --dorado-oficial: #b19379; 
    --fondo-degradado: linear-gradient(180deg, #444444 0%, #999999 50%, #666666 100%);
    --sombra-suave: 0 8px 20px rgba(0,0,0,0.15);
    --sombra-fuerte: 0 15px 35px rgba(0,0,0,0.3);
}

html, body { margin: 0; padding: 0; height: auto; min-height: 100%; }
body { font-family: 'Arial', sans-serif; background: var(--fondo-degradado); user-select: none; overflow-y: auto; overflow-x: hidden; min-height: 100vh; display: flex; flex-direction: column; }

/* HEADER Y CONTENEDORES */
.main-header { background-color: var(--cafe-institucional); color: white; width: 100%; border-bottom: 6px solid var(--dorado-oficial); border-radius: 0 0 30px 30px; box-shadow: var(--sombra-fuerte); flex-shrink: 0; }
.header-main-content { display: flex; justify-content: space-between; align-items: center; padding: 25px 40px; max-width: 1400px; margin: 0 auto; }
.header-logo, .header-spacer { width: 200px; }
.header-texts { flex-grow: 1; text-align: center; }
.titulo-principal { font-size: 2.4rem; margin: 0; font-weight: bold; letter-spacing: 1.5px; text-transform: uppercase; }
.header-subtitle { color: #ffffff; font-size: 1.1rem; margin: 8px 0 0 0; opacity: 0.9; }
.sub-header-bar { display: flex; width: 100%; max-width: 1050px; margin: 15px auto 0 auto; padding: 0 20px; box-sizing: border-box; }
.datetime-display { color: white; font-weight: bold; font-size: 1rem; text-align: left; margin-right: auto; }
.instruction-text { text-align: center; font-size: 1.3rem; font-weight: bold; color: white; margin: 30px auto; text-shadow: 1px 1px 4px rgba(0,0,0,0.6); transition: opacity 0.3s; }
.container-white { background: #ffffff; border: 2px solid #ffffff; outline: 5px solid var(--dorado-oficial); border-radius: 20px; padding: 45px; max-width: 1050px; margin: 0 auto 60px auto; height: auto; min-height: 200px; box-shadow: var(--sombra-fuerte); overflow: hidden; box-sizing: border-box; }
.mensaje-carga { width: 100%; text-align: center; color: #666; font-size: 1.5rem; margin: 40px 0; animation: pulso 1.5s infinite; }

/* GRID DE MUNICIPIOS */
.grid-municipios { display: flex; flex-wrap: wrap; justify-content: center; gap: 35px; }
.municipio-card { text-align: center; cursor: pointer; padding: 10px; border-radius: 15px; transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); opacity: 0; transform: scale(0.9) translateY(20px); animation: aparecer 0.6s forwards; flex: 0 1 210px; }
.municipio-card:hover { transform: translateY(-12px) scale(1.1); box-shadow: var(--sombra-suave); }
.municipio-card img { height: 160px; width: auto; object-fit: contain; margin-bottom: 15px; }
.nombre-entidad { font-weight: bold; color: #333; font-size: 1.15rem; text-transform: uppercase;}

/* Cabecera del Explorador (Breadcrumbs) */
.header-explorador { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; padding-bottom: 20px; border-bottom: 2px solid #eee; flex-wrap: wrap; gap: 15px; }
.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 1.2rem; font-weight: bold; color: #555; }
.breadcrumb-item { cursor: pointer; padding: 5px 10px; border-radius: 8px; transition: 0.2s; }
.breadcrumb-item:hover { background-color: #f0f0f0; color: var(--cafe-institucional); }
.breadcrumb-separator { color: #aaa; }
.btn-regresar { background: var(--cafe-institucional); color: white; border: 2px solid var(--dorado-oficial); padding: 10px 18px; border-radius: 8px; cursor: pointer; font-weight: bold; transition: 0.2s; }
.btn-regresar:hover { background: #6a421d; transform: scale(1.05); }

/* CONTENEDOR BASE */
.grid-explorador { 
    position: relative;
    width: 100%;
    perspective: 1000px; 
    padding: 20px 0;
    transition: all 0.3s ease;
}

/* --- MODO 1: LISTA (4 o más elementos) --- */
.grid-explorador.modo-lista {
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    gap: 20px; 
}
.grid-explorador.modo-lista .item-card { 
    position: relative; 
    width: 100%; 
    max-width: 650px; /* Ancho máximo de la lista */
    flex-direction: row; 
    justify-content: flex-start;
    background: rgba(255,255,255,0.7); /* Fondo sutil para distinguir la fila */
    padding: 10px 30px;
    border-radius: 15px;
    box-shadow: var(--sombra-suave);
}
.grid-explorador.modo-lista .item-card:hover {
    background: #ffffff;
    box-shadow: var(--sombra-fuerte);
}
.grid-explorador.modo-lista .item-titulo { 
    margin-top: 0; 
    margin-left: 25px; 
    text-align: left; 
    font-size: 1.2rem; 
    flex-grow: 1;
}
/* Hacemos los iconos 3D un poco más pequeños para la lista */
.grid-explorador.modo-lista .folder-visual { transform: scale(0.65); margin: -20px 0; }
.grid-explorador.modo-lista .file-visual { transform: scale(0.65); margin: -25px 0; }

/* --- MODO 2: ESCALONADO CENTRADO (1 a 3 elementos) --- */
.grid-explorador.escalonado { display: block; }
.grid-explorador.escalonado .item-card { position: absolute; margin: 0; }

/* 1 carpeta (Centro exacto) */
.grid-explorador.count-1 .step-0 { left: calc(50% - 75px); top: 20px; }

/* 2 carpetas (Separación amplia de 200px) */
.grid-explorador.count-2 .step-0 { left: calc(50% - 175px); top: 20px; }
.grid-explorador.count-2 .step-1 { left: calc(50% + 25px); top: 140px; }

/* 3 carpetas (Separación amplia de 200px) */
.grid-explorador.count-3 .step-0 { left: calc(50% - 275px); top: 20px; }
.grid-explorador.count-3 .step-1 { left: calc(50% - 75px); top: 140px; }
.grid-explorador.count-3 .step-2 { left: calc(50% + 125px); top: 260px; }

/* Tarjeta Base (Carpetas y Archivos) */
.item-card { 
    width: 150px; 
    cursor: pointer; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    opacity: 0; 
    transform: translateY(30px) scale(0.9); 
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; 
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease; 
}
.item-card:hover { transform: translateY(-10px) scale(1.05); z-index: 10; }
.item-titulo { margin-top: 15px; text-align: center; font-weight: bold; font-size: 1.05rem; color: #333; line-height: 1.3; }

/* DISEÑO DE LA CARPETA FÍSICA */
.folder-visual { width: 140px; height: 100px; background: var(--dorado-oficial); border-radius: 0 10px 10px 10px; position: relative; box-shadow: var(--sombra-suave); transition: all 0.3s ease; display: flex; justify-content: center; align-items: center; }
.folder-visual::before { content: ""; position: absolute; top: -15px; left: 0; width: 50px; height: 15px; background: inherit; border-radius: 10px 10px 0 0; }
.folder-visual::after { content: ""; position: absolute; bottom: 0; left: 0; width: 100%; height: 85px; background: var(--cafe-institucional); border-radius: 10px; transform-origin: bottom; transition: transform 0.3s ease; box-shadow: inset 0 5px 10px rgba(0,0,0,0.1); }
.item-card:hover .folder-visual { box-shadow: var(--sombra-fuerte); }
.item-card:hover .folder-visual::after { transform: rotateX(-20deg); }
.folder-icon { z-index: 2; font-size: 2.5rem; color: rgba(255,255,255,0.8); }

/* DISEÑO DEL ARCHIVO FÍSICO */
.file-visual { width: 100px; height: 130px; background: #fff; border-radius: 8px; position: relative; box-shadow: 0 4px 10px rgba(0,0,0,0.1); border: 1px solid #ddd; transition: all 0.3s ease; display: flex; justify-content: center; align-items: center; flex-direction: column; }
.file-visual::before { content: ""; position: absolute; top: -1px; right: -1px; width: 30px; height: 30px; background: linear-gradient(to bottom left, transparent 50%, #eee 50%); border-bottom-left-radius: 5px; box-shadow: -2px 2px 5px rgba(0,0,0,0.05); }
.item-card:hover .file-visual { box-shadow: var(--sombra-fuerte); border-color: var(--dorado-oficial); }
.file-icon { font-size: 3rem; margin-bottom: 5px; }
.file-badge { background: #d9534f; color: white; font-size: 0.7rem; padding: 3px 8px; border-radius: 10px; font-weight: bold; text-transform: uppercase; }
.badge-mp4 { background: #5cb85c; }

/* ANIMACIONES */
@keyframes aparecer { to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes popIn { to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes pulso { 0% { opacity: 0.5; } 50% { opacity: 1; } 100% { opacity: 0.5; } }
.hidden { display: none !important; }

/* MODAL Y VISOR */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.95); z-index: 1000; }
.modal-content { width: 92%; height: 92%; margin: 2% auto; background: white; border-radius: 20px; overflow: hidden; display: flex; flex-direction: column; }
.modal-header { background: var(--cafe-institucional); color: white; padding: 15px 25px; display: flex; justify-content: space-between; align-items: center; font-size: 1.2rem; }
.btn-cerrar { background: #d9534f; color: white; border: none; padding: 8px 15px; border-radius: 8px; cursor: pointer; font-weight: bold; font-size: 1rem; }
.visor-container { position: relative; flex-grow: 1; background: #000; overflow: hidden; display: flex; justify-content: center; align-items: center; }
.visor-pdf { width: 100%; height: 100%; border: none; display: block; background: #555; }
.visor-video { width: 100%; height: 100%; outline: none; background: #000; }
.bloqueo-descarga { position: absolute; top: 0; right: 0; width: 60px; height: 60px; background: transparent; z-index: 999; }

/* AJUSTES PARA CELULAR */
@media (max-width: 768px) {
    .container-white { padding: 25px 15px; }
    
    /* Si son 3 o menos, se vuelve cuadrícula en cel para que quepan */
    .grid-explorador.escalonado { display: flex; flex-wrap: wrap; justify-content: center; gap: 20px; min-height: auto !important; }
    .grid-explorador.escalonado .item-card { position: relative; left: auto !important; top: auto !important; margin: 0; width: 120px; }
    
    /* Modo Lista en celular se ajusta */
    .grid-explorador.modo-lista .item-card { padding: 10px 15px; }
    .grid-explorador.modo-lista .item-titulo { font-size: 1rem; margin-left: 15px; }
    
    .folder-visual { width: 110px; height: 80px; }
    .file-visual { width: 80px; height: 105px; }
    .header-explorador { flex-direction: column; align-items: flex-start; }
    .btn-regresar { width: 100%; }
}