/**
 * Law Widgets Frontend Styles
 * Version: 1.0.0
 */

/* ========================================
   Estilos Globais para Ambos Widgets
======================================== */

.law-temas-widget,
.law-bancas-widget {
    width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    box-sizing: border-box;
}

/* ========================================
   Estados de Loading
======================================== */

.law-widgets-loading {
    position: relative;
    opacity: 0.6;
    pointer-events: none;
}

.law-widgets-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid #48bb78;
    border-top-color: transparent;
    border-radius: 50%;
    animation: law-widgets-spin 0.8s linear infinite;
    z-index: 100;
    background: rgba(45, 55, 72, 0.9);
}

@keyframes law-widgets-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   Notificações
======================================== */

.law-widgets-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-width: 300px;
    font-size: 14px;
    color: white;
    font-weight: 500;
    animation: law-widgets-slide-in-right 0.3s ease-out;
}

@keyframes law-widgets-slide-in-right {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ========================================
   Grifos Decorativos - CORRIGIDO
======================================== */

.law-temas-grifo,
.law-bancas-grifo {
    position: relative;
    margin-bottom: 10px;
    width: 100%;
}

.law-temas-grifo::after,
.law-bancas-grifo::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background-color: #48bb78;
    border-radius: 2px;
    margin: 0; /* Remove margin automático */
}

/* ========================================
   Campos de Busca
======================================== */

.law-temas-search,
.law-bancas-search {
    margin-bottom: 20px;
}

.law-temas-search input,
.law-bancas-search input {
    width: 100%;
    border: 1px solid #4a5568;
    outline: none;
    transition: all 0.3s ease;
    box-sizing: border-box;
    padding: 10px 15px;
    background-color: #4a5568;
    color: #ffffff;
    border-radius: 6px;
}

.law-temas-search input:focus,
.law-bancas-search input:focus {
    outline: none;
    border-color: #48bb78;
    box-shadow: 0 0 0 3px rgba(72, 187, 120, 0.1);
}

.law-temas-search input::placeholder,
.law-bancas-search input::placeholder {
    color: #a0aec0;
    opacity: 0.7;
}

/* ========================================
   Controles (Botões + Reset)
======================================== */

.law-temas-controls,
.law-bancas-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
    flex-wrap: wrap;
}

.law-temas-time-buttons,
.law-bancas-time-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ========================================
   Botões de Tempo - ESTILOS BASE SEM ESPECIFICIDADE EXCESSIVA
======================================== */

.law-temas-time-button,
.law-bancas-time-button {
    padding: 8px 16px;
    border: 1px solid #4a5568;
    background-color: #4a5568;
    color: #a0aec0;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
}

/* ========================================
   Botões Reset - ESTILOS BASE
======================================== */

.law-temas-reset-container,
.law-bancas-reset-container {
    margin-left: auto;
}

.law-temas-reset-button,
.law-bancas-reset-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid #e53e3e;
    background: transparent;
    color: #e53e3e;
    cursor: pointer;
    font-size: 14px;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
}

/* ÍCONES DOS BOTÕES RESET - PROTEÇÃO MÁXIMA PARA GARANTIR VISIBILIDADE */
.law-temas-reset-button i,
.law-temas-reset-button svg,
.law-bancas-reset-button i,
.law-bancas-reset-button svg {
    display: inline-block !important;
    margin-right: 8px !important;
    font-size: 14px !important;
    opacity: 1 !important;
    visibility: visible !important;
    width: auto !important;
    height: auto !important;
    min-width: 14px !important;
    min-height: 14px !important;
    flex-shrink: 0 !important;
}

/* Proteção para SVGs específica */
.law-temas-reset-button svg,
.law-bancas-reset-button svg {
    width: 14px !important;
    height: 14px !important;
    fill: currentColor !important;
}

.law-temas-reset-button svg path,
.law-bancas-reset-button svg path {
    fill: currentColor !important;
}

/* ========================================
   Efeitos Hover dos Botões - REMOVIDO !IMPORTANT EXCESSIVO
======================================== */

/* Hover básico para botões de tempo */
.law-temas-time-button:hover:not(.active),
.law-bancas-time-button:hover:not(.active) {
    color: #ffffff;
    background-color: #5a6c7d;
    transform: translateY(-1px);
}

/* Estado ativo dos botões de tempo */
.law-temas-time-button.active,
.law-bancas-time-button.active {
    background-color: #48bb78;
    border-color: #48bb78;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(72, 187, 120, 0.3);
}

