/* UCentral Educación Continua — La Serena
   Réplica de educacioncontinua.ucentral.cl */

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: #000;
    background: #fff;
    line-height: 1.6;
    font-size: 16px;
}

a { text-decoration: underline; color: inherit; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ====== HEADER ====== */
.site-header {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
    background: #2f3b73;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.header-inner {
    max-width: 1200px; margin: 0 auto; padding: 0 20px;
    display: flex; align-items: center; justify-content: space-between;
    height: 70px;
}

.header-logo img { height: 45px; width: auto; }

.header-nav ul {
    list-style: none; display: flex; gap: 0; align-items: center;
}
.header-nav > ul > li { position: relative; }
.header-nav > ul > li > a {
    display: block; padding: 24px 18px;
    text-decoration: none; color: #fff;
    font-size: 14px; font-weight: 400; transition: opacity 0.2s;
}
.header-nav > ul > li > a:hover { opacity: 0.8; }

.has-submenu .submenu {
    display: none; position: absolute; top: 100%; left: 0;
    background: #fff; min-width: 320px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12); list-style: none; z-index: 100;
}
.has-submenu:hover .submenu { display: block; }
.submenu li a {
    display: block; padding: 12px 20px; text-decoration: none;
    color: #333; font-size: 14px; border-bottom: 1px solid #f0f0f0;
}
.submenu li a:hover { background: #f5f5f5; color: #2f3b73; }

.menu-toggle {
    display: none; flex-direction: column; gap: 5px;
    background: none; border: none; cursor: pointer; padding: 8px;
}
.menu-toggle span { display: block; width: 26px; height: 3px; background: #fff; border-radius: 2px; }

.nav-close {
    display: none;
    position: absolute; top: 16px; right: 16px;
    background: none; border: none;
    color: #fff; font-size: 36px;
    cursor: pointer; line-height: 1;
    width: 44px; height: 44px;
    align-items: center; justify-content: center;
}

/* ====== HERO CARRUSEL ====== */
.hero-carousel {
    margin-top: 70px;
    position: relative;
    overflow: hidden;
    background: #1a1a2e;
    max-height: 420px;
}

.carousel-track {
    position: relative;
    width: 100%;
    height: 420px;
}

.carousel-slide {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.carousel-slide.active {
    opacity: 1;
}

.carousel-slide img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}

.slide-overlay {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 40px 50px;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: #fff;
}

.slide-overlay h2 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 6px;
    text-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.slide-overlay p {
    font-size: 16px;
    opacity: 0.9;
    text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.carousel-btn {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    background: rgba(255,255,255,0.2);
    border: none; color: #fff;
    font-size: 28px; width: 48px; height: 48px;
    border-radius: 50%; cursor: pointer;
    transition: background 0.2s;
    backdrop-filter: blur(4px);
}

.carousel-btn:hover { background: rgba(255,255,255,0.4); }
.carousel-btn.prev { left: 16px; }
.carousel-btn.next { right: 16px; }

.carousel-dots {
    position: absolute;
    bottom: 16px; left: 50%;
    transform: translateX(-50%);
    display: flex; gap: 10px;
}

.dot {
    width: 12px; height: 12px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    cursor: pointer;
    transition: background 0.2s;
}

.dot.active { background: #fff; }

/* ====== FILTROS ====== */
.filtros-section {
    padding: 32px 0 0;
    background: #fff;
}

.section-title {
    font-size: 28px;
    font-weight: 700;
    color: #2f3b73;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.sede-badge {
    font-size: 13px;
    font-weight: 600;
    background: #2f3b73;
    color: #fff;
    padding: 4px 14px;
    border-radius: 20px;
}

.filtros-bar {
    display: flex; gap: 12px; flex-wrap: wrap;
    margin-bottom: 16px;
}

.filtro-item { flex: 1; min-width: 180px; }

.filtro-item input,
.filtro-item select {
    width: 100%; padding: 10px 14px;
    border: 2px solid #e0e0e0; border-radius: 6px;
    font-size: 14px; font-family: inherit; color: #333;
    background: #fff; transition: border-color 0.2s;
}
.filtro-item input:focus,
.filtro-item select:focus {
    outline: none; border-color: #2f3b73;
    box-shadow: 0 0 0 3px rgba(47,59,115,0.1);
}

.resultados-info {
    font-size: 14px; color: #888; margin-bottom: 8px;
}

/* ====== PROGRAMAS GRID ====== */
.programas-section {
    padding: 16px 0 60px;
    background: #fff;
}

.programas-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

/* CARD */
.programa-card {
    border-radius: 10px; overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer; display: flex; flex-direction: column;
    background: #fff;
}
.programa-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.card-image {
    width: 100%; height: 160px;
    background-size: cover; background-position: center;
    position: relative;
}
.card-image::after {
    content: ''; position: absolute; bottom: 0; left: 0; right: 0;
    height: 50%; background: linear-gradient(transparent, rgba(0,0,0,0.45));
}

.card-modalidad-badge {
    position: absolute; top: 10px; left: 10px;
    padding: 3px 10px; border-radius: 4px;
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    z-index: 1; color: #fff;
}
.card-modalidad-badge.online { background: #2f57a4; }
.card-modalidad-badge.semipresencial { background: #e07800; }
.card-modalidad-badge.presencial { background: #00a651; }
.card-modalidad-badge.online-sincronico { background: #7b2d8e; }

.card-ubicacion {
    position: absolute; bottom: 8px; left: 10px;
    font-size: 11px; color: #fff; font-weight: 500; z-index: 1;
}

.card-info {
    padding: 14px; flex: 1;
    display: flex; flex-direction: column;
}

.card-tipo {
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    color: #2f57a4; margin-bottom: 4px; letter-spacing: 0.3px;
}

.card-titulo {
    font-size: 14px; font-weight: 600; color: #000;
    line-height: 1.3; margin-bottom: 10px; flex: 1;
}

.card-mas-info {
    display: inline-block; color: #2f57a4;
    font-size: 13px; font-weight: 600; text-decoration: underline;
    margin-bottom: 8px;
}

.card-fecha {
    font-size: 12px; color: #666;
    padding-top: 8px; border-top: 1px solid #eee;
}
.card-fecha strong { color: #333; }

.no-resultados {
    text-align: center; padding: 60px 20px; color: #888;
}
.no-resultados button {
    margin-top: 16px; padding: 10px 28px;
    background: #2f3b73; color: #fff;
    border: none; border-radius: 6px; cursor: pointer; font-weight: 500;
}

/* ====== BANNER SECUNDARIO ====== */
.banner-secondary {
    background: #fff;
    overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.banner-secondary img {
    width: 100%; max-width: 700px;
    height: auto; display: block;
}

/* ====== MODAL ====== */
.modal {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    z-index: 2000; display: flex; align-items: center;
    justify-content: center; padding: 20px;
}
.modal-overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
}
.modal-content {
    position: relative; background: #fff; border-radius: 10px;
    max-width: 720px; width: 100%; max-height: 90vh;
    overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-close {
    position: absolute; top: 12px; right: 12px;
    width: 36px; height: 36px; border-radius: 50%;
    border: none; background: rgba(255,255,255,0.9);
    font-size: 24px; cursor: pointer; z-index: 1; color: #333;
    display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: #f0f0f0; }

.modal-hero {
    width: 100%; height: 200px;
    background-size: cover; background-position: center;
    position: relative;
}
.modal-hero::after {
    content: ''; position: absolute; bottom: 0; left: 0; right: 0;
    height: 50%; background: linear-gradient(transparent, rgba(0,0,0,0.5));
}
.modal-hero-text {
    position: absolute; bottom: 16px; left: 24px; z-index: 1;
}
.modal-hero-text .card-modalidad-badge { position: static; display: inline-block; }

.modal-body-inner { padding: 24px; }
.modal-body-inner h2 { font-size: 22px; font-weight: 700; color: #2f3b73; margin-bottom: 4px; }
.modal-body-inner .modal-facultad { font-size: 13px; color: #888; margin-bottom: 16px; }
.modal-body-inner .modal-desc { font-size: 15px; line-height: 1.7; color: #333; margin-bottom: 20px; }
.modal-body-inner .modal-dirigido {
    font-size: 13px; color: #666; margin-bottom: 20px;
    padding: 12px 16px; background: #f9f9f9; border-radius: 6px;
}
.modal-body-inner .modal-dirigido strong { color: #333; }

.modal-info-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 12px; margin-bottom: 20px;
}
.modal-info-item { background: #f5f5f5; padding: 14px; border-radius: 6px; }
.modal-info-item label {
    display: block; font-size: 11px; font-weight: 600;
    text-transform: uppercase; color: #888; margin-bottom: 4px;
}
.modal-info-item span { font-size: 14px; font-weight: 600; color: #000; }

.modal-modulos { margin-bottom: 20px; }
.modal-modulos h4 {
    font-size: 13px; font-weight: 600; text-transform: uppercase;
    color: #888; margin-bottom: 10px;
}
.modal-modulos ul { list-style: none; counter-reset: modulo; }
.modal-modulos li {
    padding: 8px 0 8px 32px; position: relative;
    font-size: 14px; color: #333; border-bottom: 1px solid #f0f0f0;
    counter-increment: modulo;
}
.modal-modulos li:last-child { border-bottom: none; }
.modal-modulos li::before {
    content: counter(modulo); position: absolute; left: 0; top: 8px;
    width: 22px; height: 22px; border-radius: 50%;
    background: #2f3b73; color: #fff;
    font-size: 11px; font-weight: 600;
    display: flex; align-items: center; justify-content: center;
}

.modal-footer {
    padding: 20px 24px; background: #f5f5f5;
    border-top: 1px solid #e5e5e5;
    display: flex; gap: 12px;
}
.modal-btn {
    flex: 1; padding: 14px; text-align: center; text-decoration: none;
    border-radius: 6px; font-weight: 600; font-size: 14px;
    border: none; cursor: pointer; display: block;
}
.modal-btn-primary { background: #2f3b73; color: #fff; }
.modal-btn-primary:hover { background: #252e5e; }
.modal-btn-whatsapp { background: #25d366; color: #fff; }
.modal-btn-whatsapp:hover { background: #1da851; }

/* ====== CONTACTO ====== */
.contacto-section {
    padding: 50px 0; background: #f7f7f7;
    border-top: 1px solid #e5e5e5;
}
.contacto-grid {
    display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 40px;
}
.contacto-col h3 { font-size: 18px; font-weight: 700; color: #2f3b73; margin-bottom: 10px; }
.contacto-col p { font-size: 14px; color: #555; margin-bottom: 6px; }
.contacto-col a { color: #2f57a4; }

.btn-whatsapp {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 14px 28px; background: #25d366; color: #fff;
    text-decoration: none; border-radius: 6px;
    font-weight: 600; font-size: 15px; margin-top: 8px;
}
.btn-whatsapp:hover { background: #1da851; color: #fff; }

/* ====== FOOTER ====== */
.site-footer {
    background: #1a1a2e; color: rgba(255,255,255,0.7); padding: 48px 0 0;
}
.footer-grid {
    display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr;
    gap: 40px; padding-bottom: 40px;
}
.footer-brand img { height: 55px; width: auto; margin-bottom: 12px; }
.footer-col h4 { color: #fff; font-size: 14px; font-weight: 600; margin-bottom: 14px; }
.footer-col p { font-size: 13px; margin-bottom: 6px; }
.footer-social { display: flex; flex-direction: column; gap: 8px; }
.footer-social a { color: rgba(255,255,255,0.7); text-decoration: none; font-size: 13px; }
.footer-social a:hover { color: #fff; }

.footer-sellos {
    display: flex; align-items: center; justify-content: center;
    gap: 32px; padding: 32px 0;
    border-top: 1px solid rgba(255,255,255,0.1);
}
.footer-sellos img { height: 50px; width: auto; opacity: 0.8; }

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 20px 0; text-align: center; font-size: 13px;
}

/* ====== RESPONSIVE ====== */
@media (max-width: 1024px) {
    .programas-grid { grid-template-columns: repeat(3, 1fr); }
    .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
}

@media (max-width: 768px) {
    /* HEADER MOBILE */
    .header-inner { height: 60px; }
    .header-logo img { height: 38px; }
    .menu-toggle { display: flex; }

    .header-nav {
        display: none;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(47,59,115,0.98);
        z-index: 999;
        padding-top: 70px;
        overflow-y: auto;
    }
    .header-nav.active { display: block; }
    .nav-close { display: flex; }
    .header-nav ul { flex-direction: column; padding: 0; }
    .header-nav > ul > li > a {
        padding: 16px 24px;
        font-size: 18px;
        font-weight: 500;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    .has-submenu .submenu {
        position: static;
        box-shadow: none;
        display: none;
        min-width: 100%;
        background: rgba(0,0,0,0.15);
    }
    .has-submenu.open .submenu { display: block; }
    .submenu li a {
        color: rgba(255,255,255,0.8);
        background: transparent;
        padding: 12px 24px 12px 40px;
        font-size: 15px;
        border-bottom-color: rgba(255,255,255,0.05);
    }
    .submenu li a:hover { background: rgba(255,255,255,0.1); color: #fff; }

    /* HERO CARRUSEL MOBILE */
    .hero-carousel { margin-top: 60px; max-height: 240px; }
    .carousel-track { height: 240px; }
    .slide-overlay { padding: 16px 20px; }
    .slide-overlay h2 { font-size: 18px; margin-bottom: 4px; }
    .slide-overlay p { font-size: 13px; }
    .carousel-btn { width: 32px; height: 32px; font-size: 18px; }
    .carousel-btn.prev { left: 8px; }
    .carousel-btn.next { right: 8px; }
    .carousel-dots { bottom: 10px; gap: 8px; }
    .dot { width: 10px; height: 10px; }

    /* FILTROS MOBILE */
    .filtros-section { padding: 20px 0 0; }
    .section-title { font-size: 20px; flex-direction: column; align-items: flex-start; gap: 8px; }
    .sede-badge { font-size: 11px; }
    .filtros-bar { flex-direction: column; gap: 10px; }
    .filtro-item { min-width: 100%; }
    .filtro-item input,
    .filtro-item select { padding: 12px 14px; font-size: 16px; }

    /* GRID MOBILE */
    .programas-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .card-image { height: 130px; }
    .card-modalidad-badge { font-size: 9px; padding: 2px 6px; top: 6px; left: 6px; }
    .card-ubicacion { font-size: 10px; bottom: 6px; left: 6px; }
    .card-info { padding: 10px; }
    .card-tipo { font-size: 10px; }
    .card-titulo { font-size: 13px; margin-bottom: 6px; }
    .card-mas-info { font-size: 12px; margin-bottom: 6px; }
    .card-fecha { font-size: 11px; padding-top: 6px; }

    /* MODAL MOBILE */
    .modal { padding: 0; align-items: flex-end; }
    .modal-content {
        max-height: 95vh;
        border-radius: 16px 16px 0 0;
        max-width: 100%;
    }
    .modal-hero { height: 180px; }
    .modal-body-inner { padding: 16px; }
    .modal-body-inner h2 { font-size: 18px; }
    .modal-info-grid { grid-template-columns: 1fr; gap: 8px; }
    .modal-info-item { padding: 10px 12px; }
    .modal-footer { flex-direction: column; padding: 16px; gap: 10px; }
    .modal-btn { padding: 12px; }

    /* BANNER SECUNDARIO */
    .banner-secondary { padding: 12px; }
    .banner-secondary img { max-width: 100%; }

    /* CONTACTO MOBILE */
    .contacto-section { padding: 32px 0; }
    .contacto-grid { grid-template-columns: 1fr; gap: 20px; }
    .contacto-col h3 { font-size: 16px; }
    .btn-whatsapp { width: 100%; justify-content: center; padding: 14px; font-size: 16px; }

    /* FOOTER MOBILE */
    .footer-grid { grid-template-columns: 1fr; gap: 20px; }
    .footer-brand img { height: 45px; }
    .footer-sellos { flex-wrap: wrap; gap: 16px; padding: 24px 0; }
    .footer-sellos img { height: 40px; }
}

@media (max-width: 480px) {
    .programas-grid { grid-template-columns: 1fr; }
    .card-image { height: 180px; }
    .card-modalidad-badge { font-size: 10px; padding: 3px 8px; }
    .card-info { padding: 14px; }
    .card-titulo { font-size: 15px; }

    .hero-carousel { max-height: 200px; }
    .carousel-track { height: 200px; }
    .slide-overlay h2 { font-size: 16px; }
    .slide-overlay p { font-size: 12px; }
}
