/**
 * blog-cope.css - Centro Oncológico COPE
 * Estilos Enterprise para Publicaciones Científicas y Medical Insights
 * 
 * Cumple con estándares de diseño corporativo médico, accesibilidad WCAG,
 * soporte fluido de Dark Mode ([data-theme="dark"]) y control estricto de imágenes.
 */

/* ================================================================
 * 1. HEADER INSTITUCIONAL DEL BLOG
 * ================================================================ */
.medical-insights-header {
    padding: 60px 20px 25px;
    text-align: center;
    background: transparent;
}

.medical-insights-header .badge-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 18px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: rgba(45, 212, 191, 0.12);
    color: #007d67;
    border: 1px solid rgba(0, 125, 103, 0.25);
    margin-bottom: 18px;
}

[data-theme="dark"] .medical-insights-header .badge-tag {
    background: rgba(45, 212, 191, 0.15);
    color: #2dd4bf;
    border-color: rgba(45, 212, 191, 0.3);
}

.medical-insights-header h1 {
    font-size: clamp(2rem, 3.5vw, 2.75rem) !important;
    font-family: var(--fuente-titulos, 'Poppins', sans-serif) !important;
    font-weight: 800 !important;
    color: #002856 !important;
    margin: 0 0 16px 0 !important;
    line-height: 1.25 !important;
}

[data-theme="dark"] .medical-insights-header h1 {
    color: #f8fafc !important;
}

.medical-insights-header p {
    font-size: 1.1rem !important;
    color: #475569 !important;
    max-width: 820px !important;
    margin: 0 auto 25px auto !important;
    line-height: 1.65 !important;
}

[data-theme="dark"] .medical-insights-header p {
    color: #94a3b8 !important;
}

/* ================================================================
 * PESTAÑAS DE FILTRADO POR ESPECIALIDAD
 * ================================================================ */
.blog-filter-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin: 25px auto 0;
    max-width: 1000px;
}

.blog-filter-btn {
    padding: 8px 18px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    background: #ffffff;
    color: #475569;
    border: 1px solid #e2e8f0;
    transition: all 0.25s ease;
}

.blog-filter-btn:hover {
    border-color: #007d67;
    color: #007d67;
}

.blog-filter-btn.active {
    background: #002856;
    color: #ffffff;
    border-color: #002856;
    box-shadow: 0 4px 12px rgba(0, 40, 86, 0.18);
}

[data-theme="dark"] .blog-filter-btn {
    background: #1e1e1e;
    color: #94a3b8;
    border-color: #333333;
}

[data-theme="dark"] .blog-filter-btn:hover {
    border-color: #2dd4bf;
    color: #2dd4bf;
}

[data-theme="dark"] .blog-filter-btn.active {
    background: #007d67;
    color: #ffffff;
    border-color: #007d67;
    box-shadow: 0 4px 14px rgba(0, 125, 103, 0.35);
}

/* ================================================================
 * FASE 2: GRID ESTRUCTURAL PRINCIPAL (REGLA ESTRICTA)
 * ================================================================ */
.medical-insights-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)) !important;
    gap: 2rem !important;
    width: 100% !important;
    max-width: 1240px !important;
    margin: 0 auto !important;
    padding: 0 20px !important;
    box-sizing: border-box !important;
}

/* ================================================================
 * FASE 2 & 3: TARJETA DE ARTÍCULO Y EFECTOS HOVER
 * ================================================================ */
.medical-insight-card {
    background: #ffffff;
    border: 1px solid rgba(0, 40, 86, 0.08);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 40, 86, 0.06);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    position: relative;
    box-sizing: border-box;
    height: 100%;
}

.medical-insight-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 28px rgba(0, 40, 86, 0.12);
    border-color: rgba(0, 125, 103, 0.35);
}

/* ================================================================
 * CONTROL DE IMÁGENES (CRÍTICO - REGLA ESTRICTA)
 * Miniatura con altura fija (220px) e imagen object-fit: cover
 * ================================================================ */
.insight-media-wrapper {
    position: relative !important;
    height: 220px !important;
    max-height: 220px !important;
    width: 100% !important;
    overflow: hidden !important;
    background-color: #0b192c;
    border-radius: 8px 8px 0 0 !important;
    flex-shrink: 0 !important;
}

.insight-media-wrapper img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 220px !important;
    object-fit: cover !important;
    border-radius: 8px 8px 0 0 !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    transition: transform 0.4s ease;
}

.medical-insight-card:hover .insight-media-wrapper img {
    transform: scale(1.04);
}

