/* ========================================
   RECURSOS HUB - FILTROS Y RESULTADOS
   CLASES ÚNICAS PARA NO AFECTAR OTROS SLIDERS
   ======================================== */

:root {
    --hub-primary: #0097E0;
    --hub-secondary: #54C3F1;
    --hub-accent: #54C3F1;
    --hub-gray: #f5f7fa;
    --hub-border: #e0e6ed;
    --hub-text: #333;
    --hub-text-light: #666;
    --hub-radius: 8px;
    --hub-shadow: 0 4px 12px rgba(0,0,0,0.08);
    --hub-shadow-hover: 0 8px 24px rgba(0,0,0,0.12);
}

/* ========== FILTROS WRAPPER ========== */
.hub-filtros-wrapper {
    background: white;
    padding: 30px;
    border-radius: var(--hub-radius);
    box-shadow: var(--hub-shadow);
    margin-bottom: 40px;
    position: sticky;
    top: 100px;
}

.hub-filtros-header {
    text-align: center;
    margin-bottom: 25px;
}

.hub-filtros-header h2 {
    color: var(--hub-primary);
    font-size: 28px;
    margin: 0 0 10px;
    font-weight: 700;
}

.hub-filtros-hint {
    color: var(--hub-text-light);
    font-size: 14px;
    margin: 0;
}

/* ========== SWITCH TIPO (CHIPS) ========== */
.hub-switch-tipo {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.switch-btn {
    border: none;
    background: #edf2fa;
    color: #0b1d3a;
    border-radius: 24px;
    padding: 12px 32px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    transition: background .2s, color .2s;
}

.switch-btn.active {
    background: #0b1d3a;
    color: #fff;
}

.switch-btn:hover {
    background: #1a2d4a;
    color: #fff;
}

.switch-btn:focus { 
    outline: 2px solid #00b4d8; 
    outline-offset: 2px;
}

/* ========== BUSCADOR ========== */
.hub-buscador {
    position: relative;
    max-width: 600px;
    margin: 0 auto 30px;
}

.hub-buscador input {
    width: 100%;
    padding: 15px 50px 15px 20px;
    border: 2px solid var(--hub-border);
    border-radius: 50px;
    font-size: 15px;
    transition: all 0.3s;
}

.hub-buscador input:focus {
    outline: none;
    border-color: var(--hub-secondary);
    box-shadow: 0 0 0 4px rgba(0,180,216,0.1);
}

.hub-buscador .search-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    pointer-events: none;
    color: var(--hub-text-light);
}

/* ========== BOTÓN COLAPSAR FILTROS MOBILE ========== */
#hub-toggle-filtros-mobile {
    display: none;
    border: none;
    background: linear-gradient(90deg, #35abe4 0%, #009bdb 100%);
    color: #fff;
    font-weight: 700;
    width: 100%;
    margin-bottom: 15px;
    padding: 12px 0;
    font-size: 1.05em;
    border-radius: var(--hub-radius);
    cursor: pointer;
    transition: background 0.2s;
}

#hub-toggle-filtros-mobile:hover {
    background: linear-gradient(90deg, #2a96c9 0%, #0088c0 100%);
}

/* ========== FILTROS GRID ========== */
.hub-filtros-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
    background: #fafbfc;
    padding: 20px 15px;
    border-radius: var(--hub-radius);
}

.filtro-group label {
    display: block;
    font-weight: 700;
    color: var(--hub-primary);
    margin-bottom: 8px;
    font-size: 14px;
}

.hub-select {
    width: 100%;
    padding: 12px 40px 12px 15px;
    border: 2px solid var(--hub-border);
    border-radius: var(--hub-radius);
    background: white url('data:image/svg+xml;utf8,<svg fill="%230b1d3a" height="18" viewBox="0 0 20 20" width="18" xmlns="http://www.w3.org/2000/svg"><path d="M5.293 7.293a1 1 0 0 1 1.414 0L10 10.586l3.293-3.293a1 1 0 1 1 1.414 1.414l-4 4a1 1 0 0 1-1.414 0l-4-4a1 1 0 0 1 0-1.414z"/></svg>') no-repeat right 14px center/18px 18px;
    font-size: 15px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    box-sizing: border-box;
    transition: border .2s, box-shadow .2s;
}

