/* assets/css/main.css */

:root {
    --primary-color: #D32F2F; /* Rojo Institucional */
    --secondary-color: #1A237E; /* Azul oscuro complementario */
    --text-color: #333333;
    --bg-light: #f4f4f4;
    --white: #ffffff;
    --max-width: 1200px;
    --header-height: 80px;
    --font-main: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Reset Básico */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    color: var(--text-color);
    line-height: 1.6;
    background-color: var(--bg-light);
    padding-top: var(--header-height); /* Espacio para header fijo */
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; height: auto; display: block; }

/* Contenedor Central */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* HEADER */
.main-header {
    background-color: var(--white);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    width: 100%;
    height: var(--header-height);
    z-index: 1000;
    display: flex;
    align-items: center;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.main-nav ul {
    display: flex;
    gap: 20px;
}

.main-nav a {
    font-weight: 500;
    transition: color 0.3s;
}

.main-nav a:hover, .main-nav a.active {
    color: var(--primary-color);
}

/* Botón Inscríbete destacado */
.btn-cta {
    background-color: var(--primary-color);
    color: var(--white) !important;
    padding: 10px 20px;
    border-radius: 5px;
    font-weight: bold;
}

.btn-cta:hover {
    background-color: #b71c1c;
}

/* BUSCADOR HEADER */
.header-search {
    display: flex;
    align-items: center;
    background-color: var(--bg-light);
    border-radius: 20px;
    padding: 5px 15px;
    margin-left: 15px;
    border: 1px solid #ddd;
}

.header-search input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.9rem;
    width: 120px;
    color: var(--text-color);
}

.header-search button { border: none; background: transparent; cursor: pointer; }

/* Dropdown Menu */
.main-nav li {
    position: relative;
}

.main-nav .dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--white);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    min-width: 220px;
    flex-direction: column;
    gap: 0;
    padding: 10px 0;
    border-radius: 4px;
    z-index: 1001;
}

.main-nav li:hover .dropdown-menu {
    display: flex;
}

.main-nav .dropdown-menu li {
    width: 100%;
}

.main-nav .dropdown-menu a {
    display: block;
    padding: 10px 20px;
    color: var(--text-color);
    font-size: 0.95rem;
    white-space: nowrap;
    font-weight: normal;
}

.main-nav .dropdown-menu a:hover {
    background-color: var(--bg-light);
    color: var(--primary-color);
}

/* Botón Menú Móvil */
.mobile-toggle {
    display: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--primary-color);
}

/* FOOTER */
.main-footer {
    background-color: #222;
    color: #ccc;
    padding: 40px 0;
    margin-top: 50px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.footer-col h3 {
    color: var(--white);
    margin-bottom: 15px;
    border-bottom: 2px solid var(--primary-color);
    display: inline-block;
}

.social-icons {
    display: flex;
    gap: 15px;
    margin-top: 15px;
}

.social-icons a {
    font-size: 1.5rem;
    color: #ccc;
    text-decoration: none;
    transition: color 0.3s, transform 0.3s;
}

.social-icons a:hover {
    color: var(--primary-color);
    transform: translateY(-3px);
}

.newsletter-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.newsletter-form input {
    padding: 10px;
    border-radius: 4px;
    border: none;
    outline: none;
    font-family: inherit;
}

.newsletter-form button {
    padding: 10px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
}

.newsletter-form button:hover {
    background-color: #b71c1c;
}

.footer-col ul li {
    margin-bottom: 8px;
}

.footer-col ul li a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Responsive Mobile */
@media (max-width: 768px) {
    .mobile-toggle {
        display: block;
    }

    .main-nav {
        display: none;
        position: absolute;
        top: 100%; /* Justo debajo del header */
        left: 0;
        width: 100%;
        background-color: var(--white);
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
        padding: 20px 0;
        border-top: 1px solid #eee;
    }

    .main-nav.active {
        display: block;
    }

    .main-nav ul {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }
    
    .header-search {
        display: none; /* Ocultar en móvil para simplificar layout */
    }

    .main-nav .dropdown-menu {
        position: static;
        box-shadow: none;
        background-color: #f9f9f9;
        width: 100%;
        text-align: center;
    }
}

/* SLIDER HOME */
.hero-slider-container {
    position: relative;
    width: 100%;
    height: 500px; /* Altura del slider */
    overflow: hidden;
    background-color: #ddd;
}

.hero-slider {
    width: 100%;
    height: 100%;
    position: relative;
}

.slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
    display: flex;
    align-items: center;
}

.slide.active {
    opacity: 1;
    z-index: 1;
}

.slide::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4); /* Oscurecer imagen para leer texto */
}

.slide-content {
    position: relative;
    z-index: 2;
    width: 100%;
    color: var(--white);
}

.slide-content h2 {
    font-size: 3rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.6);
}

.slide-content p {
    font-size: 1.5rem;
    margin-bottom: 20px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.6);
}