/* Badges sobre la miniatura */
.insight-badge-category {
    position: absolute;
    top: 14px;
    left: 14px;
    background: rgba(0, 40, 86, 0.92);
    backdrop-filter: blur(6px);
    color: #ffffff;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    z-index: 2;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.insight-badge-journal {
    position: absolute;
    bottom: 12px;
    right: 14px;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(6px);
    color: #38bdf8;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    border: 1px solid rgba(56, 189, 248, 0.3);
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* ================================================================
 * TIPOGRAFÍA Y ESPACIADO (REGLA ESTRICTA)
 * Padding 1.5rem y textos alineados estrictamente a la izquierda
 * ================================================================ */
.insight-content {
    padding: 1.5rem !important;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    text-align: left !important;
    box-sizing: border-box;
}

.insight-meta-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 12px;
    text-align: left;
}

.insight-meta-top span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.insight-read-time {
    color: #007d67 !important;
    font-weight: 600;
}

.insight-title {
    font-size: 1.22rem;
    font-family: var(--fuente-titulos, 'Poppins', sans-serif);
    font-weight: 700;
    color: #002856;
    line-height: 1.38;
    margin: 0 0 12px 0;
    text-align: left !important;
}

.insight-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.insight-title a:hover {
    color: #007d67;
}

/* Resumen Médico Técnico de 2 Líneas */
.insight-excerpt {
    color: #475569;
    font-size: 0.92rem;
    line-height: 1.6;
    margin: 0 0 20px 0;
    flex-grow: 1;
    text-align: left !important;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ================================================================
 * FICHA DEL AUTOR (REGLA ESTRICTA)
 * Avatar circular pequeño (40px x 40px) alineado horizontalmente
 * ================================================================ */
.insight-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 14px;
    border-top: 1px solid #f1f5f9;
    margin-top: auto;
    gap: 12px;
}

.insight-author {
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
    min-width: 0;
}

.insight-author-avatar {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    max-width: 40px !important;
    max-height: 40px !important;
    border-radius: 50% !important;
    overflow: hidden !important;
    flex-shrink: 0 !important;
    border: 2px solid #007d67 !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    background: #e2e8f0;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
}

.insight-author-avatar img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: cover !important;
    border-radius: 50% !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
}

.insight-author-info {
    display: flex;
    flex-direction: column;
    text-align: left;
    min-width: 0;
    overflow: hidden;
}

.insight-author-name {
    font-size: 0.88rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.insight-author-role {
    font-size: 0.74rem;
    color: #64748b;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.insight-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 6px;
    background: rgba(0, 125, 103, 0.08);
    color: #007d67;
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    border: 1px solid rgba(0, 125, 103, 0.2);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.insight-link-btn:hover {
    background: #007d67;
    color: #ffffff;
    border-color: #007d67;
}

/* ================================================================
 * FASE 3: REFINAMIENTO DE MODO OSCURO (DATA-THEME="DARK")
 * Fondo #1E1E1E, borde 1px solid #333, contraste óptimo
 * ================================================================ */
[data-theme="dark"] .medical-insight-card {
    background: #1E1E1E !important;
    border: 1px solid #333333 !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4) !important;
}

[data-theme="dark"] .medical-insight-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6) !important;
    border-color: #00a887 !important;
}

[data-theme="dark"] .insight-media-wrapper {
    background-color: #121212 !important;
}

[data-theme="dark"] .insight-title {
    color: #F8FAFC !important;
}

[data-theme="dark"] .insight-title a {
    color: #F8FAFC !important;
}

[data-theme="dark"] .insight-title a:hover {
    color: #2dd4bf !important;
}

[data-theme="dark"] .insight-meta-top {
    color: #94A3B8 !important;
}

[data-theme="dark"] .insight-read-time {
    color: #2dd4bf !important;
}

[data-theme="dark"] .insight-excerpt {
    color: #CBD5E1 !important;
}

[data-theme="dark"] .insight-footer {
    border-top-color: #2A2A2A !important;
}

[data-theme="dark"] .insight-author-name {
    color: #F8FAFC !important;
}

[data-theme="dark"] .insight-author-role {
    color: #94A3B8 !important;
}

[data-theme="dark"] .insight-author-avatar {
    border-color: #00a887 !important;
    background: #2a2a2a !important;
}

[data-theme="dark"] .insight-link-btn {
    background: rgba(45, 212, 191, 0.12) !important;
    color: #2dd4bf !important;
    border-color: rgba(45, 212, 191, 0.3) !important;
}

