/* ==========================================================================
   TEMARIO PAGE - ESTILOS ESPECÍFICOS
   ========================================================================== */

/* --- Fuente Global --- */
body {
    font-family: 'Inter', 'Segoe UI', Roboto, sans-serif;
}

/* ==========================================================================
   HERO DEL TEMARIO
   ========================================================================== */
.temario-hero {
    position: relative;
    min-height: 46vh;
    background: linear-gradient(135deg, var(--color-oscuro) 0%, var(--color-primario) 60%, #1e4a7a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding-top: 80px;
}

.temario-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(163, 178, 191, 0.12) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(255, 255, 255, 0.06) 0%, transparent 50%);
    z-index: 0;
}

.hero-bg-overlay {
    position: absolute;
    inset: 0;
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 60px, rgba(255,255,255,0.02) 60px, rgba(255,255,255,0.02) 61px),
        repeating-linear-gradient(90deg, transparent, transparent 60px, rgba(255,255,255,0.02) 60px, rgba(255,255,255,0.02) 61px);
    z-index: 0;
}

.temario-hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    color: var(--color-claro);
    padding: 3rem 2rem 4rem;
    max-width: 800px;
    margin: 0 auto;
}

.temario-label {
    display: inline-block;
    background: rgba(163, 178, 191, 0.2);
    border: 1px solid rgba(163, 178, 191, 0.4);
    color: var(--color-acento);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 6px 18px;
    border-radius: 20px;
    margin-bottom: 1.2rem;
}

.temario-hero-content h1 {
    font-size: 3.8rem;
    font-weight: 900;
    line-height: 1;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #ffffff 0%, var(--color-acento) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.temario-hero-content p {
    font-size: 1.15rem;
    color: rgba(242, 242, 242, 0.85);
    line-height: 1.7;
    margin-bottom: 2.5rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.temario-hero-content p strong {
    color: var(--color-acento);
    font-weight: 700;
}

.temario-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    flex-wrap: wrap;
}

.tstat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.tstat-num {
    font-size: 2.2rem;
    font-weight: 900;
    color: #ffffff;
    line-height: 1;
}

.tstat-txt {
    font-size: 0.8rem;
    color: var(--color-acento);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hero-wave {
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    z-index: 2;
}

.hero-wave svg {
    width: 100%;
    height: 80px;
    display: block;
}

/* ==========================================================================
   SECCIÓN DE BÚSQUEDA Y FILTROS
   ========================================================================== */
.temario-search-section {
    background: var(--color-claro);
    padding: 2.5rem 5% 0;
    position: sticky;
    top: 60px;
    z-index: 100;
    border-bottom: 1px solid rgba(28, 54, 89, 0.1);
    box-shadow: 0 4px 20px -4px rgba(0,0,0,0.08);
}

.search-container {
    max-width: 1280px;
    margin: 0 auto;
}

/* Search Bar */
.search-bar-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 2px solid rgba(28, 54, 89, 0.15);
    border-radius: 16px;
    overflow: hidden;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}

.search-bar-wrapper:focus-within {
    border-color: var(--color-primario);
    box-shadow: 0 0 0 4px rgba(28, 54, 89, 0.1), 0 4px 16px rgba(0,0,0,0.08);
}

.search-icon {
    padding: 0 1rem 0 1.3rem;
    color: var(--color-secundario);
    display: flex;
    align-items: center;
    pointer-events: none;
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1.05rem;
    font-family: 'Inter', sans-serif;
    color: var(--color-oscuro);
    padding: 1.1rem 0.5rem;
    background: transparent;
    min-width: 0;
}

.search-input::placeholder {
    color: var(--color-acento);
    font-weight: 400;
}

.search-clear {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 1.3rem;
    color: var(--color-secundario);
    display: flex;
    align-items: center;
    transition: color 0.2s;
    flex-shrink: 0;
}

.search-clear:hover {
    color: var(--color-primario);
}

