/* Recursos Clínicos Page - Specific Styles */

/* Asegurar que el header y sus elementos sean visibles */
header {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

header .hidden.sm\:block {
    display: none !important;
}

@media (min-width: 640px) {
    header .hidden.sm\:block {
        display: block !important;
    }
}

header .hidden.lg\:block {
    display: none !important;
}

@media (min-width: 1024px) {
    header .hidden.lg\:block {
        display: block !important;
    }
}

header .lg\:hidden {
    display: block !important;
}

@media (min-width: 1024px) {
    header .lg\:hidden {
        display: none !important;
    }
}

/* Hero Banner - Estadísticas */
.hero-banner {
    background: linear-gradient(135deg, var(--helin-primary) 0%, var(--helin-primary-light) 100%);
    border-radius: 24px;
    padding: 48px 64px;
    margin-bottom: 32px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    align-items: center;
    color: var(--white);
}

.banner-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.banner-content .hero-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    color: var(--white);
    padding: 8px 16px;
    border-radius: 9999px;
    font-size: var(--text-sm);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    width: fit-content;
}

.banner-content h1 {
    font-size: var(--text-6xl);
    line-height: 1.1;
    letter-spacing: 0;
    font-weight: 700;
    margin: 0;
}

.banner-content p {
    font-size: var(--text-lg);
    line-height: 1.6;
    margin: 0;
    opacity: 0.95;
}

.banner-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.banner-stats .stat {
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(255, 255, 255, 0.15);
    padding: 20px;
    border-radius: 16px;
    backdrop-filter: blur(10px);
}

.banner-stats .stat-icon {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xl);
    font-weight: 900;
    color: var(--white);
}

.banner-stats .stat strong {
    display: block;
    font-size: var(--text-3xl);
    font-weight: 900;
    line-height: 1;
    margin-bottom: 4px;
}

.banner-stats .stat span {
    font-size: var(--text-sm);
    opacity: 0.9;
    font-weight: 500;
}

/* Hero Section */
.hero {
    position: relative;
    overflow: hidden;
    color: var(--white);
    border-top: 1px solid rgba(255,255,255,0.15);
    z-index: 0;
}

.hero:before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, #123F4A 0%, #123F4A 50%, rgba(18, 63, 74, 0.63) 100%);
}

.hero-inner {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1.03fr 0.97fr;
    gap: 42px;
    align-items: center;
    max-width: 1240px;
    margin: 0 auto;
    padding: 5rem 2rem;
    min-height: 410px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 5px 10px;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.35);
    font-size: 0.7rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 18px;
}

.hero h1 {
    font-size: 3.625rem;
    line-height: 0.98;
    letter-spacing: 0;
    margin: 0 0 18px;
    max-width: 620px;
}

.hero p {
    font-size: 1.125rem;
    line-height: 1.55;
    margin: 0;
    max-width: 590px;
    color: rgba(255, 255, 255, 0.92);
}

.hero-buttons {
    display: flex;
    gap: 12px;
    margin-top: 28px;
    flex-wrap: wrap;
}