.hub-select:focus {
    outline: none;
    border-color: var(--hub-secondary);
    box-shadow: 0 0 0 3px rgba(0,180,216,0.1);
}

/* ========== ACCIONES ========== */
.hub-filtros-acciones {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-hub {
    padding: 14px 32px;
    border: none;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: var(--hub-secondary);
    color: white;
}

.btn-primary:hover {
    background: #0096c7;
    transform: translateY(-2px);
    box-shadow: var(--hub-shadow-hover);
}

.btn-secondary {
    background: transparent;
    border: 2px solid var(--hub-primary);
    color: var(--hub-primary);
}

.btn-secondary:hover {
    background: var(--hub-primary);
    color: white;
}

.btn-block { 
    width: 100%; 
    justify-content: center; 
}

/* ========== CONTADOR ========== */
.hub-contador {
    text-align: center;
    margin-top: 20px;
    padding: 14px;
    background: var(--hub-gray);
    border-radius: var(--hub-radius);
    font-weight: 600;
    color: var(--hub-primary);
    font-size: 15px;
}

/* ========== CARRUSEL DESTACADOS (CLASES ÚNICAS) ========== */
.hub-carrusel-destacados-recursos {
    padding: 40px 20px;
    background: #fafbfc;
    border-radius: var(--hub-radius);
    margin-bottom: 40px;
}

.hub-carrusel-destacados-recursos h3 { 
    text-align: center; 
    font-size: 26px; 
    font-weight: 700; 
    color: var(--hub-primary); 
    margin-bottom: 30px;
}

.hub-card-destacado-recursos {
    background: white;
    border-radius: var(--hub-radius);
    box-shadow: var(--hub-shadow);
    padding: 20px 18px 24px 18px;
    text-align: center;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: transform 0.3s, box-shadow 0.3s;
}

.hub-card-destacado-recursos:hover {
    transform: translateY(-5px);
    box-shadow: var(--hub-shadow-hover);
}

.hub-card-destacado-recursos .card-img-recursos {
    height: 180px;
    background-size: cover;
    background-position: center;
    background-color: var(--hub-gray);
    border-radius: var(--hub-radius);
    margin-bottom: 14px;
}

.hub-card-destacado-recursos h4 { 
    color: var(--hub-primary); 
    font-size: 18px; 
    font-weight: 700; 
    margin-bottom: 8px;
    line-height: 1.3;
}

.hub-card-destacado-recursos p { 
    font-size: 14px; 
    color: var(--hub-text-light); 
    margin-bottom: 16px; 
    min-height: 40px;
    line-height: 1.5;
}

.hub-card-destacado-recursos .btn-hub { 
    margin-top: auto; 
    padding: 12px 24px;
}

/* ========== CAROUSEL WRAPPER ========== */
.hub-carousel-wrapper {
    position: relative;
}

.hub-carousel-wrapper .hub-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

/* Swiper específico para recursos con autoplay */
.hub-swiper-recursos {
    width: 100%;
    padding: 0 40px 40px 40px;
    overflow: hidden;
}

.hub-swiper-recursos .swiper-slide {
    height: auto;
    display: flex;
}

.hub-swiper-recursos .swiper-pagination {
    bottom: 0 !important;
    position: relative;
    margin-top: 20px;
}

.hub-swiper-recursos .swiper-pagination-bullet {
    background: var(--hub-primary);
    opacity: 0.3;
    width: 12px;
    height: 12px;
    margin: 0 6px;
    transition: all 0.3s;
}

.hub-swiper-recursos .swiper-pagination-bullet-active {
    opacity: 1;
    background: var(--hub-secondary);
    transform: scale(1.2);
}

.hub-swiper-recursos .hub-swiper-btn-prev,
.hub-swiper-recursos .hub-swiper-btn-next {
    color: var(--hub-primary);
    font-weight: bold;
    background: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    box-shadow: var(--hub-shadow);
    transition: all 0.3s;
    top: 50%;
    margin-top: -22px;
}

.hub-swiper-recursos .hub-swiper-btn-prev:hover,
.hub-swiper-recursos .hub-swiper-btn-next:hover {
    background: var(--hub-primary);
    color: white;
    box-shadow: var(--hub-shadow-hover);
}

.hub-swiper-recursos .hub-swiper-btn-prev:after,
.hub-swiper-recursos .hub-swiper-btn-next:after {
    font-size: 18px;
    font-weight: 900;
}

.hub-swiper-recursos .hub-swiper-btn-prev {
    left: 0;
}

.hub-swiper-recursos .hub-swiper-btn-next {
    right: 0;
}

/* ========== RESULTADOS GRID ========== */
.hub-resultados-wrapper { 
    margin: 40px 0; 
}

.hub-grid { 
    display: grid; 
    gap: 30px; 
    margin-bottom: 40px; 
}

.hub-grid-2col { 
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); 
}

