/* ==========================================================================
   ESTILOS GENERALES
   ========================================================================== */
body {
    margin: 0; padding: 0;
    font-family: 'Segoe UI', Arial, sans-serif;
    display: flex; flex-direction: column; min-height: 100vh;
}

/* Encabezado */
header {
    background-color: #003366; color: white;
    padding: 20px; display: flex; flex-wrap: wrap;
    justify-content: space-between; align-items: center; text-align: center;
}
.logo-group img { height: 65px; margin: 0 10px; }
.header-text h1 { font-size: 1.6rem; margin: 0; }

/* Barra de Navegación */
.navbar {
    background-color: #002244;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 50px;
}

.nav-list {
    list-style: none; margin: 0; padding: 0;
    display: flex; gap: 10px; flex-wrap: wrap; justify-content: center;
}

.nav-list > li { position: relative; }

.nav-list a {
    color: white; text-decoration: none; text-transform: uppercase;
    font-size: 0.85rem; font-weight: bold;
    padding: 15px 20px;
    display: block;
    transition: color 0.3s, background 0.3s;
}

.nav-list a:hover { color: #ffcc00; }

/* Submenús */
.submenu, .submenu-nested {
    display: none;
    position: absolute;
    background-color: #ecf0f1;
    min-width: 240px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    z-index: 1001;
    top: 100%;
    left: 0;
    padding: 0;
    list-style: none;
}

.submenu a, .submenu-nested a {
    color: #333;
    padding: 12px 15px;
    border-bottom: 1px solid #ddd;
    text-transform: none;
    font-size: 0.9rem;
}

.submenu a:hover, .submenu-nested a:hover {
    background-color: #d5dbdb;
    color: #003366;
}

.dropdown.show-menu > .submenu { display: block; }
.nested-dropdown.show-menu > .submenu-nested { display: block; left: 100%; top: 0; }
.dropdown > a::after { content: " ▾"; font-size: 10px; }
.nested-dropdown > a::after { content: " ▸"; float: right; }

.menu-toggle { display: none; flex-direction: column; cursor: pointer; padding: 10px; }
.menu-toggle span { width: 25px; height: 3px; background-color: white; margin: 2px 0; transition: 0.4s; }

/* Buscador Vitral */
.search-bar-container {
    background-image: url('img/vitral.jpg');
    background-size: cover;
    background-position: center;
    padding: 45px 15px;
    display: flex;
    justify-content: center;
    border-bottom: 2px solid #003366;
}

.search-form {
    display: flex; width: 100%; max-width: 800px;
    border-radius: 0; overflow: hidden;
    border: 2px solid #003366; box-shadow: 0 4px 15px rgba(0,0,0,0.4);
}

.search-select {
    background-color: #f4f4f4; color: #333;
    border: none; border-right: 1px solid #ccc;
    padding: 10px; font-size: 0.9rem; outline: none; cursor: pointer;
}

.search-input { flex: 1; padding: 12px 15px; border: none; outline: none; font-size: 1rem; min-width: 0; }
.search-button {
    background-color: #003366; color: white; border: none;
    padding: 0 20px; cursor: pointer; font-size: 1.2rem;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.3s; flex-shrink: 0;
}
.search-button:hover { background-color: #004a94; }

/* Barra de Recursos Académicos */
.academic-resources-bar {
    background-color: #f4f4f4;
    padding: 25px 0;
    border-bottom: 1px solid #ddd;
    text-align: center;
}

.resources-grid {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.resource-link {
    text-decoration: none;
    color: #003366;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.3s, color 0.3s;
    width: 140px;
}

.resource-link:hover { transform: translateY(-5px); color: #ffcc00; }

.resource-link i {
    font-size: 1.5rem;
    margin-bottom: 10px;
    background: rgba(0, 51, 102, 0.05);
    color: #003366;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s;
    border: 1px solid rgba(0, 51, 102, 0.2);
}

.resource-link:hover i { background: #003366; color: #ffffff; }
.resource-link span { font-weight: bold; font-size: 0.75rem; text-align: center; line-height: 1.2; }

/* ==========================================================================
   COMPONENTES ESPECÍFICOS (CARRUSELES Y EVENTOS)
   ========================================================================== */

/* Carrusel de Noticias Principal */
.carousel-container {
    width: 100%; height: 400px;
    position: relative; overflow: hidden;
    border-radius: 8px; background: #000;
}
.carousel-container img {
    width: 100%; height: 100%; object-fit: cover;
    position: absolute; opacity: 0; transition: opacity 1s ease-in-out;
}
.carousel-container img.active { opacity: 1; position: relative; }

/* Carrusel Infinito de Eventos */
.events-viewport {
    height: 320px;
    overflow: hidden;
    position: relative;
    margin-top: 10px;
}
#events-slider {
    display: flex;
    flex-direction: column;
    transition: transform 0.8s ease-in-out;
}
.event-item {
    display: flex; align-items: center; 
    margin-bottom: 15px; padding-bottom: 10px; 
    border-bottom: 1px dashed #ccc;
    flex-shrink: 0; min-height: 80px;
}

/* Carrusel de Exposición (Ajuste sin recortes) */
#carrusel-exposicion {
    background-color: #f0f0f0; 
    display: flex;
    align-items: center;
    justify-content: center;
}
#carrusel-exposicion img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important; 
    position: absolute;
}

/* ==========================================================================
   ESTRUCTURA Y SIDEBAR
   ========================================================================== */
.container {
    max-width: 1200px; margin: 30px auto; padding: 0 20px;
    display: grid; grid-template-columns: 2fr 1fr; gap: 40px; flex: 1;
}

.events-exhibitions-wrapper, .featured-services-wrapper { display: grid; gap: 20px; margin-bottom: 30px; }
.events-exhibitions-wrapper { grid-template-columns: 1fr 1fr; }
.featured-services-wrapper { grid-template-columns: repeat(3, 1fr); margin-top: 20px; }

.events-box { background-color: #f9f9f9; border-left: 5px solid #003366; padding: 15px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.event-date { background: #003366; color: white; padding: 8px; text-align: center; min-width: 50px; margin-right: 15px; font-weight: bold; }
.event-date span { display: block; font-size: 0.8rem; text-transform: uppercase; }

.service-box { background: white; border: 1px solid #ddd; overflow: hidden; text-align: center; box-shadow: 0 4px 8px rgba(0,0,0,0.1); transition: transform 0.3s; display: flex; flex-direction: column; }
.service-box:hover { transform: translateY(-5px); }
.service-box h3 { background-color: #003366; color: white; margin: 0; padding: 15px; font-size: 1.1rem; min-height: 50px; display: flex; align-items: center; justify-content: center; }
.service-box img { width: 100%; height: 180px; object-fit: cover; }

.btn-service, .btn-aside { display: inline-block; background-color: #003366; color: white; text-decoration: none; font-weight: bold; transition: background 0.3s; border-radius: 4px; border: none; cursor: pointer; }
.btn-service { padding: 10px 20px; margin: 15px; }
.btn-aside { padding: 12px; width: 100%; box-sizing: border-box; text-align: center; margin-bottom: 10px; }
.btn-service:hover, .btn-aside:hover { background-color: #004a94; }

/* NUEVO REQUERIMIENTO: Cuadro flotante Sidebar */
.service-box-sidebar {
    background: #ffffff; padding: 15px; border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1); border: 1px solid #e0e0e0;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-align: center; margin-bottom: 25px;
}
.service-box-sidebar:hover { box-shadow: 0 6px 12px rgba(0,0,0,0.15); transform: translateY(-5px); }
.service-box-sidebar img { width: 100%; height: auto; border-radius: 4px; margin-bottom: 12px; display: block; }
.service-box-sidebar h4 { margin: 10px 0; color: #003366; font-size: 1.1rem; }
.service-box-sidebar p { font-size: 0.9rem; color: #555; margin-bottom: 15px; line-height: 1.4; }

aside.sidebar { padding: 10px; border-left: 1px solid #eee; }
.info-block { font-size: 0.95rem; line-height: 1.6; color: #333; margin: 15px 0; }
hr { border: 0; border-top: 1px solid #ccc; margin: 20px 0; }

footer { background-color: #003366; color: white; padding: 30px; text-align: center; margin-top: 40px; }
.footer-socials a { color: white; font-size: 1.5rem; margin: 0 15px; text-decoration: none; }

/* ==========================================================================
   RESPONSIVIDAD
   ========================================================================== */
@media (max-width: 850px) {
    header { flex-direction: column; gap: 15px; padding: 15px; }
    header .logo-group {
        order: 1; display: flex; justify-content: center; width: 100%;
    }
    header .logo-group img { height: 50px; margin: 0 8px; }
    header .header-text { order: 2; width: 100%; }

    .container { grid-template-columns: 1fr; }
    .events-exhibitions-wrapper, .featured-services-wrapper { grid-template-columns: 1fr; }
    .resources-grid { gap: 15px; }
    .resource-link { width: 45%; }
    
    .menu-toggle { display: flex; }
    .nav-list {
        display: none; width: 100%; flex-direction: column;
        position: absolute; top: 100%; left: 0; background-color: #002244;
    }
    .nav-list.active { display: flex; }
    .submenu, .submenu-nested { position: static; width: 100%; background-color: #1a252f; box-shadow: none; }
    .submenu a, .submenu-nested a { color: #eee; padding-left: 30px; }
}

/* Estilos de Post/Contenido */
.post-container { max-width: 900px; margin: 40px auto; background: white; padding: 40px; box-shadow: 0 4px 20px rgba(0,0,0,0.1); border-radius: 8px; }
.post-header { border-bottom: 2px solid #003366; margin-bottom: 25px; padding-bottom: 15px; }
.post-title { color: #003366; font-size: 2.2rem; margin: 0; }
.post-content { line-height: 1.8; color: #333; font-size: 1.1rem; text-align: justify; }