.hero-btn-primary {
    height: 46px;
    padding: 0 20px;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    background: var(--white);
    color: var(--helin-primary);
    box-shadow: 0 16px 34px rgba(18, 48, 68, 0.14);
    text-decoration: none;
    transition: transform 0.22s ease, box-shadow 0.22s ease, background-color 0.22s ease;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

@media (hover: hover) and (pointer: fine) {
    .hero-btn-primary:hover {
        background: #e8f7f7;
        box-shadow: 0 20px 40px rgba(18, 48, 68, 0.2);
        transform: translateY(-2px);
    }
}

.hero-btn-primary:active {
    transform: translateY(0) scale(0.96);
    box-shadow: 0 8px 18px rgba(18, 48, 68, 0.12);
    transition-duration: 0.06s;
}

.hero-btn-primary:focus-visible {
    outline: 2px solid #6BC2C3;
    outline-offset: 3px;
}

.hero-btn-secondary {
    height: 46px;
    padding: 0 20px;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    background: rgba(255, 255, 255, 0.14);
    color: var(--white);
    border: 1px solid rgba(255, 255, 255, 0.36);
    text-decoration: none;
    transition: transform 0.22s ease, box-shadow 0.22s ease, background-color 0.22s ease, border-color 0.22s ease;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

@media (hover: hover) and (pointer: fine) {
    .hero-btn-secondary:hover {
        background: rgba(255, 255, 255, 0.28);
        border-color: rgba(255, 255, 255, 0.6);
        box-shadow: 0 12px 28px rgba(18, 48, 68, 0.18);
        transform: translateY(-2px);
    }
}

.hero-btn-secondary:active {
    transform: translateY(0) scale(0.96);
    background: rgba(255, 255, 255, 0.35);
    transition-duration: 0.06s;
}

.hero-btn-secondary:focus-visible {
    outline: 2px solid #6BC2C3;
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    .hero-btn-primary,
    .hero-btn-secondary {
        transition: none;
    }
}

.hero-panel {
    background: rgba(255, 255, 255, 0.94);
    color: var(--text-primary);
    border-radius: 32px;
    padding: 24px;
    box-shadow: 0 24px 60px rgba(18, 48, 68, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.7);
}

.panel-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.panel-title h3 {
    margin: 0;
    font-size: 1.375rem;
    letter-spacing: 0;
}

.badge {
    padding: 7px 10px;
    border-radius: 9999px;
    background: var(--bg-turquesa-light-1);
    color: var(--helin-primary);
    font-size: 0.75rem;
    font-weight: 900;
}

.quick-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.quick-card {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 16px;
    box-shadow: 0 10px 26px rgba(18, 48, 68, 0.06);
    cursor: pointer;
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease, background-color 0.22s ease;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

/* HOVER: cursor-only devices — visible change on pointer enter, no click needed */
@media (hover: hover) and (pointer: fine) {
    .quick-card:hover {
        background-color: #f0fafa;
        border-color: #6BC2C3;
        box-shadow: 0 16px 36px rgba(18, 48, 68, 0.14);
        transform: translateY(-4px);
    }
}

/* ACTIVE: click/tap feedback — distinct from hover */
.quick-card:active {
    transform: translateY(0) scale(0.96);
    background-color: #e4f5f5;
    box-shadow: 0 4px 12px rgba(18, 48, 68, 0.1);
    border-color: #6BC2C3;
    transition-duration: 0.06s;
}

/* FOCUS: keyboard navigation */
.quick-card:focus-visible {
    outline: 2px solid #6BC2C3;
    outline-offset: 3px;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .quick-card {
        transition: none;
    }
}

.quick-icon {
    width: 38px;
    height: 38px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--helin-primary), var(--helin-soft));
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    margin-bottom: 12px;
}

.quick-card h4 {
    margin: 0 0 5px;
    font-size: 0.9375rem;
}

.quick-card p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.75rem;
    line-height: 1.35;
}

/* Stats Section */
.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-top: -64px;
    position: relative;
    z-index: 2;
    margin-bottom: 34px;
    max-width: 1240px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 2rem;
}

.stat {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 18px;
    box-shadow: 0 18px 44px rgba(18, 48, 68, 0.08);
    display: flex;
    align-items: center;
    gap: 14px;
}

.stat-icon {
    width: 38px;
    height: 38px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--helin-primary), var(--helin-soft));
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.stat strong {
    font-size: 1.5rem;
    color: var(--helin-primary);
    display: block;
    line-height: 1;
}

.stat span {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 800;
}

/* Section Head */
.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin: 28px 0 18px;
}

.section-head small {
    color: var(--helin-primary);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.section-head h2 {
    margin: 6px 0 0;
    font-size: 2.25rem;
    line-height: 1.05;
    letter-spacing: 0;
    color: var(--text-dark);
}

.section-head p {
    color: var(--text-muted);
    max-width: 540px;
    line-height: 1.5;
    margin: 0;
}

/* Resource Search */
.resource-search {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 28px;
    box-shadow: 0 18px 44px rgba(18, 48, 68, 0.08);
    padding: 18px;
    display: grid;
    grid-template-columns: 1fr 190px 190px 150px;
    gap: 12px;
    margin-bottom: 28px;
}

.resource-search input,
.resource-search select {
    height: 52px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: #faffff;
    padding: 0 16px;
    outline: 0;
    color: var(--text-primary);
    width: 100%;
}

.resource-search select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23334155' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
    padding-right: 40px;
    cursor: pointer;
}

