/**
 * Estilos del Modal de Noticias
 *
 * Estructura organizada:
 * 1. Variables y configuración global
 * 2. Estructura básica del modal
 * 3. Elementos decorativos
 * 4. Cabecera de artículo
 * 5. Cuerpo del artículo
 * 6. Pie del artículo
 * 7. Controles y componentes interactivos
 * 8. Botones flotantes
 * 9. Animaciones
 * 10. Media queries para responsividad
 */

/* 1. Variables - Podría implementarse con CSS variables para mejor mantenimiento */
/* --color-primary: #006fdd;
   --color-secondary: #00c6ff;
   --color-text-dark: #222;
   --color-text-medium: #444;
   --color-text-light: #666;
   --border-radius-large: 24px;
   --transition-standard: 0.3s ease;
   --transition-fancy: 0.8s cubic-bezier(0.34, 1.56, 0.64, 1); */

/* 2. Estructura básica del modal */
.modal-dialog {
    max-width: 900px;
    margin: 1.75rem auto;
}

.modal-content {
    border: none;
    border-radius: 24px;
    background: #ffffff;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    height: 90vh;
    overflow: hidden;
    position: relative;
}

/* Modal Container con Scroll */
.modal-container {
    height: 100%;
    overflow-y: auto;
    padding: 0;
    position: relative;
    scroll-behavior: smooth; /* Comportamiento de scroll suave */
    scrollbar-color: #006fdd #f1f1f1;
    scrollbar-width: thin;
    z-index: 1;
}

/* Estilizar scrollbar para navegadores webkit */
.modal-container::-webkit-scrollbar {
    width: 4px;
}

.modal-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.modal-container::-webkit-scrollbar-thumb {
    background: #006fdd;
    border-radius: 8px;
}


