/* ============================================
   FILTROS MODERNOS - CARREIRA PÚBLICA
   Versão: 2.0 - Sistema Completo com UX Aprimorada
============================================ */

/* ============================================
   BOTÃO FLUTUANTE (COM CONTADOR)
============================================ */
.btn-filtro-flutuante {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 9998;
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    color: #fff;
    border: none;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-filtro-flutuante:hover {
    transform: translateY(-50%) scale(1.08);
    box-shadow: 0 8px 30px rgba(37, 99, 235, 0.6);
}

.btn-filtro-flutuante:active {
    transform: translateY(-50%) scale(0.95);
}

.btn-filtro-flutuante.filtros-ativos {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
}

.btn-filtro-flutuante.filtros-ativos:hover {
    box-shadow: 0 8px 30px rgba(16, 185, 129, 0.6);
}

.btn-filtro-flutuante svg {
    width: 22px;
    height: 22px;
    stroke-width: 2.5;
}

.btn-filtro-flutuante span {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Badge contador */
.filtro-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: 700;
    min-width: 22px;
    height: 22px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ============================================
   OVERLAY ESCURO
============================================ */
.filtro-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.filtro-overlay.ativo {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   SIDEBAR LATERAL ESQUERDA
============================================ */
.filtro-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 380px;
    max-width: 90vw;
    height: 100vh;
    background: #fff;
    z-index: 10000;
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 40px rgba(0, 0, 0, 0.15);
}

.filtro-sidebar.aberto {
    transform: translateX(0);
}

/* ============================================
   HEADER DA SIDEBAR
============================================ */
.filtro-sidebar-header {
    padding: 28px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    flex-shrink: 0;
}

.filtro-sidebar-header h3 {
    font-size: 1.4em;
    margin: 0;
    font-weight: 700;
    color: #fff !important;
    letter-spacing: -0.02em;
}

.btn-fechar-filtro {
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.btn-fechar-filtro:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: rotate(90deg);
}

.btn-fechar-filtro:active {
    transform: rotate(90deg) scale(0.9);
}

.btn-fechar-filtro svg {
    width: 24px;
    height: 24px;
    stroke: #fff;
    stroke-width: 2.5;
}

/* ============================================
   BODY DA SIDEBAR
============================================ */
.filtro-sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 28px;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}

.filtro-sidebar-body::-webkit-scrollbar {
    width: 8px;
}

.filtro-sidebar-body::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.filtro-sidebar-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.filtro-sidebar-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ============================================
   CHIPS DE FILTROS APLICADOS
============================================ */
.filtros-aplicados {
    margin-bottom: 28px;
    padding: 20px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
    border-radius: 12px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.filtros-aplicados-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.filtros-aplicados-titulo {
    font-size: 0.9em;
    font-weight: 600;
    color: #0c4a6e;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-limpar-todos {
    background: transparent;
    border: none;
    color: #0369a1;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.btn-limpar-todos:hover {
    color: #0c4a6e;
}

.filtros-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.filtro-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #bae6fd;
    border-radius: 20px;
    font-size: 0.9em;
    color: #0c4a6e;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    animation: chipAppear 0.3s ease;
}

@keyframes chipAppear {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.filtro-chip-label {
    font-weight: 600;
}

.filtro-chip-value {
    font-weight: 400;
}

.filtro-chip-remover {
    background: transparent;
    border: none;
    padding: 2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 4px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.filtro-chip-remover:hover {
    background: #fee2e2;
}

.filtro-chip-remover svg {
    width: 14px;
    height: 14px;
    stroke: #ef4444;
}

/* ============================================
   GRUPOS DE FILTRO
============================================ */
.filtro-grupo-sidebar {
    margin-bottom: 26px;
}

.filtro-grupo-sidebar label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95em;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 10px;
}

.filtro-icone {
    color: #6b7280;
    flex-shrink: 0;
}

.filtro-select-sidebar {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 1em;
    color: #1f2937;
    background-color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 44px;
}

.filtro-select-sidebar:hover {
    border-color: #2563eb;
    background-color: #f9fafb;
}

.filtro-select-sidebar:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

/* ============================================
   AÇÕES DA SIDEBAR
============================================ */
.filtro-sidebar-acoes {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 32px;
    padding-top: 28px;
    border-top: 1px solid #e5e7eb;
}

.btn-aplicar-sidebar {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-aplicar-sidebar:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.btn-aplicar-sidebar:active {
    transform: translateY(0);
}

.btn-aplicar-sidebar svg {
    width: 18px;
    height: 18px;
}

.btn-limpar-sidebar {
    width: 100%;
    padding: 14px 24px;
    background: #f9fafb;
    color: #6b7280;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 0.95em;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-limpar-sidebar:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: #374151;
}

.btn-limpar-sidebar svg {
    width: 18px;
    height: 18px;
}

/* ============================================
   ÍCONE BRIEFCASE (CARREIRA)
============================================ */
.registro-carreira .briefcase-icon {
    width: 16px;
    height: 16px;
    color: #fff;
    fill: #fff;
    stroke: none;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { 
        transform: scale(1); 
        opacity: 1;
    }
    50% { 
        transform: scale(1.1); 
        opacity: 0.9;
    }
}

/* ============================================
   RESPONSIVO - MOBILE
============================================ */
@media (max-width: 768px) {
    .filtro-sidebar {
        width: 100%;
        max-width: 100vw;
    }
    
    .btn-filtro-flutuante {
        width: 56px;
        height: 56px;
        left: 16px;
    }
    
    .btn-filtro-flutuante svg {
        width: 20px;
        height: 20px;
    }
    
    .btn-filtro-flutuante span {
        font-size: 8px;
    }
    
    .filtro-badge {
        min-width: 20px;
        height: 20px;
        font-size: 10px;
    }
    
    .filtro-sidebar-header {
        padding: 22px;
    }
    
    .filtro-sidebar-header h3 {
        font-size: 1.2em;
    }
    
    .btn-fechar-filtro {
        width: 38px;
        height: 38px;
    }
    
    .btn-fechar-filtro svg {
        width: 22px;
        height: 22px;
    }
    
    .filtro-sidebar-body {
        padding: 22px;
    }
    
    .filtros-aplicados {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .btn-filtro-flutuante {
        width: 52px;
        height: 52px;
        left: 12px;
    }
    
    .filtro-sidebar-header {
        padding: 18px;
    }
    
    .filtro-sidebar-header h3 {
        font-size: 1.1em;
    }
    
    .filtro-sidebar-body {
        padding: 18px;
    }
    
    .filtro-grupo-sidebar {
        margin-bottom: 22px;
    }
    
    .filtro-select-sidebar {
        padding: 12px 14px;
        padding-right: 40px;
    }
    
    .btn-aplicar-sidebar {
        padding: 14px 20px;
    }
}

/* ============================================
   ACESSIBILIDADE
============================================ */
.filtro-sidebar:focus-within {
    outline: none;
}

.btn-filtro-flutuante:focus-visible,
.btn-fechar-filtro:focus-visible,
.filtro-select-sidebar:focus-visible,
.btn-aplicar-sidebar:focus-visible,
.btn-limpar-sidebar:focus-visible,
.filtro-chip-remover:focus-visible,
.btn-limpar-todos:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 2px;
}

/* Reduzir animações para usuários com preferência */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   LOADING STATE (OPCIONAL)
============================================ */
.btn-aplicar-sidebar.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.btn-aplicar-sidebar.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}