.resource-search button#searchButton {
    height: 52px;
    border: 0;
    border-radius: 16px;
    background: var(--helin-primary);
    color: var(--white);
    font-weight: 900;
    box-shadow: 0 14px 26px rgba(107, 194, 195, 0.22);
    cursor: pointer;
    transition: background-color 0.22s ease, box-shadow 0.22s ease, transform 0.18s ease;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

/* HOVER: cursor-only devices — visible change on pointer enter */
@media (hover: hover) and (pointer: fine) {
    .resource-search button#searchButton:hover {
        background: #0e333c;
        box-shadow: 0 18px 34px rgba(107, 194, 195, 0.35);
    }
}

/* ACTIVE: click/tap feedback — distinct from hover */
.resource-search button#searchButton:active {
    transform: scale(0.95);
    background: #0a2a32;
    box-shadow: 0 6px 14px rgba(107, 194, 195, 0.15);
    transition-duration: 0.06s;
}

/* FOCUS: keyboard navigation */
.resource-search button#searchButton:focus-visible {
    outline: 2px solid #6BC2C3;
    outline-offset: 3px;
}

.resource-search button#searchButton.is-loading {
    pointer-events: none;
    opacity: 0.7;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .resource-search button#searchButton {
        transition: none;
    }
}

/* Layout */
.layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 22px;
    align-items: start;
}

.sidebar {
    position: sticky;
    top: 138px;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    box-shadow: 0 10px 26px rgba(18, 48, 68, 0.06);
    padding: 20px;
}

.sidebar h3 {
    margin: 0 0 14px;
    font-size: 1.25rem;
    color: var(--text-dark);
}

.filter-group {
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
    margin-top: 16px;
}

.group-title {
    font-size: 0.8125rem;
    font-weight: 900;
    margin-bottom: 12px;
}

.filter-check {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 0;
    color: #466273;
    font-size: 0.875rem;
}

.filter-check input {
    accent-color: var(--helin-primary);
}

.count {
    color: var(--helin-primary);
    background: var(--bg-turquesa-light-1);
    border-radius: 9999px;
    padding: 3px 8px;
    font-size: 0.6875rem;
}

/* Toolbar */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.toolbar p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.sort-select {
    height: 42px;
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    background: var(--white);
    padding: 0 38px 0 14px;
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-weight: 800;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23334155' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    cursor: pointer;
}

/* Resource Grid */
.resource-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.resource-card {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 10px 26px rgba(18, 48, 68, 0.06);
    transition: 0.22s;
    cursor: pointer;
}

.resource-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 22px 52px rgba(18, 48, 68, 0.12);
}

.resource-thumb {
    height: 168px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(107, 194, 195, 0.14), rgba(151, 213, 212, 0.22)),
                radial-gradient(circle at 74% 32%, rgba(255, 255, 255, 0.95), transparent 34%);
}

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

.resource-type {
    position: absolute;
    top: 14px;
    left: 14px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--helin-primary);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 900;
}

.resource-play {
    position: absolute;
    bottom: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    background: var(--helin-primary);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
}

.resource-body {
    padding: 20px;
}

.resource-tags {
    margin-bottom: 12px;
}

.tag {
    display: inline-block;
    background: var(--bg-light);
    color: var(--helin-primary);
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-right: 6px;
}

.resource-body h3 {
    margin: 0 0 8px;
    font-size: 1.125rem;
    line-height: 1.3;
    color: var(--text-dark);
}

.resource-body p {
    margin: 0 0 16px;
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.4;
}

.resource-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.resource-format {
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.resource-link {
    color: var(--helin-primary);
    font-weight: 800;
    font-size: 0.875rem;
    text-decoration: none;
}

/* Featured Section */
.featured-section {
    margin-top: 42px;
    border-radius: 32px;
    color: var(--white);
    overflow: hidden;
    box-shadow: 0 24px 58px rgba(18, 63, 74, 0.22);
    position: relative;
}

.featured-section::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(18, 63, 74, 0.46);
    z-index: 1;
}