.hub-grid-3col { 
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); 
}

.hub-grid-4col { 
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); 
}

/* ========== CARD RECURSO ========== */
.hub-card {
    background: white;
    border-radius: var(--hub-radius);
    box-shadow: var(--hub-shadow);
    overflow: hidden;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.hub-card:hover { 
    transform: translateY(-5px); 
    box-shadow: var(--hub-shadow-hover);
}

.hub-card-imagen { 
    height: 200px; 
    background-size: cover; 
    background-position: center; 
    background-color: var(--hub-gray); 
    position: relative;
}

.hub-card-badge {
    position: absolute; 
    top: 15px; 
    right: 15px;
    padding: 6px 14px; 
    border-radius: 20px; 
    font-size: 12px; 
    font-weight: 700;
    text-transform: uppercase; 
    letter-spacing: 0.5px;
}

.badge-proximo { 
    background: #fff3cd; 
    color: #856404;
}

.badge-on-demand {
    background: #d1ecf1; 
    color: #0c5460;
}

.badge-descargable{
    background: #d4edda;
    color: #155724;
}

.hub-card-contenido { 
    padding: 24px; 
    flex: 1; 
    display: flex; 
    flex-direction: column;
}

.hub-card-tipo { 
    font-size: 12px; 
    font-weight: 700; 
    color: var(--hub-secondary); 
    text-transform: uppercase; 
    letter-spacing: 1px; 
    margin-bottom: 10px; 
}

.hub-card-titulo { 
    font-size: 20px; 
    font-weight: 700; 
    color: var(--hub-primary); 
    margin: 0 0 14px; 
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hub-card-extracto { 
    color: var(--hub-text-light); 
    font-size: 14px; 
    line-height: 1.6; 
    margin-bottom: 14px; 
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hub-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.hub-tag {
    background: var(--hub-gray);
    color: var(--hub-text);
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 500;
}

.hub-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--hub-border);
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--hub-text-light);
}

.hub-meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.hub-card-acciones {
    display: flex;
    gap: 10px;
    margin-top: auto;
}

.hub-card-acciones .btn-hub { 
    flex: 1; 
    padding: 12px 20px; 
    font-size: 14px; 
    justify-content: center; 
}

/* ========== LOADING ========== */
.hub-loading {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--hub-gray);
    border-top-color: var(--hub-secondary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.hub-loading p {
    color: var(--hub-text-light);
    font-size: 16px;
}

/* ========== EMPTY STATE ========== */
.hub-empty {
    text-align: center;
    padding: 60px 20px;
    background: var(--hub-gray);
    border-radius: var(--hub-radius);
}

.hub-empty p {
    font-size: 18px;
    color: var(--hub-text-light);
    margin-bottom: 20px;
}

/* ========== MODAL LEAD FORM ========== */
.hub-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.hub-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(4px);
}

.hub-modal-contenido {
    position: relative;
    background: white;
    padding: 40px;
    border-radius: var(--hub-radius);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hub-modal-cerrar {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 32px;
    color: var(--hub-text-light);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}

.hub-modal-cerrar:hover {
    background: var(--hub-gray);
    color: var(--hub-text);
}

.hub-modal-header h3 {
    color: var(--hub-primary);
    font-size: 26px;
    margin: 0 0 10px;
}

.hub-modal-header p {
    color: var(--hub-text-light);
    font-size: 15px;
    margin: 0 0 25px;
}

/* ========== FORM ========== */
.hub-form-lead .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--hub-primary);
    margin-bottom: 8px;
    font-size: 14px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--hub-border);
    border-radius: var(--hub-radius);
    font-size: 14px;
    transition: all 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--hub-secondary);
    box-shadow: 0 0 0 3px rgba(0,180,216,0.1);
}

.form-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.form-check input[type="checkbox"] {
    margin-top: 4px;
    width: auto;
}