/* Results Info */
.results-info {
    margin: 1rem 0 0.8rem;
    font-size: 0.9rem;
    color: var(--color-secundario);
    font-weight: 500;
    min-height: 1.4em;
}

#results-count {
    transition: opacity 0.2s;
}

/* Filters */
.filters-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-bottom: 1rem;
    flex-wrap: wrap;
}

.filters-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--color-secundario);
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
    flex-shrink: 0;
}

.filters-scroll {
    display: flex;
    gap: 0.5rem;
    flex-wrap: nowrap;
    flex: 1;
    overflow-x: auto;
    padding-bottom: 8px;
    width: 100%;
    max-width: 100%;
}

.filters-scroll::-webkit-scrollbar {
    height: 6px;
}
.filters-scroll::-webkit-scrollbar-track {
    background: transparent;
}
.filters-scroll::-webkit-scrollbar-thumb {
    background: rgba(28, 54, 89, 0.2);
    border-radius: 3px;
}

.filter-btn {
    padding: 7px 18px;
    border-radius: 30px;
    border: 1.5px solid rgba(28, 54, 89, 0.2);
    background: #fff;
    color: var(--color-secundario);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
    font-family: 'Inter', sans-serif;
    flex-shrink: 0;
}

.filter-btn:hover {
    border-color: var(--color-primario);
    color: var(--color-primario);
    background: rgba(28, 54, 89, 0.05);
}

.filter-btn.active {
    background: var(--color-primario);
    color: #fff;
    border-color: var(--color-primario);
    box-shadow: 0 3px 10px rgba(28, 54, 89, 0.3);
}

/* View Toggle */
.view-toggle {
    display: flex;
    gap: 0.4rem;
    margin-left: auto;
    flex-shrink: 0;
    align-self: flex-end;
    margin-bottom: 1rem;
}

.view-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1.5px solid rgba(28, 54, 89, 0.2);
    background: #fff;
    color: var(--color-secundario);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s;
}

.view-btn.active {
    background: var(--color-primario);
    color: #fff;
    border-color: var(--color-primario);
}

.view-btn:hover:not(.active) {
    border-color: var(--color-primario);
    color: var(--color-primario);
}

/* ==========================================================================
   GRID DE PROGRAMAS
   ========================================================================== */
.temario-grid-section {
    background: var(--color-claro);
    padding: 2.5rem 5% 5rem;
    min-height: 60vh;
}

.temario-container {
    max-width: 1280px;
    margin: 0 auto;
}

/* Grid View */
.programs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.5rem;
    transition: all 0.3s ease;
}

/* List View */
.programs-grid.list-view {
    grid-template-columns: 1fr;
    gap: 1rem;
}

/* Category Group Header */
.category-group-header {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 2rem 0 0.5rem;
    padding-bottom: 0.8rem;
    border-bottom: 2px solid rgba(28, 54, 89, 0.12);
}

.category-group-header:first-child {
    margin-top: 0;
}

.category-group-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.category-group-name {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--color-primario);
    flex: 1;
}

.category-group-count {
    background: rgba(28, 54, 89, 0.08);
    color: var(--color-secundario);
    font-size: 0.78rem;
    font-weight: 700;
    padding: 3px 12px;
    border-radius: 20px;
}

/* Program Card */
.program-card {
    background: #ffffff;
    border-radius: 18px;
    border: 1px solid rgba(28, 54, 89, 0.08);
    box-shadow: 0 4px 20px -4px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative;
}

.program-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 40px -8px rgba(0, 0, 0, 0.12);
    border-color: rgba(28, 54, 89, 0.2);
}

.program-card-accent {
    height: 4px;
    width: 100%;
    flex-shrink: 0;
}

.program-card-body {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.program-card-category {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 0.6rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.program-card-category::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.program-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-oscuro);
    line-height: 1.4;
    margin-bottom: 0.8rem;
    flex: 1;
}

.program-card-preview {
    font-size: 0.82rem;
    color: var(--color-secundario);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 1rem;
}

.program-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    margin-top: auto;
}