.featured-content {
    padding: 48px 40px;
    position: relative;
    z-index: 2;
    max-width: 680px;
}

.featured-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.35);
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 18px;
}

.featured-section h2 {
    margin: 0 0 16px;
    font-size: 2.5rem;
    letter-spacing: -0.02em;
    line-height: 1.05;
    max-width: 480px;
}

.featured-section p {
    margin: 0 0 28px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.92);
    max-width: 460px;
}

.featured-cta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 26px;
    border-radius: 9999px;
    background: #6BC2C3;
    color: #123F4A;
    font-weight: 900;
    text-decoration: none;
    transition: all 0.2s ease;
}

.featured-cta:hover {
    background: #ffffff;
    color: #123F4A;
}

/* Responsive Design */
@media (max-width: 1050px) {
    .hero-inner {
        grid-template-columns: 1fr;
    }

    .stats {
        grid-template-columns: repeat(2, 1fr);
        margin-top: 24px;
    }

    .resource-search {
        grid-template-columns: 1fr 1fr;
    }

    .layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: relative;
        top: auto;
    }

    .resource-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .featured-content {
        padding: 32px 24px;
    }

    .featured-section h2 {
        font-size: 1.875rem;
    }
}

@media (max-width: 680px) {
    .hero h1 {
        font-size: 2.625rem;
    }

    .resource-search,
    .resource-grid,
    .quick-cards,
    .stats {
        grid-template-columns: 1fr;
    }

    .section-head {
        display: block;
    }

    .section-head h2 {
        font-size: 1.875rem;
        margin-bottom: 18px;
    }
}

/* ── Filtros AJAX ── */
.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Solo ocultar elementos .hidden dentro del contenido de recursos clínicos,
   sin afectar el header compartido (botón "Escríbenos" usa hidden lg:flex) */
main .hidden,
.resource-search .hidden,
.quick-cards .hidden,
#resourcesContent .hidden {
    display: none !important;
}

.error-message {
    background-color: #fee;
    border: 1px solid #fcc;
    color: #c33;
    padding: 1rem;
    border-radius: 0.5rem;
    margin: 1rem 0;
}

#resourcesContent {
    transition: opacity 0.3s ease;
}

.clear-filters-text {
    padding: 2px 6px;
    background-color: rgba(107, 194, 195, 0.1);
    border: 1px solid rgba(107, 194, 195, 0.25);
    border-radius: 9999px;
    color: #6BC2C3;
    cursor: pointer;
    transition: all 0.2s ease;
    display: none;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.6875rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.clear-filters-text:hover {
    background-color: #123F4A;
    color: #ffffff;
}

.filter-check:hover {
    background-color: rgba(107, 194, 195, 0.1);
    transition: background-color 0.2s ease;
}

.filter-check.is-disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.filter-check.is-disabled:hover {
    background-color: transparent;
}

.filter-check.is-disabled .count {
    color: var(--text-muted);
    background: var(--bg-light);
}

.filter-check input:disabled {
    cursor: not-allowed;
}

.resource-search select:disabled {
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.6;
}

.filter-checkbox:checked + span {
    font-weight: 600;
    color: #06b6d4;
}

/* Pagination */
.pagination-wrapper nav > div {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 32px;
    flex-wrap: wrap;
}

.pagination-wrapper a,
.pagination-wrapper span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
    border-radius: 10px;
    font-size: 0.8125rem;
    font-weight: 700;
    color: #334155;
    background: var(--white);
    border: 1px solid var(--border-color);
    text-decoration: none;
    transition: all 0.2s ease;
}

.pagination-wrapper a:hover {
    background: rgba(107, 194, 195, 0.12);
    border-color: #6BC2C3;
    color: #123F4A;
}

.pagination-wrapper span[aria-current="page"] {
    background: #123F4A;
    border-color: #123F4A;
    color: #ffffff;
}

.pagination-wrapper span[aria-disabled="true"] {
    opacity: 0.45;
    cursor: not-allowed;
}

@media (max-width: 768px) {
    .loading-indicator { padding: 2rem 1rem; }
    .spinner { width: 32px; height: 32px; }
}
