/* Sistema de Comunicados - Estilos */
/* Versão: 1.0.0 */

/* Botão de comunicados na sidebar */
.comunicados-btn {
    transition: all 0.3s ease;
    position: relative;
}

.comunicados-btn:hover {
    color: #a855f7 !important;
    background: rgba(168, 85, 247, 0.1) !important;
}

/* Badge de notificação */
.announcement-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    z-index: 10001;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.5);
    animation: pulse 2s infinite;
    pointer-events: none;
}

/* Animação de pulso para o badge */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 2px 8px rgba(239, 68, 68, 0.5);
    }
}

/* Garantir que elementos com badge tenham position relative para o badge */
/* Mas manter position fixed para o botão da sidebar */
#sidebar-announcements-btn,
#sidebar-regras-btn {
    position: relative !important;
    overflow: visible !important;
}

/* Para o botão da sidebar, precisamos manter fixed mas permitir badge */
.sidebar-toggle {
    /* Mantém position: fixed do styles.css */
    /* O badge será posicionado absolutamente dentro dele */
    overflow: visible !important;
}

/* Overlay do modal de comunicados */
.announcements-overlay {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100005;
}

/* Modal de comunicados */
.announcements-modal {
    will-change: transform, opacity;
    overflow: hidden !important; /* Remover scroll do modal */
    display: flex !important;
    flex-direction: column !important;
}

.announcements-modal * {
    box-sizing: border-box;
}

.announcements-modal button {
    outline: none;
    border: none;
    font-family: inherit;
}

.announcements-modal button:focus {
    outline: 2px solid rgba(59, 130, 246, 0.5);
    outline-offset: 2px;
}

/* Acordeão de comunicados no admin */
.announcements-accordion {
    background: rgba(17, 24, 39, 0.8);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.announcements-accordion:hover {
    border-color: rgba(59, 130, 246, 0.4);
}

.announcements-accordion .accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(29, 78, 216, 0.1));
    cursor: pointer;
    transition: all 0.3s ease;
}

.announcements-accordion .accordion-header:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(29, 78, 216, 0.2));
}

.announcements-accordion .accordion-title {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #f9fafb;
    font-weight: 600;
    font-size: 16px;
}

.announcements-accordion .accordion-title i {
    font-size: 18px;
    color: #60a5fa;
}

.announcements-accordion .accordion-arrow {
    color: #9ca3af;
    transition: transform 0.3s ease;
}

.announcements-accordion .accordion-arrow i {
    font-size: 14px;
}

.announcements-accordion .accordion-content {
    display: none !important;
    padding: 20px;
    background: rgba(17, 24, 39, 0.5);
    min-height: 200px;
    overflow: visible;
}

.announcements-accordion .accordion-content.show {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    max-height: none !important;
}