/* Hover dos botões ativo - manter estado ativo */
.law-temas-time-button.active:hover,
.law-bancas-time-button.active:hover {
    background-color: #48bb78;
    border-color: #48bb78;
    color: #ffffff;
}

/* Hover dos botões reset */
.law-temas-reset-button:hover,
.law-bancas-reset-button:hover {
    background-color: #e53e3e;
    color: #ffffff;
    transform: translateY(-1px);
}

/* EFEITOS HOVER AVANÇADOS - APLICADOS VIA CLASSES ESPECÍFICAS */

/* Efeito crescer */
.law-temas-time-button.hover-effect-grow:hover,
.law-bancas-time-button.hover-effect-grow:hover,
.law-temas-reset-button.hover-effect-grow:hover,
.law-bancas-reset-button.hover-effect-grow:hover {
    transform: scale(1.05) translateY(-2px);
}

/* Efeito elevar */
.law-temas-time-button.hover-effect-elevate:hover,
.law-bancas-time-button.hover-effect-elevate:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.law-temas-reset-button.hover-effect-elevate:hover,
.law-bancas-reset-button.hover-effect-elevate:hover {
    box-shadow: 0 4px 12px rgba(229, 62, 62, 0.3);
    transform: translateY(-2px);
}

/* Ambos os efeitos juntos */
.law-temas-time-button.hover-effect-grow_elevate:hover,
.law-bancas-time-button.hover-effect-grow_elevate:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.law-temas-reset-button.hover-effect-grow_elevate:hover,
.law-bancas-reset-button.hover-effect-grow_elevate:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 4px 12px rgba(229, 62, 62, 0.3);
}

/* ========================================
   Containers de Tabelas
======================================== */

.law-temas-table-container,
.law-bancas-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: relative;
}

/* Indicadores de scroll */
.law-temas-table-container::before,
.law-bancas-table-container::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 20px;
    height: 100%;
    background: linear-gradient(to left, rgba(45, 55, 72, 0.8), transparent);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 2;
}

.law-temas-table-container.scroll-right::before,
.law-bancas-table-container.scroll-right::before {
    opacity: 1;
}

/* ========================================
   Tabelas
======================================== */

.law-temas-table,
.law-bancas-table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    background-color: transparent;
}

.law-temas-table {
    min-width: 800px;
}

.law-bancas-table {
    min-width: 900px;
}

.law-temas-table th,
.law-temas-table td,
.law-bancas-table th,
.law-bancas-table td {
    border: 1px solid #4a5568;
    vertical-align: middle;
    text-align: left;
    padding: 12px 16px;
}

.law-temas-table th,
.law-bancas-table th {
    background-color: #2d3748;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    color: #a0aec0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.law-temas-table tbody tr,
.law-bancas-table tbody tr {
    transition: all 0.2s ease;
    background-color: transparent;
}

.law-temas-table tbody tr:hover,
.law-bancas-table tbody tr:hover {
    background-color: rgba(72, 187, 120, 0.05);
}

/* ========================================
   Badges
======================================== */

.law-temas-area-badge,
.law-bancas-area-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    /* Valores padrão que podem ser sobrescritos pelos controles do Elementor */
    background-color: #48bb78;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    border: none;
}

.law-bancas-banca-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    /* Valores padrão que podem ser sobrescritos pelos controles do Elementor */
    background-color: #3182ce;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    border: none;
}

/* ========================================
   Temas/Assuntos
======================================== */

.law-temas-tema-assunto,
.law-bancas-tema-assunto {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ffffff;
}

.law-temas-tema-assunto i,
.law-bancas-tema-assunto i {
    color: #a0aec0;
    font-size: 14px;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}

/* ========================================
   Colunas de Estatísticas
======================================== */

.law-temas-stats-column,
.law-bancas-stats-column {
    text-align: center;
    font-weight: 500;
    color: #ffffff;
}

/* ========================================
   Percentuais
======================================== */

.law-temas-percentage,
.law-bancas-percentage {
    font-weight: bold;
    font-size: 12px;
    position: relative;
    overflow: hidden;
    display: inline-block;
    min-width: 45px;
    text-align: center;
    color: #ffffff;
    /* Valores padrão que podem ser sobrescritos pelos controles do Elementor */
    padding: 4px 8px;
    border-radius: 5px;
    border: none;
}

