/* ===================================
   Sistema de Gestão de Cargos e Funções
   Estilos Customizados
   =================================== */

/* Font Family */
.font-inter {
    font-family: 'Inter', sans-serif;
}

/* Sidebar Navigation - Sprint v5.0.10: Padronizar com tema Cantara (dourado) */
.nav-link.active {
    background-color: rgba(184, 134, 11, 0.25);
    color: #B8860B;
    border-left: 3px solid #B8860B;
}

.nav-link:hover {
    background-color: rgba(184, 134, 11, 0.15);
    color: #DAA520;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Modal Animations */
.modal {
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal > div {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* STACK-001: Botão Voltar no header das modais */
[data-modal-back-btn] {
    flex-shrink: 0;
    cursor: pointer;
    user-select: none;
}

[data-modal-back-btn]:focus-visible {
    outline: 2px solid #B8860B;
    outline-offset: 2px;
}

/* STACK-001: Transição suave ao aplicar bordas de stack */
.modal > div {
    transition: border 0.3s ease, box-shadow 0.3s ease;
}

/* Table Styles */
table tbody tr {
    transition: background-color 0.15s ease;
}

table tbody tr:hover {
    background-color: #f9fafb;
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-ativo {
    background-color: #dcfce7;
    color: #166534;
}

.badge-inativo {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-em_revisao,
.badge-em_revisão {
    background-color: #fef3c7;
    color: #92400e;
}

/* Level Badges */
.badge-estrategico {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-tatico {
    background-color: #e0e7ff;
    color: #3730a3;
}

.badge-operacional {
    background-color: #f3e8ff;
    color: #6b21a8;
}

/* Organograma Styles */
.organograma {
    overflow-x: auto;
    padding: 20px;
}

.org-tree {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* SPRINT 6B: Corrigido posicionamento dos nós */
.org-node {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    margin-bottom: 20px;
}

/* SPRINT 6B: Melhorado espaçamento dos cards */
.org-card {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px 24px;
    text-align: center;
    min-width: 200px;
    max-width: 280px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    z-index: 1;
}

.org-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
    transform: translateY(-2px);
}

.org-card.nivel-estrategico {
    border-left: 4px solid #3b82f6;
}

.org-card.nivel-tatico {
    border-left: 4px solid #8b5cf6;
}

.org-card.nivel-operacional {
    border-left: 4px solid #10b981;
}

.org-card-title {
    font-weight: 600;
    color: #1f2937;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.org-card-dept {
    font-size: 0.75rem;
    color: #6b7280;
}

.org-card-level {
    font-size: 0.7rem;
    color: #9ca3af;
    margin-top: 4px;
}

/* SPRINT 6B: Correção de sobreposição no organograma */
.org-children {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 40px;
    margin-top: 50px;
    position: relative;
    padding: 0 20px;
}

.org-children::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 20px;
    background-color: #d1d5db;
}

.org-node::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 20px;
    background-color: #d1d5db;
}

.org-node:first-child::before,
.org-tree > .org-node::before {
    display: none;
}

.org-children > .org-node:not(:only-child)::after {
    content: '';
    position: absolute;
    top: -20px;
    width: 100%;
    height: 2px;
    background-color: #d1d5db;
}

.org-children > .org-node:first-child::after {
    left: 50%;
    width: 50%;
}

.org-children > .org-node:last-child::after {
    right: 50%;
    width: 50%;
}

.org-children > .org-node:only-child::after {
    display: none;
}

/* Print Styles */
@media print {
    body {
        background: white !important;
    }
    
    #sidebar,
    header,
    .no-print {
        display: none !important;
    }
    
    main {
        margin-left: 0 !important;
    }
    
    .print-content {
        padding: 0 !important;
    }
    
    .page-break {
        page-break-after: always;
    }
    
    .relatorio-container {
        box-shadow: none !important;
        border: 1px solid #ddd;
    }
}

/* Relatório Styles */
.relatorio-container {
    background: white;
    padding: 40px;
    max-width: 210mm;
    margin: 0 auto;
}

.relatorio-header {
    border-bottom: 3px solid #3b82f6;
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.relatorio-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 8px;
}

.relatorio-subtitle {
    font-size: 0.875rem;
    color: #6b7280;
}

.relatorio-section {
    margin-bottom: 30px;
}

.relatorio-section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 8px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.relatorio-section-title i {
    color: #3b82f6;
}

.relatorio-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.relatorio-table th,
.relatorio-table td {
    border: 1px solid #e5e7eb;
    padding: 12px;
    text-align: left;
}

.relatorio-table th {
    background-color: #f9fafb;
    font-weight: 600;
    color: #374151;
}

.relatorio-table tr:nth-child(even) {
    background-color: #f9fafb;
}

.relatorio-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.relatorio-info-item {
    display: flex;
    flex-direction: column;
}

.relatorio-info-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.relatorio-info-value {
    font-size: 0.875rem;
    color: #1f2937;
}

.relatorio-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.relatorio-list li {
    padding: 8px 0;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.relatorio-list li::before {
    content: '•';
    color: #3b82f6;
    font-weight: bold;
}

.relatorio-list li:last-child {
    border-bottom: none;
}

/* Função Card */
.funcao-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    transition: all 0.2s ease;
}

.funcao-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.funcao-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.funcao-tipo {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
}

.funcao-tipo.funcao-principal {
    background-color: #dbeafe;
    color: #1e40af;
}

.funcao-tipo.responsabilidade {
    background-color: #dcfce7;
    color: #166534;
}

.funcao-tipo.atividade-diaria {
    background-color: #fef3c7;
    color: #92400e;
}

.funcao-tipo.atividade-periodica {
    background-color: #e0e7ff;
    color: #3730a3;
}

.funcao-tipo.atividade-eventual {
    background-color: #f3e8ff;
    color: #6b21a8;
}

/* Salário Card */
.salario-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 24px;
    color: white;
    position: relative;
    overflow: hidden;
}

.salario-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
}

.salario-card-nivel {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.salario-card-values {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.salario-value {
    text-align: center;
}

.salario-value-label {
    font-size: 0.7rem;
    opacity: 0.8;
    text-transform: uppercase;
}

.salario-value-amount {
    font-size: 1rem;
    font-weight: 600;
}

.salario-card-info {
    font-size: 0.8rem;
    opacity: 0.9;
    border-top: 1px solid rgba(255,255,255,0.2);
    padding-top: 12px;
    margin-top: 12px;
}

/* Toast Animation */
.toast-show {
    transform: translateY(0) !important;
    opacity: 1 !important;
}

/* Responsive Adjustments */
@media (max-width: 1024px) {
    #sidebar {
        transform: translateX(-100%);
    }
    
    #sidebar.open {
        transform: translateX(0);
    }
    
    main {
        margin-left: 0 !important;
    }
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #9ca3af;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h4 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.875rem;
}

/* Hover Effects */
.hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* Focus Styles */
input:focus,
select:focus,
textarea:focus {
    outline: none;
    ring: 2;
    ring-color: #3b82f6;
}

/* Button Styles */
.btn-primary {
    background-color: #3b82f6;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.btn-primary:hover {
    background-color: #2563eb;
}

.btn-secondary {
    background-color: #f3f4f6;
    color: #374151;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.btn-secondary:hover {
    background-color: #e5e7eb;
}

.btn-danger {
    background-color: #ef4444;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.btn-danger:hover {
    background-color: #dc2626;
}

/* Action Buttons in Tables */
.action-btn {
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.action-btn-edit {
    color: #3b82f6;
    background-color: #dbeafe;
}

.action-btn-edit:hover {
    background-color: #bfdbfe;
}

.action-btn-delete {
    color: #ef4444;
    background-color: #fee2e2;
}

.action-btn-delete:hover {
    background-color: #fecaca;
}

.action-btn-view {
    color: #10b981;
    background-color: #d1fae5;
}

.action-btn-view:hover {
    background-color: #a7f3d0;
}

/* Badges de Tipo de Contratação */
.badge-tipo-clt {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-tipo-pj {
    background-color: #dcfce7;
    color: #166534;
}

.badge-tipo-cooperativa {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-tipo-estagio {
    background-color: #e0e7ff;
    color: #3730a3;
}

.badge-tipo-aprendiz {
    background-color: #fce7f3;
    color: #9d174d;
}

.badge-tipo-temporario {
    background-color: #f3e8ff;
    color: #6b21a8;
}

/* Cards de Salário por Tipo */
.salario-card-clt {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}

.salario-card-pj {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.salario-card-cooperativa {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.salario-card-estagio {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
}

.salario-card-aprendiz {
    background: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
}

.salario-card-temporario {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

/* Tabs de Benefícios */
.tab-beneficio {
    transition: all 0.2s ease;
}

.tab-beneficio.active {
    border-color: #3b82f6;
    color: #2563eb;
}

.tab-beneficio:not(.active):hover {
    color: #374151;
    border-color: #d1d5db;
}

/* Cards de Benefício */
.beneficio-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    transition: all 0.2s ease;
}

.beneficio-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
}

.beneficio-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.beneficio-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.beneficio-icon.saude { background-color: #fee2e2; color: #dc2626; }
.beneficio-icon.alimentacao { background-color: #fef3c7; color: #d97706; }
.beneficio-icon.transporte { background-color: #dbeafe; color: #2563eb; }
.beneficio-icon.educacao { background-color: #e0e7ff; color: #4f46e5; }
.beneficio-icon.previdencia { background-color: #dcfce7; color: #16a34a; }
.beneficio-icon.seguros { background-color: #f3e8ff; color: #7c3aed; }
.beneficio-icon.bem-estar { background-color: #fce7f3; color: #db2777; }
.beneficio-icon.outros { background-color: #f3f4f6; color: #6b7280; }

/* Resumo de Custos */
.custo-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}

.custo-card-valor {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.custo-card-label {
    font-size: 0.75rem;
    color: #6b7280;
    text-transform: uppercase;
}

/* Forma de Pagamento Badges */
.badge-forma-mensal {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-forma-hora {
    background-color: #dcfce7;
    color: #166534;
}

.badge-forma-atividade {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-forma-projeto {
    background-color: #f3e8ff;
    color: #6b21a8;
}

/* ===================================
   Organograma com Pessoas
   =================================== */

.org-expanded {
    transform: scale(1.1);
    transform-origin: top center;
}

.org-card.nivel-estrategico {
    border-color: #3b82f6;
    background: linear-gradient(to bottom right, #eff6ff, #dbeafe);
}

.org-card.nivel-tatico {
    border-color: #8b5cf6;
    background: linear-gradient(to bottom right, #f5f3ff, #e0e7ff);
}

.org-card.nivel-operacional {
    border-color: #10b981;
    background: linear-gradient(to bottom right, #ecfdf5, #d1fae5);
}

.org-pessoas {
    max-height: 120px;
    overflow-y: auto;
    border-top: 1px solid #e5e7eb;
    padding-top: 8px;
    margin-top: 8px;
}

.org-card-count {
    border-top: 1px solid #e5e7eb;
    padding-top: 6px;
}

/* SPRINT 6B: Responsividade e prevenção de sobreposição */
@media (max-width: 1200px) {
    .org-children {
        gap: 20px;
    }
    .org-card {
        min-width: 160px;
        max-width: 220px;
        padding: 12px 16px;
    }
}

@media (max-width: 768px) {
    .org-children {
        flex-direction: column;
        align-items: center;
        gap: 30px;
    }
    .org-tree {
        transform: scale(0.9);
        transform-origin: top center;
    }
}

/* Container do organograma com scroll */
.organograma-container {
    overflow: auto;
    padding: 20px;
    min-height: 400px;
}

/* Organograma Print Styles */
@media print {
    .org-tree {
        transform: scale(0.85);
        transform-origin: top center;
    }
    
    .org-card {
        page-break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #d1d5db;
    }
}

/* ===================================
   Status Badges Adicionais
   =================================== */

.badge-afastado {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-ferias {
    background-color: #dbeafe;
    color: #1e40af;
}

/* ===================================
   Toast Notifications
   =================================== */

#toast {
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

#toast.toast-show {
    opacity: 1;
    visibility: visible;
}

/* ===================================
   Responsive Adjustments
   =================================== */

@media (max-width: 1024px) {
    #sidebar {
        transform: translateX(-100%);
    }
    
    #sidebar.open {
        transform: translateX(0);
    }
    
    main {
        margin-left: 0 !important;
    }
    
    .org-children {
        flex-direction: column;
        gap: 20px;
    }
    
    .org-children::before {
        display: none;
    }
    
    .org-children > .org-node::after {
        display: none;
    }
}

@media (max-width: 768px) {
    .relatorio-info-grid {
        grid-template-columns: 1fr;
    }
    
    .relatorio-table {
        font-size: 0.75rem;
    }
    
    .relatorio-table th,
    .relatorio-table td {
        padding: 8px;
    }
}

/* ===================================
   Hover Effects
   =================================== */

.hover-scale:hover {
    transform: scale(1.02);
}

.hover-shadow:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* ===================================
   Loading States
   =================================== */

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ===================================
   MENU NO TOPO COM HOVER DROPDOWN
   Sprint 87 - Corrigido layout horizontal
   =================================== */

/* Esconder sidebar quando usar menu no topo */
body.menu-topo-ativo #sidebar {
    display: none !important;
}

body.menu-topo-ativo main {
    margin-left: 0 !important;
    padding-top: 70px !important;
}

body.menu-topo-ativo .main-header {
    margin-top: 0 !important;
}

/* Navbar Superior - LAYOUT HORIZONTAL FORÇADO */
/* Sprint v5.0.10: Padronizar cores com menu vertical (Grupo Cantara) */
#topNavbar,
.top-navbar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 60px !important;
    min-height: 60px !important;
    max-height: 60px !important;
    background: linear-gradient(180deg, #1A1A1A 0%, #333333 100%) !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    padding: 0 20px !important;
    z-index: 10000 !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3) !important;
    overflow: visible !important;
}

/* Quando está hidden, esconde completamente */
#topNavbar.hidden,
.top-navbar.hidden {
    display: none !important;
}

.top-navbar-brand {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 10px !important;
    color: white !important;
    font-weight: 700 !important;
    font-size: 1.1rem !important;
    margin-right: 30px !important;
    flex-shrink: 0 !important;
}

.top-navbar-brand i {
    font-size: 1.3rem !important;
    color: #B8860B !important;
}

/* Container do menu - HORIZONTAL */
.top-navbar-menu {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    flex: 1 !important;
    gap: 4px !important;
    height: 100% !important;
    overflow: visible !important;
}

/* Item de menu (dropdown parent) - INLINE */
.top-nav-item {
    position: relative !important;
    display: inline-flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    height: 60px !important;
    z-index: 100 !important;
}

/* Garantir que o hover funcione */
.top-nav-item:hover {
    z-index: 10002 !important;
}

/* Link do menu - HORIZONTAL */
.top-nav-link {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 0 14px !important;
    height: 60px !important;
    color: #e2e8f0 !important;
    font-size: 0.85rem !important;
    font-weight: 500 !important;
    border-radius: 0 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    white-space: nowrap !important;
    text-decoration: none !important;
    background: transparent !important;
    border: none !important;
}

.top-nav-link:hover {
    background-color: rgba(184, 134, 11, 0.15) !important;
    color: #DAA520 !important;
}

.top-nav-link.active {
    background-color: rgba(184, 134, 11, 0.25) !important;
    color: #B8860B !important;
    border-bottom: 3px solid #B8860B !important;
}

.top-nav-link i {
    font-size: 0.9rem !important;
}

.top-nav-link .fa-chevron-down {
    font-size: 0.65rem !important;
    margin-left: 4px !important;
    transition: transform 0.2s ease !important;
}

.top-nav-item:hover .top-nav-link .fa-chevron-down {
    transform: rotate(180deg) !important;
}

/* Dropdown Menu - Posicionado abaixo */
.top-nav-dropdown {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    min-width: 240px !important;
    background: white !important;
    border-radius: 0 0 8px 8px !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25) !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateY(-10px) !important;
    transition: all 0.2s ease !important;
    z-index: 10001 !important;
    padding: 8px 0 !important;
    border: 1px solid #e5e7eb !important;
    border-top: 3px solid #B8860B !important;
    display: none !important;
    flex-direction: column !important;
    pointer-events: none !important;
}

/* HOVER: Mostrar dropdown */
.top-nav-item:hover > .top-nav-dropdown,
.top-nav-item:focus-within > .top-nav-dropdown {
    display: flex !important;
    flex-direction: column !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
    pointer-events: auto !important;
}

.top-nav-dropdown-item {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 10px 16px !important;
    color: #374151 !important;
    font-size: 0.85rem !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    text-decoration: none !important;
    background: transparent !important;
}

.top-nav-dropdown-item:hover {
    background-color: rgba(184, 134, 11, 0.1) !important;
    color: #B8860B !important;
}

.top-nav-dropdown-item.active {
    background-color: rgba(184, 134, 11, 0.15) !important;
    color: #B8860B !important;
    font-weight: 500 !important;
}

.top-nav-dropdown-item i {
    width: 18px !important;
    text-align: center !important;
    color: #6b7280 !important;
}

.top-nav-dropdown-item:hover i {
    color: #B8860B !important;
}

.top-nav-dropdown-divider {
    height: 1px !important;
    background-color: #e5e7eb !important;
    margin: 6px 0 !important;
}

.top-nav-dropdown-header {
    padding: 8px 16px 4px !important;
    font-size: 0.7rem !important;
    font-weight: 600 !important;
    color: #9ca3af !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

/* User menu no canto direito */
.top-navbar-user {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 12px !important;
    margin-left: auto !important;
    padding-left: 20px !important;
    border-left: 1px solid rgba(255, 255, 255, 0.2) !important;
    height: 100% !important;
    flex-shrink: 0 !important;
}

.top-navbar-user-avatar {
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #B8860B, #DAA520) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: white !important;
    font-weight: 600 !important;
    font-size: 0.85rem !important;
}

.top-navbar-user-info {
    color: white !important;
}

.top-navbar-user-name {
    font-weight: 500 !important;
    font-size: 0.85rem !important;
    color: white !important;
}

.top-navbar-user-role {
    font-size: 0.7rem !important;
    color: #94a3b8 !important;
}

/* Toggle button para alternar entre layouts */
.layout-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ef4444, #f97316);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.5);
    z-index: 99999;
    transition: all 0.3s ease;
    animation: pulse-toggle 2s infinite;
    border: 3px solid white;
}

@keyframes pulse-toggle {
    0% { transform: scale(1); box-shadow: 0 4px 20px rgba(239, 68, 68, 0.5); }
    50% { transform: scale(1.1); box-shadow: 0 6px 30px rgba(239, 68, 68, 0.7); }
    100% { transform: scale(1); box-shadow: 0 4px 20px rgba(239, 68, 68, 0.5); }
}

.layout-toggle:hover {
    transform: scale(1.2);
    box-shadow: 0 8px 30px rgba(239, 68, 68, 0.8);
    animation: none;
}

.layout-toggle i {
    font-size: 1.5rem;
}

/* Tooltip do botão */
.layout-toggle::after {
    content: 'Alternar Menu';
    position: absolute;
    bottom: 70px;
    right: 0;
    background: #1f2937;
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.layout-toggle:hover::after {
    opacity: 1;
}

/* Responsividade do menu topo */
@media (max-width: 1200px) {
    .top-nav-link span {
        display: none;
    }
    
    .top-nav-link {
        padding: 10px 12px;
    }
    
    .top-nav-link .fa-chevron-down {
        display: none;
    }
    
    .top-navbar-user-info {
        display: none;
    }
}

@media (max-width: 768px) {
    .top-navbar {
        display: none;
    }
    
    body.menu-topo-ativo main {
        margin-top: 0;
    }
    
    body.menu-topo-ativo #sidebar {
        display: block;
    }
}

/* Sprint 228: Classes para substituir estilos inline */
.chart-container {
    height: 250px;
}

.chart-container-lg {
    height: 300px;
}

.progress-bar-dynamic {
    transition: width 0.5s ease;
}

.btn-toggle-menu {
    position: fixed !important;
    bottom: 100px !important;
    right: 20px !important;
    width: auto !important;
    height: auto !important;
    border-radius: 30px !important;
    background: linear-gradient(135deg, #dc2626, #ea580c) !important;
    color: white !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    box-shadow: 0 4px 25px rgba(220, 38, 38, 0.7), 0 0 0 4px rgba(255,255,255,0.9) !important;
    z-index: 999999 !important;
    border: 3px solid white !important;
    font-size: 14px !important;
    padding: 12px 20px !important;
    gap: 8px !important;
    animation: pulse-btn 2s infinite !important;
    font-weight: bold !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

.color-preview-box {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 2px solid #d1d5db;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* =============================================
   MODAL FLEX LAYOUT - Fixed header/footer, scrolling body
   ============================================= */

/* Modal content wrapper: flex column with max-height */
.modal > div,
.modal > .modal-content,
[role="dialog"] > div:not([class*="fixed"]) {
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    max-height: 90dvh;
}

/* Modal header: fixed at top */
.modal > div > .modal-header,
.modal > div > div:first-child:has(+ div + div),
.modal > div > .bg-gradient-to-r:first-child,
[role="dialog"] > div > .modal-header {
    flex-shrink: 0;
}

/* Modal body: scrollable */
.modal > div > .modal-body,
.modal > div > .overflow-y-auto,
.modal > div > div:nth-child(2):has(+ div),
[role="dialog"] > div > .modal-body {
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
}

/* Modal footer: fixed at bottom */
.modal > div > .modal-footer,
.modal > div > div:last-child:has(button),
.modal > div > .bg-gray-50:last-child,
[role="dialog"] > div > .modal-footer {
    flex-shrink: 0;
}

/* ===================================
   Hiperlinks entre Documentos QC (Fase 9)
   =================================== */
.qc-doc-ref {
    color: var(--cantara-gold, #B8860B);
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
    cursor: pointer;
    transition: color 0.2s, text-decoration-color 0.2s;
    position: relative;
}

.qc-doc-ref:hover {
    color: var(--cantara-gold-dark, #8B6914);
    text-decoration-style: solid;
    text-decoration-color: var(--cantara-gold, #B8860B);
}

.qc-doc-ref::before {
    content: '\f15c'; /* fa-file-alt */
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    font-size: 0.75em;
    margin-right: 3px;
    opacity: 0.7;
}

/* Documento ativo/publicado */
.qc-doc-ref--active {
    color: var(--cantara-success, #10B981);
}

.qc-doc-ref--active:hover {
    color: #059669;
}

/* Documento inativo/obsoleto */
.qc-doc-ref--inactive {
    color: var(--cantara-warning, #F59E0B);
    text-decoration: line-through;
}

/* Documento não encontrado */
.qc-doc-ref--not-found {
    color: var(--cantara-danger, #EF4444);
    text-decoration: line-through;
    cursor: not-allowed;
    opacity: 0.7;
}

.qc-doc-ref--not-found::before {
    content: '\f071'; /* fa-exclamation-triangle */
}

/* Hiperlinks QC com seletor <a> */
a.qc-doc-ref {
    text-decoration: none;
    border-bottom: 1px dashed var(--cantara-gold-light, #DAA520);
    padding: 1px 3px;
    border-radius: 2px;
}
a.qc-doc-ref:hover {
    border-bottom-style: solid;
    background-color: rgba(184, 134, 11, 0.08);
}
a.qc-doc-ref .doc-ref-code {
    font-weight: 600;
    font-family: 'Courier New', monospace;
    font-size: 0.95em;
}
a.qc-doc-ref.doc-ref-resolved:hover .doc-ref-code {
    text-decoration: underline;
}
a.qc-doc-ref.doc-ref-not-found {
    color: #999;
    text-decoration: line-through;
    border-bottom: none;
    cursor: default;
}
a.qc-doc-ref.doc-ref-inactive {
    color: #f59e0b;
    font-style: italic;
    border-bottom-color: #f59e0b;
}

/* Dark mode */
.dark .qc-doc-ref {
    color: var(--cantara-gold-light, #DAA520);
}

.dark .qc-doc-ref:hover {
    color: #F5D060;
}

/* PWA standalone mode: account for safe areas */
@media (display-mode: standalone) {
    .modal > div,
    .modal > .modal-content,
    [role="dialog"] > div:not([class*="fixed"]) {
        max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 2rem);
    }
}
