/* -----------------------------------------------------------
   ESTILOS UNIFICADOS - MÓDULO DE NOTICIAS
----------------------------------------------------------- */

:root {
    --primary: #007A96;
    --dark: #0f2339;
    --text: #5a6b7a;
    --border: #e6e6e6;
    --radius: 10px;
}

body {
    background: #f7f9fc;
}

.np-wrapper {
    width: 92%;
    max-width: 1300px;
    margin: 40px auto;
}

/* -------------------------------- HEADER / SEARCH -------------------------------- */

.np-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 30px;
}

.np-header h1 {
    color: var(--primary);
    font-weight: 700;
}

.np-filters {
    display: flex;
    gap: 15px;
}

.np-search {
    position: relative;
}

.np-search input {
    padding: 8px 35px 8px 35px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 240px;
    outline: none;
}

.np-search i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

#clear-search {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    display: none;
}

#news-topic-filter {
    padding: 8px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: white;
    outline: none;
}

/* -------------------------------- HERO (NOTICIA DESTACADA) -------------------------------- */

.np-hero {
    display: flex;
    overflow: hidden;
    border-radius: var(--radius);
    margin-bottom: 35px;
    background: white;
    border: 1px solid var(--border);
    transition: transform 0.3s ease;
}

.np-hero:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}

.np-hero img {
    width: 45%;
    object-fit: cover;
}

.np-hero-content {
    padding: 25px;
}

.np-hero-content h2 {
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 0.6rem;
}

.np-hero-content p {
    color: var(--text);
}

/* Hero Compacto Específico */
.np-hero.compact {
    align-items: center;
}

.np-hero.compact img {
    width: 32%;
    height: 260px;
    object-fit: contain;
    background: transparent;
    padding: 15px;
}

.np-hero.compact h2 {
    font-size: 1.55rem;
    margin: 4px 0 8px;
    line-height: 1.25;
}

/* -------------------------------- LAYOUT Y FEED -------------------------------- */

.np-layout {
    display: grid;
    grid-template-columns: 3fr 1.1fr;
    gap: 40px;
    align-items: start;
}

.np-subtitle {
    color: var(--dark);
    font-size: 1.1rem;
    margin: 20px 0;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.np-feed {
    display: flex;
    flex-direction: column;
    border-radius: var(--radius);
    background: white;
    border: 1px solid var(--border);
    overflow: hidden;
}

.np-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    border-bottom: 1px solid var(--border);
    align-items: center;
    transition: background .2s;
    cursor: pointer;
}

.np-item:last-child {
    border-bottom: none;
}

.np-item:hover {
    background: #eefaff;
}

.np-item img {
    width: 110px;
    height: 75px;
    object-fit: contain;
    background: transparent;
    border-radius: 6px;
    padding: 5px;
}

.np-item h4 {
    font-size: 1.05rem;
    margin: 3px 0;
    color: var(--dark);
    line-height: 1.3;
}