/* Forçar exibição quando aberto */
.announcements-accordion .accordion-content[style*="display: block"] {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Gerenciamento de comunicados */
.announcements-management {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.announcements-header h3 {
    color: #f9fafb;
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 8px 0;
}

.announcements-header p {
    color: #9ca3af;
    font-size: 14px;
    margin: 0;
    line-height: 1.5;
}

.announcements-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.announcements-actions .btn-admin {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    text-decoration: none;
}

.announcements-actions .btn-admin.primary {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
}

.announcements-actions .btn-admin.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.announcements-actions .btn-admin.secondary {
    background: rgba(107, 114, 128, 0.1);
    border: 1px solid rgba(107, 114, 128, 0.3);
    color: #9ca3af;
}

.announcements-actions .btn-admin.secondary:hover {
    background: rgba(107, 114, 128, 0.2);
    color: #d1d5db;
}

/* Lista de comunicados */
.announcements-list {
    min-height: 200px;
}

.announcements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.announcement-card {
    background: rgba(17, 24, 39, 0.8);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 12px;
    padding: 16px;
    transition: all 0.3s ease;
}

.announcement-card:hover {
    border-color: rgba(59, 130, 246, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.announcement-card.active {
    border-color: rgba(34, 197, 94, 0.4);
}

.announcement-card.inactive {
    border-color: rgba(239, 68, 68, 0.4);
    opacity: 0.7;
}

.announcement-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.announcement-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.announcement-type {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.announcement-type.notícia {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
}

.announcement-type.atualização {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.announcement-type.boletim {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
}

.announcement-type.aviso {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.announcement-type.manutenção {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.important-badge {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}

.announcement-status {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}

.announcement-status.active {
    background: rgba(34, 197, 94, 0.2);
    color: #6ee7b7;
}

.announcement-status.inactive {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.announcement-actions {
    display: flex;
    gap: 4px;
}

.btn-edit, .btn-delete {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s ease;
}

.btn-edit {
    background: rgba(59, 130, 246, 0.1);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.btn-edit:hover {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

.btn-delete {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-delete:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.announcement-content {
    margin-bottom: 12px;
}

.announcement-title {
    color: #f9fafb;
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px 0;
    line-height: 1.4;
}

.announcement-preview {
    color: #d1d5db;
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
}

.announcement-footer {
    border-top: 1px solid rgba(59, 130, 246, 0.1);
    padding-top: 8px;
}

.announcement-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: #9ca3af;
}

.announcement-date {
    font-weight: 500;
}

.announcement-author {
    font-style: italic;
}

/* Estados de carregamento e vazio */
.loading-state, .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: #9ca3af;
}

.loading-state i {
    font-size: 24px;
    margin-bottom: 12px;
    color: #60a5fa;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    color: #6b7280;
}

.empty-state h4 {
    color: #d1d5db;
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px 0;
}

.empty-state p {
    color: #9ca3af;
    font-size: 14px;
    margin: 0;
}

/* Modal de comunicados */
.announcement-modal {
    will-change: transform, opacity;
}

/* Conteúdo específico dos comunicados no modal da sidebar */
.sidebar-announcements-modal p {
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
    word-wrap: break-word;
    hyphens: auto;
    max-height: 96px; /* 4 linhas de 24px cada */
    line-height: 1.5;
    margin: 0;
    padding: 0;
}

/* Garantir que o container do card tenha overflow controlado */
.sidebar-announcements-modal .announcement-card {
    overflow: hidden;
    position: relative;
    max-height: 300px;
    display: flex;
    flex-direction: column;
}

/* Container específico para o conteúdo do anúncio */
.sidebar-announcements-modal .announcement-content {
    flex: 1;
    overflow: hidden;
    margin-bottom: 12px;
}

/* Para textos muito longos, permitir scroll se necessário */
.sidebar-announcements-modal .announcement-card:hover p {
    overflow-y: auto;
    max-height: none;
    -webkit-line-clamp: unset;
}

/* Scrollbar para modal de criação/edição */
.announcement-modal::-webkit-scrollbar {
    width: 10px;
}

.announcement-modal::-webkit-scrollbar-track {
    background: rgba(17, 24, 39, 0.2);
    border-radius: 5px;
    margin: 5px;
}

.announcement-modal::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border-radius: 5px;
    border: 1px solid rgba(59, 130, 246, 0.2);
    transition: all 0.3s ease;
}

.announcement-modal::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
    border-color: rgba(59, 130, 246, 0.4);
}

.announcement-modal::-webkit-scrollbar-corner {
    background: rgba(17, 24, 39, 0.2);
}

/* Scrollbar para Firefox - Modal */
.announcement-modal {
    scrollbar-width: thin;
    scrollbar-color: #3b82f6 rgba(17, 24, 39, 0.3);
}

.announcement-modal * {
    box-sizing: border-box;
}

.announcement-modal input,
.announcement-modal textarea,
.announcement-modal select {
    transition: all 0.2s ease;
}

.announcement-modal input:focus,
.announcement-modal textarea:focus,
.announcement-modal select:focus {
    outline: none;
    border-color: rgba(59, 130, 246, 0.6);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Scrollbar para textareas e inputs dentro do modal */
.announcement-modal textarea::-webkit-scrollbar {
    width: 8px;
}

.announcement-modal textarea::-webkit-scrollbar-track {
    background: rgba(17, 24, 39, 0.2);
    border-radius: 4px;
}

.announcement-modal textarea::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border-radius: 4px;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.announcement-modal textarea::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    box-shadow: 0 0 6px rgba(59, 130, 246, 0.3);
}

/* Scrollbar para Firefox - Textareas */
.announcement-modal textarea {
    scrollbar-width: thin;
    scrollbar-color: #3b82f6 rgba(17, 24, 39, 0.3);
}

/* Scrollbar para selects dentro do modal */
.announcement-modal select::-webkit-scrollbar {
    width: 6px;
}

.announcement-modal select::-webkit-scrollbar-track {
    background: rgba(17, 24, 39, 0.2);
    border-radius: 3px;
}

.announcement-modal select::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border-radius: 3px;
}

.announcement-modal select::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
}

/* Scrollbar para Firefox - Selects */
.announcement-modal select {
    scrollbar-width: thin;
    scrollbar-color: #3b82f6 rgba(17, 24, 39, 0.3);
}

/* Barras de rolagem customizadas - Estilos gerais removidos para evitar conflitos */

/* Scrollbar para elementos específicos - Modal de Visualização */
.announcements-modal {
    scrollbar-width: thin;
    scrollbar-color: #3b82f6 rgba(17, 24, 39, 0.3);
}

.announcements-modal::-webkit-scrollbar {
    width: 10px;
}

.announcements-modal::-webkit-scrollbar-track {
    background: rgba(17, 24, 39, 0.2);
    border-radius: 5px;
    margin: 5px;
}

.announcements-modal::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border-radius: 5px;
    border: 1px solid rgba(59, 130, 246, 0.2);
    transition: all 0.3s ease;
}

.announcements-modal::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
    border-color: rgba(59, 130, 246, 0.4);
}

.announcements-modal::-webkit-scrollbar-corner {
    background: rgba(17, 24, 39, 0.2);
}

/* Scrollbar para lista de comunicados */
.announcements-list {
    scrollbar-width: thin;
    scrollbar-color: #3b82f6 rgba(17, 24, 39, 0.3);
}

.announcements-list::-webkit-scrollbar {
    width: 8px;
}

.announcements-list::-webkit-scrollbar-track {
    background: rgba(17, 24, 39, 0.2);
    border-radius: 4px;
    margin: 2px;
}

.announcements-list::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border-radius: 4px;
    border: 1px solid rgba(59, 130, 246, 0.2);
    transition: all 0.3s ease;
}

.announcements-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.3);
    border-color: rgba(59, 130, 246, 0.4);
}

.announcements-list::-webkit-scrollbar-corner {
    background: rgba(17, 24, 39, 0.2);
}

/* Scrollbar para grid de comunicados */
.announcements-grid {
    scrollbar-width: thin;
    scrollbar-color: #3b82f6 rgba(17, 24, 39, 0.3);
}

.announcements-grid::-webkit-scrollbar {
    width: 6px;
}

.announcements-grid::-webkit-scrollbar-track {
    background: rgba(17, 24, 39, 0.2);
    border-radius: 3px;
    margin: 1px;
}

.announcements-grid::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border-radius: 3px;
    border: 1px solid rgba(59, 130, 246, 0.2);
    transition: all 0.3s ease;
}

