/* 
 * CSS para Modal de Notícias
 * Estilos específicos para o modal de exibição de notícias
 */

/* Modal overlay */
.news-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

/* Forçar o modal global a sobrepor a seção de notícias (sem alterar display) */
#newsModal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;               /* Centralizar via flex */
    align-items: center;         /* Central vertical */
    justify-content: center;     /* Central horizontal */
}

/* Garantir que o estado oculto realmente esconda o modal */
#newsModal.hidden {
    display: none !important;
}

/* Modal container */
.news-modal-container {
    background-color: white;
    border-radius: 0.75rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 90vw;
    max-height: 90vh;
    width: 100%;
    overflow: hidden;
    position: relative;
    animation: modalSlideIn 0.3s ease-out;
}

/* Modal header */
.news-modal-header {
    position: sticky;
    top: 0;
    background-color: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 10;
}

/* Modal title */
.news-modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.4;
    margin: 0;
    padding-right: 2rem;
}

/* Close button */
.news-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background-color: #f3f4f6;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #6b7280;
    font-size: 1.25rem;
    z-index: 20;
}

.news-modal-close:hover {
    background-color: #e5e7eb;
    color: #374151;
    transform: scale(1.05);
}

/* Modal content */
.news-modal-content {
    padding: 0 1.5rem 1.5rem;
    overflow-y: auto;
    max-height: calc(90vh - 120px);
}

/* News meta information */
.news-modal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: #f9fafb;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.news-modal-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.news-modal-meta-item strong {
    color: #374151;
}

/* News image */
.news-modal-image {
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* News content text */
.news-modal-text {
    font-size: 1rem;
    line-height: 1.7;
    color: #374151;
    text-align: justify;
}

.news-modal-text p {
    margin-bottom: 1rem;
}

.news-modal-text p:last-child {
    margin-bottom: 0;
}

/* TTS Controls */
.news-modal-tts {
    position: sticky;
    bottom: 0;
    background-color: white;
    border-top: 1px solid #e5e7eb;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.tts-button {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tts-button.listen {
    background-color: #3b82f6;
    color: white;
}

.tts-button.listen:hover {
    background-color: #2563eb;
}

.tts-button.stop {
    background-color: #dc2626;
    color: white;
}

.tts-button.stop:hover {
    background-color: #b91c1c;
}

.tts-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Loading state */
.tts-button.loading {
    animation: pulse 1.5s infinite;
}

/* --- Responsivo (celular) - modal em largura total --- */
@media (max-width: 768px) {
  #newsModalContainer {
    width: 100vw !important;
    max-width: 100vw !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    border-radius: 0 !important;
  }
}

/* --- Desktop/Tablet - manter centralização horizontal --- */
@media (min-width: 769px) {
  #newsModalContainer {
    margin-left: auto;
    margin-right: auto;
  }
}

/* Animations */
@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .news-modal-container {
        max-width: 95vw;
        max-height: 95vh;
        margin: 0.5rem;
    }
    
    .news-modal-header {
        padding: 1rem;
    }
    
    .news-modal-title {
        font-size: 1.25rem;
        padding-right: 3rem;
    }
    
    .news-modal-content {
        padding: 0 1rem 1rem;
    }
    
    .news-modal-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .news-modal-tts {
        padding: 1rem;
        flex-direction: column;
    }
    
    .tts-button {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .news-modal-overlay {
        padding: 0.5rem;
    }
    
    .news-modal-container {
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0.5rem;
    }
    
    .news-modal-title {
        font-size: 1.125rem;
    }
    
    .news-modal-text {
        font-size: 0.9rem;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .news-modal-container {
        animation: none;
    }
    
    .tts-button.loading {
        animation: none;
    }
    
    .news-modal-close {
        transition: none;
    }
}

/* Focus styles for accessibility */
.news-modal-close:focus,
.tts-button:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .news-modal-container {
        border: 2px solid #000;
    }
    
    .news-modal-header {
        border-bottom-color: #000;
    }
    
    .news-modal-tts {
        border-top-color: #000;
    }
}