.law-temas-percentage.high,
.law-bancas-percentage.high {
    background-color: #48bb78;
}

.law-temas-percentage.medium,
.law-bancas-percentage.medium {
    background-color: #ed8936;
}

.law-temas-percentage.low,
.law-bancas-percentage.low {
    background-color: #e53e3e;
}

/* Efeito Shimmer nos Percentuais */
.law-temas-percentage::before,
.law-bancas-percentage::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.law-temas-percentage:hover::before,
.law-bancas-percentage:hover::before {
    left: 100%;
}

/* ========================================
   Responsividade - Tablet
======================================== */

@media (max-width: 1024px) {
    .law-temas-table,
    .law-bancas-table {
        font-size: 13px;
    }

    .law-temas-table th,
    .law-temas-table td,
    .law-bancas-table th,
    .law-bancas-table td {
        padding: 10px 12px;
    }
}

/* ========================================
   Responsividade - Mobile
======================================== */

@media (max-width: 768px) {
    .law-temas-controls,
    .law-bancas-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .law-temas-time-buttons,
    .law-bancas-time-buttons {
        justify-content: center;
        order: 2;
        gap: 8px;
    }

    .law-temas-reset-container,
    .law-bancas-reset-container {
        margin-left: 0;
        order: 1;
        align-self: flex-end;
    }

    .law-temas-table,
    .law-bancas-table {
        font-size: 12px;
    }

    .law-temas-table th,
    .law-temas-table td,
    .law-bancas-table th,
    .law-bancas-table td {
        padding: 8px 6px;
    }

    .law-temas-time-button,
    .law-bancas-time-button {
        font-size: 12px;
        padding: 6px 12px;
    }

    .law-temas-reset-button,
    .law-bancas-reset-button {
        font-size: 12px;
        padding: 6px 12px;
    }

    .law-temas-area-badge,
    .law-bancas-area-badge,
    .law-bancas-banca-badge {
        font-size: 10px;
        padding: 3px 6px;
    }

    .law-temas-tema-assunto,
    .law-bancas-tema-assunto {
        gap: 6px;
    }

    .law-temas-tema-assunto i,
    .law-bancas-tema-assunto i {
        font-size: 12px;
        width: 14px;
    }
}

/* ========================================
   Responsividade - Mobile Pequeno
======================================== */

@media (max-width: 480px) {
    .law-temas-time-buttons,
    .law-bancas-time-buttons {
        flex-direction: column;
        width: 100%;
    }

    .law-temas-time-button,
    .law-bancas-time-button {
        width: 100%;
        text-align: center;
    }

    .law-temas-reset-button,
    .law-bancas-reset-button {
        width: 100%;
        justify-content: center;
    }
}

/* ========================================
   Animações e Transições
======================================== */

.law-widgets-fade-in {
    animation: law-widgets-fade-in 0.5s ease-out;
}

@keyframes law-widgets-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.law-widgets-slide-in {
    animation: law-widgets-slide-in 0.3s ease-out;
}

@keyframes law-widgets-slide-in {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ========================================
   Acessibilidade
======================================== */

.law-temas-time-button:focus,
.law-bancas-time-button:focus,
.law-temas-reset-button:focus,
.law-bancas-reset-button:focus {
    outline: 2px solid #48bb78;
    outline-offset: 2px;
}

.law-temas-search input:focus,
.law-bancas-search input:focus {
    outline: 2px solid #48bb78;
    outline-offset: 1px;
}

/* Screen readers */
.law-widgets-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ========================================
   Utilidades
======================================== */

.law-widgets-hidden {
    display: none !important;
}

.law-widgets-visible {
    display: block !important;
}

.law-widgets-text-center {
    text-align: center !important;
}

.law-widgets-text-left {
    text-align: left !important;
}

.law-widgets-text-right {
    text-align: right !important;
}

/* ========================================
   Dark Mode Support
======================================== */

@media (prefers-color-scheme: dark) {
    .law-temas-widget,
    .law-bancas-widget {
        color-scheme: dark;
    }
}

/* ========================================
   Print Styles
======================================== */

@media print {
    .law-temas-controls,
    .law-bancas-controls {
        display: none;
    }

    .law-temas-table,
    .law-bancas-table {
        border-collapse: collapse;
        width: 100%;
        font-size: 10px;
    }

    .law-temas-percentage,
    .law-bancas-percentage {
        background: none !important;
        color: black !important;
        border: 1px solid #000;
    }
}