.tag {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.meta,
.date {
    display: flex;
    gap: 12px;
    font-size: 0.8rem;
    color: #888;
}

.article-visual-container {
    display: grid;
    grid-template-columns: 1fr 140px;
    gap: 15px;
    margin-bottom: 30px;
    height: 500px;
}

/* -------------------------------- SIDEBAR (TEMAS) -------------------------------- */

.side-box {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 24px;
    box-shadow: 0 4px 12px rgba(15, 35, 57, 0.03);
}

.side-box h4 {
    color: var(--dark);
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    border-bottom: 2px solid var(--primary);
    width: fit-content;
    padding-bottom: 5px;
    margin-bottom: 20px;
}

.topics {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.topics a {
    text-decoration: none;
    display: flex;
    align-items: center;
    padding: 10px 14px;
    border-radius: 8px;
    background: #f8fafc;
    color: var(--text);
    font-size: 0.9rem;
    transition: all 0.3s ease;
    gap: 12px;
}

.topic-icon {
    font-size: 1.1rem;
    color: var(--primary);
    width: 20px;
    text-align: center;
}

.topics a:hover {
    background: #eefaff;
    color: var(--primary);
    transform: translateX(5px);
}

.topics a.active {
    background: var(--primary);
    color: white;
}

.topics a.active .topic-icon {
    color: white;
}

/* -------------------------------- DETALLE DE NOTICIA -------------------------------- */

.btn-back {
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.np-article {
    background: white;
    padding: 40px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.article-header h1 {
    font-size: 2.2rem;
    color: var(--dark);
    line-height: 1.2;
    margin: 10px 0;
}

.article-main-image {
    width: 100%;
    height: 450px;
    background: transparent;
    border-radius: var(--radius);
    margin: 30px 0;
    overflow: hidden;
    border: 1px solid var(--border);
}

.article-main-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 20px;
}

.article-body {
    color: var(--text);
    line-height: 1.8;
    font-size: 1.05rem;
}

.lead {
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--dark);
    border-left: 4px solid var(--primary);
    padding-left: 20px;
    margin-bottom: 30px;
}

.article-visual-wrapper {
    background: transparent;
    margin-bottom: 30px;
}

.article-visual-container {
    display: grid;
    grid-template-columns: 1fr 140px;
    height: 480px;
    background: transparent;
}

.article-main-image {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 25px 0 0;
    background: transparent;
}

.article-main-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.article-vertical-gallery {
    background: transparent;
    overflow: hidden;
}

.gallery-scroll {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0 5px;
    height: 100%;
    overflow-y: auto;
}

.gallery-thumb {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid #f1f5f9;
    background: white;
    transition: all 0.2s;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 5px;
}

.gallery-thumb.active {
    border-color: var(--primary);
}

/* Barra de compartir mejorada */
.article-share-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    background: transparent;
    border-top: 1px solid #f1f5f9;
    margin-top: 10px;
}

.share-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.share-icons-group {
    display: flex;
    gap: 18px;
    align-items: center;
}

.share-ico {
    color: #64748b;
    font-size: 1.15rem;
    transition: all 0.2s ease;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    display: flex;
    align-items: center;
    text-decoration: none;
}

.share-ico:hover {
    transform: translateY(-2px);
}

.share-ico.fb:hover {
    color: #1877F2;
}

.share-ico.tw:hover {
    color: #000000;
}

.share-ico.ln:hover {
    color: #0077B5;
}

.share-ico.tk:hover {
    color: #ff0050;
}

.share-ico.wa:hover {
    color: #25D366;
}

.share-ico.cp:hover {
    color: var(--primary);
}

/* LÓGICA DEL TOOLTIP */
.copy-wrapper {
    position: relative;
    display: inline-block;
}

.copy-tooltip {
    position: absolute;
    bottom: 130%;
    left: 50%;
    transform: translateX(-50%);
    background: #334155;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.copy-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #334155 transparent transparent transparent;
}

.copy-tooltip.show {
    opacity: 1;
    visibility: visible;
    bottom: 150%;
}

@media (max-width: 900px) {
    .article-visual-container {
        grid-template-columns: 1fr;
        height: auto;
    }

    .article-main-image {
        padding: 0 0 20px 0;
    }

    .gallery-scroll {
        flex-direction: row;
        padding: 10px 0;
        height: 100px;
    }

    .gallery-thumb {
        width: 80px;
    }

    .article-share-footer {
        flex-direction: column;
        gap: 15px;
    }

    .share-icons-group {
        gap: 20px;
        flex-wrap: wrap;
        justify-content: center;
    }
}


/* -------------------------------- GALERÍA RELACIONADA -------------------------------- */

.article-gallery {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 1px solid var(--border);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.gallery-item {
    height: 140px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.3s ease;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 10px;
}

.gallery-item:hover {
    transform: scale(1.05);
    border-color: var(--primary);
}

/* -------------------------------- PAGINACIÓN -------------------------------- */

.np-pagination-wrapper {
    margin-top: 30px;
    display: flex;
    justify-content: center;
    padding: 20px 0;
}

/* Forzar tamaño normal si aparecen flechas SVG */
.np-pagination-wrapper svg {
    width: 20px !important;
    height: 20px !important;
}

/* Estilo de la lista de paginación */
.np-pagination-wrapper .pagination {
    display: flex;
    list-style: none;
    padding: 0;
    gap: 5px;
    align-items: center;
}

.np-pagination-wrapper .page-item {
    display: inline-block;
}

.np-pagination-wrapper .page-link {
    display: block;
    padding: 8px 14px;
    color: var(--primary);
    background-color: #fff;
    border: 1px solid var(--border);
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.np-pagination-wrapper .page-item.active .page-link {
    background-color: var(--primary);
    border-color: var(--primary);
    color: white;
}

.np-pagination-wrapper .page-item.disabled .page-link {
    color: #ccc;
    pointer-events: none;
    background-color: #fafafa;
}

.np-pagination-wrapper .page-link:hover:not(.active) {
    background-color: #eefaff;
    border-color: var(--primary);
}

/* Ocultar textos descriptivos que a veces añade Laravel (Showing X to Y results) */
.np-pagination-wrapper nav div:first-child {
    display: none !important;
}

/* Usamos un selector más específico para ganar prioridad */
.np-article .formatted-content-v3 {
    display: block !important;
    /* Esto empuja TODO el bloque de texto a la derecha */
    margin-left: 3rem !important; 
    margin-right: 1rem !important;
    
    line-height: 1.8 !important;
    font-size: 1.05rem !important;
    color: #333 !important;
    text-align: justify !important;
    
    /* Limpiamos cualquier sangría negativa previa */
    text-indent: 0 !important;
}

/* -------------------------------- RESPONSIVE -------------------------------- */

@media(max-width:900px) {
    .np-layout {
        grid-template-columns: 1fr;
    }

    .np-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .np-filters {
        width: 100%;
        flex-direction: column;
        margin-top: 15px;
    }

    .np-search input,
    #news-topic-filter {
        width: 100%;
    }

    .np-hero,
    .np-hero.compact {
        flex-direction: column;
    }

    .np-hero img,
    .np-hero.compact img {
        width: 100%;
        height: 250px;
    }

    .np-article {
        padding: 20px;
    }

    .article-header h1 {
        font-size: 1.6rem;
    }

    .article-main-image {
        height: 280px;
    }
}