.slider-prev, .slider-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.3);
    color: white;
    border: none;
    padding: 15px;
    cursor: pointer;
    z-index: 10;
    font-size: 1.5rem;
    transition: background 0.3s;
}

.slider-prev:hover, .slider-next:hover {
    background: var(--primary-color);
}

.slider-prev { left: 0; border-radius: 0 5px 5px 0; }
.slider-next { right: 0; border-radius: 5px 0 0 5px; }

/* ACCESOS RÁPIDOS */
.quick-access {
    background-color: var(--secondary-color);
    padding: 20px 0;
    color: white;
}

.access-grid {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 20px;
}

.access-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    transition: opacity 0.3s;
}

.access-item:hover { opacity: 0.8; }

@media (max-width: 768px) {
    .hero-slider-container { height: 300px; }
    .slide-content h2 { font-size: 1.8rem; }
    .slide-content p { font-size: 1rem; }
    .access-grid { flex-direction: column; align-items: center; }
}

/* POPUP */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.popup-overlay.show {
    opacity: 1;
    visibility: visible;
}

.popup-content {
    position: relative;
    max-width: 600px;
    width: 90%;
    background: white;
    padding: 0;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.popup-content img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

.popup-close {
    position: absolute;
    top: -15px;
    right: -15px;
    background: var(--primary-color);
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* ACCORDION FAQ */
.accordion {
    max-width: 800px;
    margin: 0 auto;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.accordion-item {
    border-bottom: 1px solid #eee;
}

.accordion-item:last-child {
    border-bottom: none;
}

.accordion-header {
    width: 100%;
    background: #fff;
    border: none;
    padding: 20px;
    text-align: left;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--secondary-color);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s;
}

.accordion-header:hover {
    background: #f9f9f9;
}

.accordion-header .icon {
    font-size: 1.5rem;
    color: var(--primary-color);
    transition: transform 0.3s;
}

.accordion-header.active {
    background: #f0f0f0;
}

.accordion-header.active .icon {
    transform: rotate(45deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background: #fff;
}

.accordion-body {
    padding: 20px;
    color: #555;
    line-height: 1.6;
    border-top: 1px solid #eee;
}

/* TESTIMONIOS */
.testimonials-section {
    background-color: var(--primary-color);
    color: white;
    padding: 60px 0;
    text-align: center;
}

.testimonial-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.testimonial-card {
    background: white;
    color: var(--text-color);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    position: relative;
}

.testimonial-card img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 15px;
    border: 3px solid var(--secondary-color);
}

.testimonial-text {
    font-style: italic;
    margin-bottom: 20px;
    font-size: 1rem;
}

.testimonial-author {
    font-weight: bold;
    color: var(--secondary-color);
}

.testimonial-career {
    font-size: 0.85rem;
    color: #666;
}

/* CALENDARIO */
.calendar-container {
    max-width: 900px;
    margin: 0 auto;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--secondary-color);
    color: white;
    text-align: center;
    padding: 10px 0;
    font-weight: bold;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #eee;
    gap: 1px;
}

.calendar-day {
    background: #fff;
    min-height: 100px;
    padding: 5px;
    position: relative;
}

.calendar-day.empty { background: #f9f9f9; }
.calendar-day.today { background: #e3f2fd; }

.day-number {
    font-weight: bold;
    color: #666;
    display: block;
    margin-bottom: 5px;
}

.event-badge {
    color: white;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 0.75rem;
    margin-bottom: 2px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* LANDING PAGE (Inscríbete) */
.landing-section {
    background-color: var(--primary-color);
    color: white;
    padding: 60px 20px;
    border-radius: 8px;
    margin-bottom: 40px;
}
.landing-form {
    background-color: white;
    color: var(--text-color);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
.landing-title {
    font-size: 2.5rem;
    margin-bottom: 20px;
    font-weight: 700;
}
.form-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

/* NOTICIA DETALLE */
.noticia-contenido {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #333;
}

/* Docentes CV Link */
.docente-cv-link {
    text-decoration: none;
    color: inherit;
    position: relative;
    cursor: pointer;
}

.docente-cv-link:hover {
    text-decoration: underline;
    color: var(--secondary-color);
}

/* Docente Name Hover */
.docente-name {
    color: var(--secondary-color);
    font-size: 1.1rem;
    margin-bottom: 5px;
    padding: 0 10px;
    cursor: pointer;
    transition: color 0.3s;
}

.docente-name:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Convenios Card */
.convenio-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.convenio-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.1);
}

/* Animación Fade In para elementos cargados vía AJAX */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.6s ease-out both;
}

/* Spinner de Carga */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
    display: none;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Back to Top Button */
#back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#back-to-top.show {
    opacity: 1;
    visibility: visible;
}

#back-to-top:hover {
    background-color: var(--secondary-color);
    transform: translateY(-5px);
}