.form-check label {
    font-weight: normal;
    margin: 0;
    font-size: 13px;
}

.hub-modal-mensaje {
    padding: 15px;
    border-radius: var(--hub-radius);
    margin-top: 20px;
    text-align: center;
    font-weight: 600;
}

.hub-modal-mensaje.success {
    background: #d4edda;
    color: #155724;
}

.hub-modal-mensaje.error {
    background: #f8d7da;
    color: #721c24;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    #hub-toggle-filtros-mobile {
        display: block;
    }
    
    .hub-filtros-grid {
        display: none;
    }
    
    .hub-filtros-grid.open { 
        display: grid;
        grid-template-columns: 1fr;
    }
    
    .hub-filtros-wrapper {
        padding: 20px;
        position: relative;
        top: 0;
    }
    
    .hub-filtros-header h2 {
        font-size: 22px;
    }
    
    .hub-switch-tipo {
        flex-direction: column;
    }
    
    .switch-btn {
        width: 100%;
    }
    
    .hub-grid-2col,
    .hub-grid-3col,
    .hub-grid-4col {
        grid-template-columns: 1fr;
    }
    
    .hub-card-acciones {
        flex-direction: column;
    }
    
    .hub-modal-contenido {
        padding: 25px;
    }
    
    .hub-form-lead .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .btn-hub {
        padding: 12px 24px;
        font-size: 14px;
    }
    
    .hub-swiper-recursos {
        padding: 0 10px 40px 10px;
    }
    
    .hub-swiper-recursos .hub-swiper-btn-prev,
    .hub-swiper-recursos .hub-swiper-btn-next {
        display: none;
    }
}

@media (max-width: 480px) {
    .hub-filtros-wrapper {
        padding: 15px;
        margin-bottom: 30px;
    }
    
    .hub-buscador input {
        padding: 12px 45px 12px 15px;
        font-size: 14px;
    }
    
    .hub-card-imagen {
        height: 180px;
    }
    
    .hub-card-contenido {
        padding: 20px;
    }
    
    .hub-card-titulo {
        font-size: 18px;
    }
    
    .hub-modal-contenido {
        padding: 20px;
    }
    
    .hub-modal-header h3 {
        font-size: 22px;
    }
}

/* ========== ANIMACIONES ========== */
.hub-card {
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== ACCESIBILIDAD ========== */
.btn-hub:focus,
.hub-select:focus,
.hub-buscador input:focus,
.switch-btn:focus {
    outline: 2px solid var(--hub-secondary);
    outline-offset: 2px;
}

.hub-modal-cerrar:focus {
    outline: 2px solid var(--hub-primary);
}

/* ========== AUTOPLAY INDICATOR ========== */
.hub-swiper-recursos .swiper-pagination-progressbar {
    background: rgba(0, 0, 0, 0.1);
    height: 4px;
}

.hub-swiper-recursos .swiper-pagination-progressbar-fill {
    background: var(--hub-secondary);
    transition: all 0.3s;
}

/* ========== PRINT ========== */
@media print {
    .hub-filtros-wrapper,
    .hub-modal,
    .hub-card-acciones,
    .swiper-pagination,
    .hub-swiper-btn-prev,
    .hub-swiper-btn-next {
        display: none !important;
    }
    
    .hub-swiper-recursos .swiper-wrapper {
        display: block !important;
    }
    
    .hub-swiper-recursos .swiper-slide {
        display: block !important;
        width: 100% !important;
        page-break-inside: avoid;
    }
}

/* ========== ESTADOS DE CARGA ========== */
.hub-swiper-recursos.swiper-initialized {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.hub-swiper-recursos:not(.swiper-initialized) {
    opacity: 0;
}

/* ========== MEJORAS VISUALES ========== */
.hub-card-destacado-recursos .btn-hub:hover {
    transform: translateY(-2px);
}

.hub-swiper-recursos .swiper-slide-active .hub-card {
    transform: scale(1.02);
}

.hub-swiper-recursos .swiper-slide-active .hub-card-destacado-recursos {
    transform: scale(1.02);
}

/* ========== COMPATIBILIDAD CON TEMAS ========== */
.hub-filtros-wrapper * {
    box-sizing: border-box;
}

.hub-card * {
    box-sizing: border-box;
}

.hub-modal * {
    box-sizing: border-box;
}