.announcements-grid::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    box-shadow: 0 0 6px rgba(59, 130, 246, 0.3);
    border-color: rgba(59, 130, 246, 0.4);
}

.announcements-grid::-webkit-scrollbar-corner {
    background: rgba(17, 24, 39, 0.2);
}

/* Responsividade */
@media (max-width: 768px) {
    .announcements-grid {
        grid-template-columns: 1fr;
    }
    
    .announcement-card {
        padding: 12px;
    }
    
    .announcement-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .announcement-actions {
        align-self: flex-end;
    }
    
    .announcements-actions {
        flex-direction: column;
    }
    
    .announcements-actions .btn-admin {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .announcements-modal {
        max-width: 95% !important;
        padding: 20px !important;
        margin: 0 10px;
    }
    
    .announcements-modal h3 {
        font-size: 18px !important;
    }
    
    .announcement-card {
        padding: 10px;
    }
    
    .announcement-title {
        font-size: 14px;
    }
    
    .announcement-preview {
        font-size: 13px;
    }
}

/* ===========================================
   MODAL INDIVIDUAL DE COMUNICADO
   =========================================== */

.announcement-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 2147483640;
}

.announcement-modal-single {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: #f9fafb;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
    z-index: 2147483641;
    max-width: 700px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    border: 1px solid rgba(59, 130, 246, 0.3);
    backdrop-filter: blur(25px);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Barra de rolagem igual à janela de comunicados */
.announcement-modal-single::-webkit-scrollbar {
    width: 8px;
}

.announcement-modal-single::-webkit-scrollbar-track {
    background: rgba(17, 24, 39, 0.2);
    border-radius: 4px;
}

.announcement-modal-single::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.3);
    border-radius: 4px;
    transition: background 0.2s ease;
}

.announcement-modal-single::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.5);
}

.announcement-modal-single::-webkit-scrollbar-corner {
    background: rgba(17, 24, 39, 0.2);
}

/* Responsividade para mobile */
@media (max-width: 768px) {
    .announcement-modal-single {
        max-width: 95% !important;
        padding: 20px !important;
        margin: 0 10px;
        max-height: 85vh;
    }
}