.program-modules-count {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--color-secundario);
    font-weight: 500;
}

.btn-ver-temario {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--color-primario);
    background: rgba(28, 54, 89, 0.07);
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Inter', sans-serif;
}

.btn-ver-temario:hover {
    background: var(--color-primario);
    color: #fff;
}

/* List View Card Overrides */
.programs-grid.list-view .program-card {
    flex-direction: row;
    border-radius: 14px;
}

.programs-grid.list-view .program-card-accent {
    width: 5px;
    height: auto;
    flex-shrink: 0;
}

.programs-grid.list-view .program-card-body {
    flex-direction: row;
    align-items: center;
    gap: 1.5rem;
    padding: 1.2rem 1.5rem;
}

.programs-grid.list-view .program-card-title {
    font-size: 0.95rem;
    margin-bottom: 0;
    flex: 1;
    min-width: 0;
}

.programs-grid.list-view .program-card-category {
    margin-bottom: 0;
    white-space: nowrap;
    min-width: 160px;
    font-size: 0.7rem;
}

.programs-grid.list-view .program-card-preview {
    display: none;
}

.programs-grid.list-view .program-card-footer {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
    gap: 1rem;
}

.programs-grid.list-view .category-group-header {
    margin-top: 1.5rem;
}

/* Highlighted search terms */
.highlight {
    background: rgba(163, 178, 191, 0.4);
    color: var(--color-primario);
    font-weight: 700;
    border-radius: 3px;
    padding: 0 2px;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 6rem 2rem;
}

.no-results-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    filter: grayscale(0.3);
}

.no-results h3 {
    font-size: 1.6rem;
    color: var(--color-primario);
    font-weight: 800;
    margin-bottom: 0.8rem;
}

.no-results p {
    color: var(--color-secundario);
    font-size: 1rem;
    margin-bottom: 2rem;
}

.btn-reset {
    background: var(--color-primario);
    color: #fff;
    border: none;
    padding: 0.9rem 2rem;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
}

.btn-reset:hover {
    background: var(--color-oscuro);
    transform: translateY(-2px);
}

/* ==========================================================================
   MODAL DE PROGRAMA
   ========================================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(16, 30, 38, 0.75);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    backdrop-filter: blur(6px);
    animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-box {
    background: #ffffff;
    border-radius: 24px;
    max-width: 680px;
    width: 100%;
    max-height: 88vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Custom Scrollbar */
.modal-box::-webkit-scrollbar { width: 6px; }
.modal-box::-webkit-scrollbar-track { background: #f0f0f0; }
.modal-box::-webkit-scrollbar-thumb { background: var(--color-acento); border-radius: 3px; }

.modal-close {
    position: absolute;
    top: 1.2rem;
    right: 1.2rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1.5px solid rgba(28, 54, 89, 0.15);
    background: rgba(242, 242, 242, 0.8);
    color: var(--color-secundario);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 1;
}

.modal-close:hover {
    background: var(--color-primario);
    color: #fff;
    border-color: var(--color-primario);
    transform: scale(1.05);
}

.modal-header {
    padding: 2.5rem 2.5rem 1.5rem;
    border-bottom: 1px solid rgba(28, 54, 89, 0.1);
    background: linear-gradient(135deg, rgba(28, 54, 89, 0.03) 0%, rgba(163, 178, 191, 0.05) 100%);
}

.modal-category-tag {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--color-primario);
    background: rgba(28, 54, 89, 0.1);
    padding: 5px 14px;
    border-radius: 20px;
    margin-bottom: 1rem;
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--color-oscuro);
    line-height: 1.3;
    margin-bottom: 0.6rem;
    padding-right: 2.5rem;
}

.modal-subtitle {
    font-size: 0.9rem;
    color: var(--color-secundario);
    line-height: 1.5;
}

.modal-body {
    padding: 2rem 2.5rem;
    flex: 1;
}

.modulos-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-primario);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modulos-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    counter-reset: modulo-counter;
}