[data-theme="dark"] .insight-link-btn:hover {
    background: #007d67 !important;
    color: #ffffff !important;
    border-color: #007d67 !important;
}

/* ================================================================
 * MODALES DE LECTURA CLÍNICA INTEGRADA
 * ================================================================ */
.insight-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.78);
    backdrop-filter: blur(8px);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.insight-modal-backdrop.active {
    display: flex;
    opacity: 1;
}

.insight-modal-dialog {
    background: #ffffff;
    border: 1px solid rgba(0, 40, 86, 0.12);
    border-radius: 16px;
    max-width: 820px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 25px 60px -15px rgba(0, 40, 86, 0.35);
    animation: insightModalSlide 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

[data-theme="dark"] .insight-modal-dialog {
    background: #1E1E1E !important;
    border-color: #333333 !important;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8) !important;
}

.insight-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.06);
    border: none;
    font-size: 1.1rem;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.insight-modal-close:hover {
    background: #ef4444;
    color: #ffffff;
    transform: rotate(90deg);
}

[data-theme="dark"] .insight-modal-close {
    background: rgba(255, 255, 255, 0.1);
    color: #f8fafc;
}

.insight-modal-header {
    padding: 32px 32px 20px;
    border-bottom: 1px solid #f1f5f9;
}

[data-theme="dark"] .insight-modal-header {
    border-bottom-color: #2a2a2a;
}

.insight-modal-doctor-strip {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.insight-modal-doc-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid #007d67;
}

.insight-modal-doc-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.insight-modal-doc-meta h4 {
    margin: 0 0 2px 0;
    font-size: 1.05rem;
    font-weight: 800;
    color: #002856;
}

[data-theme="dark"] .insight-modal-doc-meta h4 {
    color: #f8fafc;
}

.insight-modal-doc-meta span {
    font-size: 0.82rem;
    color: #007d67;
    font-weight: 600;
}

[data-theme="dark"] .insight-modal-doc-meta span {
    color: #2dd4bf;
}

.insight-modal-title {
    font-size: clamp(1.25rem, 2vw, 1.55rem);
    font-weight: 800;
    color: #002856;
    line-height: 1.32;
    margin: 0 0 14px 0;
    font-family: var(--fuente-titulos, 'Poppins', sans-serif);
}

[data-theme="dark"] .insight-modal-title {
    color: #f8fafc;
}

.insight-modal-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.insight-pill-category {
    padding: 4px 12px;
    border-radius: 4px;
    background: rgba(0, 40, 86, 0.08);
    color: #002856;
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
}

[data-theme="dark"] .insight-pill-category {
    background: rgba(45, 212, 191, 0.15);
    color: #2dd4bf;
}

.insight-pill-indexed {
    padding: 4px 12px;
    border-radius: 4px;
    background: rgba(14, 165, 233, 0.12);
    color: #0284c7;
    font-size: 0.74rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

[data-theme="dark"] .insight-pill-indexed {
    background: rgba(56, 189, 248, 0.18);
    color: #38bdf8;
}

.insight-modal-body {
    padding: 24px 32px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.insight-section-block {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    text-align: left;
}

[data-theme="dark"] .insight-section-block {
    background: #161616;
    border-color: #2a2a2a;
}

.insight-section-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: #002856;
    margin: 0 0 10px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

[data-theme="dark"] .insight-section-title {
    color: #2dd4bf;
}

.insight-section-block p {
    font-size: 0.92rem;
    line-height: 1.65;
    color: #334155;
    margin: 0;
}

[data-theme="dark"] .insight-section-block p {
    color: #cbd5e1;
}

.insight-modal-footer {
    padding: 20px 32px 28px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    background: #f8fafc;
    border-radius: 0 0 16px 16px;
}

[data-theme="dark"] .insight-modal-footer {
    background: #161616;
    border-top-color: #2a2a2a;
}

.btn-modal-cita {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: 6px;
    background: #007d67;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.88rem;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.2s ease;
}

.btn-modal-cita:hover {
    background: #00604f;
    color: #ffffff;
    transform: translateY(-2px);
}

.btn-modal-pubmed {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 6px;
    background: #ffffff;
    color: #002856;
    border: 1px solid #cbd5e1;
    font-weight: 700;
    font-size: 0.88rem;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-modal-pubmed:hover {
    background: #002856;
    color: #ffffff;
    border-color: #002856;
}

[data-theme="dark"] .btn-modal-pubmed {
    background: #222222;
    color: #f8fafc;
    border-color: #444444;
}

[data-theme="dark"] .btn-modal-pubmed:hover {
    background: #333333;
    border-color: #666666;
}