/* 4. Cabecera del artículo */
.article-header {
    background: linear-gradient(135deg, #f9f9f9 0%, #ffffff 100%);
    border-bottom: 1px solid rgba(0, 111, 221, 0.1);
    padding: 60px 60px 30px;
    position: relative;
}

.header-meta {
    align-items: center;
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.header-meta.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.category-badge {
    background: linear-gradient(135deg, #006fdd 0%, #4c94ff 100%);
    border-radius: 30px;
    box-shadow: 0 4px 10px rgba(0, 111, 221, 0.2);
    color: white;
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    padding: 6px 15px;
}

.article-date {
    color: #666;
    font-size: 0.9rem;
    padding-left: 20px;
    position: relative;
}

.article-date::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    content: '';
    height: 12px;
    left: 0;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
}

.article-title {
    color: #222;
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 0;
    opacity: 0;
    padding-bottom: 30px;
    position: relative;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.article-title.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.article-title::after {
    background: linear-gradient(90deg, #006fdd, transparent);
    bottom: 15px;
    content: '';
    height: 4px;
    left: 0;
    position: absolute;
    width: 80px;
}

/* 5. Cuerpo del artículo */
.article-body {
    padding: 40px 60px;
    position: relative;
}

.article-content-wrapper {
    opacity: 0;
    position: relative;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.article-content-wrapper.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.article-decoration-element {
    background: #006fdd;
    border-radius: 50%;
    box-shadow: 0 0 0 5px rgba(0, 111, 221, 0.1);
    height: 15px;
    left: -30px;
    position: absolute;
    top: 10px;
    width: 15px;
}

.article-content {
    color: #444;
    font-size: 1.1rem;
    line-height: 1.8;
}

.article-content p:first-of-type {
    color: #333;
    font-size: 1.3rem;
    font-weight: 500;
    position: relative;
}

.article-content p:first-of-type::first-letter {
    color: #006fdd;
    float: left;
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 0.8;
    margin-right: 8px;
}

.article-content h2 {
    color: #222;
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 20px;
    margin-top: 40px;
    padding-bottom: 10px;
    position: relative;
}

.article-content h2::after {
    background: linear-gradient(90deg, #006fdd, transparent);
    bottom: 0;
    content: '';
    height: 3px;
    left: 0;
    position: absolute;
    width: 50px;
}

.article-content blockquote {
    background: rgba(0, 111, 221, 0.03);
    border-left: 4px solid #006fdd;
    border-radius: 0 8px 8px 0;
    color: #555;
    font-style: italic;
    margin: 30px 0;
    padding: 20px 20px 20px 30px;
}

/* 6. Pie del artículo */
.article-footer {
    background: linear-gradient(135deg, #f9f9f9 0%, #ffffff 100%);
    border-top: 1px solid #eee;
    display: flex;
    justify-content: center;
    opacity: 0;
    padding: 30px 60px;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.article-footer.animate-in {
    opacity: 1;
    transform: translateY(0);
}

/* 7. Controles y componentes interactivos */
/* Barra de progreso de lectura */
.reading-progress-container {
    background: rgba(0, 0, 0, 0.05);
    height: 4px;
    left: 0;
    position: absolute;
    top: 0;
    width: 100%;
    z-index: 10;
}

.reading-progress-bar {
    background: linear-gradient(90deg, #006fdd, #00c6ff);
    height: 100%;
    transition: width 0.1s ease;
    width: 0;
}

/* Botón de cierre */
.modal-close-btn {
    align-items: center;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    display: flex;
    height: 40px;
    justify-content: center;
    position: absolute;
    right: 20px;
    top: 20px;
    transition: all 0.3s ease;
    width: 40px;
    z-index: 10;
}

.modal-close-btn:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
    transform: rotate(90deg);
}

.modal-close-btn svg {
    fill: none;
    stroke: #333;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

/* Botón personalizado */
.btn-close-article {
    align-items: center;
    background: linear-gradient(135deg, #f0f0f0 0%, #e5e5e5 100%);
    border: none;
    border-radius: 30px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    color: #333;
    cursor: pointer;
    display: flex;
    font-size: 0.95rem;
    font-weight: 600;
    gap: 10px;
    justify-content: center;
    overflow: hidden;
    padding: 12px 24px;
    position: relative;
    transition: all 0.3s ease;
}

.btn-close-article:hover {
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.btn-icon {
    align-items: center;
    display: flex;
    justify-content: center;
}

.btn-icon svg {
    fill: none;
    stroke: #333;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

/* 8. Botones flotantes con tooltips compactos */
.floating-actions {
    position: fixed;
    bottom: 30px;
    left: 30px;
    z-index: 15;
    display: flex;
    gap: 15px;
    opacity: 1;
    transform: translateX(0);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.floating-actions.show {
    opacity: 1;
    transform: translateX(0);
}

/* Contenedor para cada botón flotante y su tooltip */
.floating-btn-container {
    position: relative;
    display: flex;
    align-items: center;
}

.floating-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    position: relative;
    text-decoration: none;
    overflow: hidden;
}

.floating-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: inherit;
    border-radius: inherit;
    transform: scale(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.floating-btn:hover::before {
    transform: scale(1.1);
}

.floating-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.floating-btn:active {
    transform: translateY(-1px) scale(0.95);
}

.floating-btn svg {
    position: relative;
    z-index: 1;
}

/* Botón Ver Noticia Completa */
.btn-ver-completa {
    background: linear-gradient(135deg, #006fdd 0%, #4c94ff 100%);
    color: white;
}

.btn-ver-completa:hover {
    color: white;
}

.btn-ver-completa::before {
    background: linear-gradient(135deg, #0056b3 0%, #3d7ae0 100%);
}

/* Botón Compartir */
.btn-compartir {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.btn-compartir::before {
    background: linear-gradient(135deg, #1e7e34 0%, #198754 100%);
}

/* Tooltips compactos hacia arriba */
.custom-tooltip {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 12px);
    transform: translateX(-50%);
    background: #333;
    border-radius: 8px;
    padding: 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    white-space: nowrap;
}

.floating-btn-container:hover .custom-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-3px);
}

.tooltip-content {
    padding: 8px 12px;
}

.tooltip-text {
    color: white;
    font-weight: 500;
    font-size: 0.85rem;
    line-height: 1;
}

/* Flecha del tooltip */
.tooltip-arrow {
    position: absolute;
    left: 50%;
    top: 100%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-top: 6px solid #333;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
}

/* Efectos de entrada escalonada */
.floating-btn-container:nth-child(1) {
    animation-delay: 0.1s;
}

.floating-btn-container:nth-child(2) {
    animation-delay: 0.2s;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-60px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.floating-actions.show .floating-btn-container {
    animation: slideInLeft 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Responsive para tooltips */
@media (max-width: 992px) {
    .floating-actions {
        bottom: 20px;
        left: 20px;
    }

    .floating-btn {
        width: 50px;
        height: 50px;
    }

    .tooltip-content {
        padding: 6px 10px;
    }

    .tooltip-text {
        font-size: 0.8rem;
    }
}

@media (max-width: 768px) {
    .floating-actions {
        bottom: 15px;
        left: 15px;
        gap: 12px;
    }

    .floating-btn {
        width: 48px;
        height: 48px;
    }

    .floating-btn svg {
        width: 18px;
        height: 18px;
    }

    /* Tooltips simplificados en móviles */
    .custom-tooltip {
        display: none;
    }

    /* Tooltips alternativos compactos para móviles */
    .floating-btn::after {
        content: attr(data-tooltip);
        position: absolute;
        left: 50%;
        bottom: calc(100% + 8px);
        transform: translateX(-50%);
        background: #333;
        color: white;
        padding: 4px 8px;
        border-radius: 4px;
        font-size: 0.75rem;
        white-space: nowrap;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        z-index: 1000;
    }

    .floating-btn:hover::after {
        opacity: 1;
    }
}

@media (max-width: 576px) {
    .floating-actions {
        bottom: 10px;
        left: 10px;
    }

    .floating-btn {
        width: 44px;
        height: 44px;
    }

    /* Ocultar tooltips en pantallas muy pequeñas */
    .floating-btn::after {
        display: none;
    }
}

/* Estados de hover mejorados */
.floating-btn-container:hover .floating-btn {
    transform: translateY(-3px) scale(1.05);
}

/* Animación del tooltip compacto */
@keyframes tooltipFadeInUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(2px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(-3px) scale(1);
    }
}

.floating-btn-container:hover .custom-tooltip {
    animation: tooltipFadeInUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Accesibilidad mejorada */
.floating-btn:focus {
    outline: 2px solid rgba(0, 111, 221, 0.5);
    outline-offset: 2px;
}

.floating-btn:focus .custom-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-3px);
}

/* Indicador de loading para botones */
.floating-btn.loading {
    pointer-events: none;
}

.floating-btn.loading svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* 9. Animaciones */
@keyframes highlightFade {
    0% {
        opacity: 0;
    }
    20% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

@keyframes modalClose {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.95) translateY(30px);
    }
}

/* Animaciones del modal */
.modal.fade .modal-dialog {
    opacity: 0;
    transform: translateY(50px) scale(0.95);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.5s ease;
}

.modal.show .modal-dialog {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.modal-closing {
    animation: modalClose 0.5s forwards;
}

/* 10. Media queries para responsividad */
@media (max-width: 992px) {
    .article-title {
        font-size: 2.5rem;
    }

    .article-header,
    .article-body,
    .article-footer {
        padding: 30px;
    }

    .floating-actions {
        bottom: 20px;
        left: 20px;
    }

    .floating-btn {
        width: 50px;
        height: 50px;
    }
}

@media (max-width: 768px) {
    .modal-dialog {
        height: 100dvh;
        height: 100vh; /* Fallback */
        margin: 0;
        max-width: 100%;
    }

    .modal-content {
        border-radius: 0;
        height: 100dvh;
        height: 100vh; /* Fallback */
        padding: 10px;
    }

    .article-title {
        font-size: 2rem;
    }

    .floating-actions {
        bottom: 15px;
        left: 15px;
        gap: 12px;
    }

    .floating-btn {
        width: 48px;
        height: 48px;
    }

    .floating-btn svg {
        width: 18px;
        height: 18px;
    }

    /* Ocultar tooltips en móviles */
    .floating-btn::after {
        display: none;
    }
}

@media (max-width: 576px) {
    .article-title {
        font-size: 1.8rem;
    }

    .header-meta {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .article-content p:first-of-type::first-letter {
        font-size: 2.5rem;
    }

    .article-header {
        padding-top: 40px;
    }

    .modal-close-btn {
        right: 10px;
        top: 10px;
    }

    .floating-actions {
        bottom: 10px;
        left: 10px;
    }

    .floating-btn {
        width: 44px;
        height: 44px;
    }

    iframe {
        width: 100% !important;
    }
}

/* 11. Estilos para imágenes responsivas - Sección agregada */
/* Contenedor principal para imágenes en el contenido del artículo */
.article-content img {
    max-width: 100% !important;
    /*width: auto !important;*/
    height: auto !important;
    display: block !important;
    margin: 1.5rem auto !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
    object-fit: cover !important;
    object-position: center !important;
}

/* Contenedor para imágenes grandes - centrado y responsivo */
.article-content .image-container,
.article-content figure {
    width: 100% !important;
    max-width: 800px !important;
    margin: 2rem auto !important;
    text-align: center !important;
    position: relative !important;
    overflow: hidden !important;
    border-radius: 10px !important;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.15) !important;
}

/* Asegurar que las imágenes dentro de contenedores se adapten */
.article-content .image-container img,
.article-content figure img {
    width: 100% !important;
    height: auto !important;
    max-height: 500px !important;
    object-fit: cover !important;
    object-position: center !important;
    display: block !important;
    margin: 0 auto !important;
    border-radius: 10px !important;
}

/* Estilos para imágenes flotantes */
.article-content img[style*="float"] {
    max-width: 50% !important;
    margin: 1rem !important;
}

.article-content img[style*="float: left"] {
    float: left !important;
    margin: 1rem 1.5rem 1rem 0 !important;
}

.article-content img[style*="float: right"] {
    float: right !important;
    margin: 1rem 0 1rem 1.5rem !important;
}

/* Contenedor flexible para múltiples imágenes */
.article-content .images-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)) !important;
    gap: 1rem !important;
    margin: 2rem 0 !important;
}

.article-content .images-grid img {
    width: 100% !important;
    height: 200px !important;
    object-fit: cover !important;
    border-radius: 8px !important;
    margin: 0 !important;
}

/* Estilos para iframes y videos embebidos */
.article-content iframe {
    max-width: 100% !important;
    min-height: 300px !important;
    border-radius: 8px !important;
    margin: 1.5rem auto !important;
    display: block !important;
}

.article-content iframe[src*="youtube.com"],
.article-content iframe[src*="youtu.be"] {
    width: 100% !important;
    height: auto !important;
}

/* Contenedor responsive para videos */
.article-content .video-container {
    position: relative !important;
    width: 100% !important;
    height: 0 !important;
    padding-bottom: 56.25% !important; /* 16:9 aspect ratio */
    margin: 2rem auto !important;
    max-width: 800px !important;
}

.article-content .video-container iframe {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    min-height: auto !important;
}

/* Estilos para figcaptions */
.article-content figcaption {
    text-align: center !important;
    font-style: italic !important;
    color: #666 !important;
    font-size: 0.9rem !important;
    margin-top: 0.5rem !important;
    padding: 0 1rem !important;
}

/* 12. Media queries actualizadas para imágenes responsivas */
@media (max-width: 992px) {

    .article-content .image-container,
    .article-content figure {
        max-width: 100% !important;
        margin: 1.5rem auto !important;
    }

    .article-content .image-container img,
    .article-content figure img {
        max-height: 400px !important;
    }

    .article-content img[style*="float"] {
        max-width: 60% !important;
    }

    .article-content .images-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
    }

    .article-content .images-grid img {
        height: 150px !important;
    }
}

@media (max-width: 768px) {
    .article-content .image-container,
    .article-content figure {
        margin: 1rem auto !important;
        border-radius: 6px !important;
    }

    .article-content .image-container img,
    .article-content figure img {
        max-height: 300px !important;
        border-radius: 6px !important;
    }

    /* Eliminar float en móviles */
    .article-content img[style*="float"] {
        float: none !important;
        max-width: 100% !important;
        margin: 1rem auto !important;
        display: block !important;
    }

    .article-content .images-grid {
        grid-template-columns: 1fr !important;
        gap: 0.5rem !important;
    }

    .article-content .images-grid img {
        height: 200px !important;
    }

    .article-content iframe {
        min-height: 250px !important;
    }
}

@media (max-width: 576px) {

    .article-content .image-container,
    .article-content figure {
        margin: 0.75rem auto !important;
        border-radius: 4px !important;
    }

    .article-content .image-container img,
    .article-content figure img {
        max-height: 250px !important;
        border-radius: 4px !important;
    }

    .article-content .images-grid img {
        height: 150px !important;
    }

    .article-content iframe {
        min-height: 200px !important;
        border-radius: 4px !important;
    }

    .article-content figcaption {
        font-size: 0.8rem !important;
    }
}

@media (max-width: 480px) {
    .article-content img {
        max-height: 200px !important;
        margin: 0.5rem auto !important;
    }

    .article-content .image-container,
    .article-content figure {
        margin: 0.5rem auto !important;
    }

    .article-content .image-container img,
    .article-content figure img {
        max-height: 200px !important;
    }

    .article-content .images-grid img {
        height: 120px !important;
    }

    .article-content iframe {
        min-height: 180px !important;
    }
}

/* 13. Estilos adicionales para garantizar compatibilidad */
/* Resetear estilos que puedan interferir */
.article-content * {
    box-sizing: border-box !important;
}

/* Asegurar que las imágenes no se desborden */
.article-content {
    overflow-x: hidden !important;
}

/* Estilos para imágenes con texto envolvente */
.article-content .wrap-text-left {
    float: left !important;
    max-width: 40% !important;
    margin: 0 1.5rem 1rem 0 !important;
}

.article-content .wrap-text-right {
    float: right !important;
    max-width: 40% !important;
    margin: 0 0 1rem 1.5rem !important;
}

/* Clearfix para elementos flotantes */
.article-content::after {
    content: "" !important;
    display: table !important;
    clear: both !important;
}

/* Estilos para galerías de imágenes */
.article-content .gallery {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 1rem !important;
    justify-content: center !important;
    margin: 2rem 0 !important;
}

.article-content .gallery img {
    flex: 1 1 300px !important;
    max-width: 300px !important;
    height: 200px !important;
    object-fit: cover !important;
    margin: 0 !important;
}

@media (max-width: 768px) {
    .article-content .wrap-text-left,
    .article-content .wrap-text-right {
        float: none !important;
        max-width: 100% !important;
        margin: 1rem auto !important;
        display: block !important;
    }

    .article-content .gallery img {
        flex: 1 1 100% !important;
        max-width: 100% !important;
    }
}