.modulos-list li {
    counter-increment: modulo-counter;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.9rem 1.2rem;
    background: rgba(242, 242, 242, 0.7);
    border-radius: 12px;
    font-size: 0.92rem;
    color: var(--color-oscuro);
    line-height: 1.5;
    border: 1px solid rgba(28, 54, 89, 0.06);
    transition: background 0.2s;
}

.modulos-list li:hover {
    background: rgba(28, 54, 89, 0.06);
}

.modulos-list li::before {
    content: counter(modulo-counter);
    min-width: 28px;
    height: 28px;
    background: var(--color-primario);
    color: #fff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    flex-shrink: 0;
}

.modal-footer {
    padding: 1.5rem 2.5rem 2rem;
    border-top: 1px solid rgba(28, 54, 89, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    background: rgba(242, 242, 242, 0.5);
    flex-wrap: wrap;
}

.btn-inscribirse {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
    color: #fff;
    text-decoration: none;
    padding: 0.9rem 2rem;
    border-radius: 30px;
    font-weight: 700;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.3);
}

.btn-inscribirse:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(37, 211, 102, 0.4);
}

.modal-creditos {
    font-size: 0.82rem;
    color: var(--color-secundario);
    font-weight: 500;
}

/* ==========================================================================
   COLORES POR CATEGORÍA
   ========================================================================== */
:root {
    --cat-salud: #0d9488;
    --cat-educacion: #2563eb;
    --cat-derecho: #7c3aed;
    --cat-finanzas: #d97706;
    --cat-ingenieria: #dc2626;
    --cat-administracion: #059669;
    --cat-tecnico: #9333ea;
    --cat-turismo: #0891b2;
    --cat-otros: #475569;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 992px) {
    .temario-hero-content h1 { font-size: 3rem; }
    .temario-stats { gap: 2rem; }
    .programs-grid { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
    .temario-search-section { top: 60px; }
}

@media (max-width: 768px) {
    .temario-hero { min-height: 55vh; }
    .temario-hero-content h1 { font-size: 2.4rem; }
    .temario-hero-content p { font-size: 1rem; }
    .tstat-num { font-size: 1.8rem; }
    .temario-search-section { position: relative; top: 0; padding: 1.5rem 4% 0; }
    .filters-wrapper { flex-direction: column; align-items: flex-start; }
    .view-toggle { align-self: auto; margin-bottom: 0; margin-top: -0.5rem; }
    .programs-grid { grid-template-columns: 1fr; }
    .programs-grid.list-view .program-card-body {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.8rem;
    }
    .programs-grid.list-view .program-card-category {
        min-width: auto;
        width: 100%;
    }
    .programs-grid.list-view .program-card-footer {
        width: 100%;
    }
    .temario-grid-section { padding: 1.5rem 4% 4rem; }
    .modal-header { padding: 2rem 1.5rem 1.2rem; }
    .modal-body { padding: 1.5rem; }
    .modal-footer { padding: 1.2rem 1.5rem 1.5rem; flex-direction: column; align-items: stretch; }
    .btn-inscribirse { justify-content: center; }
    .modal-header h2 { font-size: 1.25rem; }
}

@media (max-width: 480px) {
    .temario-hero-content h1 { font-size: 2rem; }
    .temario-stats { gap: 1.5rem; }
    .tstat-num { font-size: 1.5rem; }
    .tstat-txt { font-size: 0.7rem; }
    .temario-hero { padding-top: 70px; }
}

/* ==========================================================================
   LOADING ANIMATION
   ========================================================================== */
@keyframes cardFadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.program-card {
    animation: cardFadeIn 0.4s ease forwards;
}

.program-card:nth-child(1) { animation-delay: 0.02s; }
.program-card:nth-child(2) { animation-delay: 0.04s; }
.program-card:nth-child(3) { animation-delay: 0.06s; }
.program-card:nth-child(4) { animation-delay: 0.08s; }
.program-card:nth-child(5) { animation-delay: 0.10s; }
.program-card:nth-child(6) { animation-delay: 0.12s; }
