/* SISTEMA DE DESIGN CLEAN + AURORA - TRAMPO GESTÃO */

:root {
    /* Paleta de Cores Harmônica */
    --primary: #10b981; /* Verde Esmeralda */
    --primary-hover: #059669;
    --secondary: #8b5cf6; /* Violeta/Plasma */
    --secondary-hover: #7c3aed;
    --background: #f8fafc;
    --surface: #ffffff;
    --border: #e2e8f0;
    
    /* Cores de Feedback */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* Cores de Texto */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    /* Layout */
    --sidebar-width: 260px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
}

/* Reset Geral */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--background);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Aurora Orbs Desfocados */
.aurora-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.aurora-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.15;
    animation: orb-float 20s infinite alternate ease-in-out;
}

.blob-1 {
    top: -10%;
    right: 10%;
    width: 450px;
    height: 450px;
    background: var(--primary);
}

.blob-2 {
    bottom: -10%;
    left: 10%;
    width: 500px;
    height: 500px;
    background: var(--secondary);
    animation-delay: -5s;
}

.blob-3 {
    top: 40%;
    right: 50%;
    width: 350px;
    height: 350px;
    background: var(--info);
    animation-delay: -10s;
}

@keyframes orb-float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 30px) scale(1.1); }
}

/* Layout Geral */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Barra Lateral (Sidebar) */
.sidebar {
    width: var(--sidebar-width);
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px;
    position: fixed;
    height: 100vh;
    z-index: 10;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 36px;
}

.brand-icon {
    color: var(--primary);
    width: 28px;
    height: 28px;
}

.brand-text {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.brand-sub {
    color: var(--secondary);
    font-size: 14px;
    font-weight: 500;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.menu-item i {
    width: 18px;
    height: 18px;
}

.menu-item:hover, .menu-item.active {
    color: var(--primary);
    background-color: rgba(16, 185, 129, 0.08);
}

.menu-item.active {
    font-weight: 600;
}

/* Sidebar Footer */
.sidebar-footer {
    border-top: 1px solid var(--border);
    padding-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.user-profile-summary {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--secondary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.user-role {
    font-size: 11px;
}

.badge {
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 500;
    text-transform: capitalize;
    display: inline-block;
    width: fit-content;
}

.badge.diretor {
    background-color: rgba(139, 92, 246, 0.1);
    color: var(--secondary);
}

.badge.gerente {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--info);
}

.badge.supervisor {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.badge.vendedor {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--primary);
}

.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: none;
    border: 1px solid var(--border);
    padding: 10px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-logout:hover {
    background-color: rgba(239, 68, 68, 0.08);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.2);
}

/* Área Principal */
.main-content {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    padding: 40px;
    min-height: 100vh;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 36px;
}

.header-title h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}

.text-muted {
    color: var(--text-muted);
    font-size: 14px;
}

/* Seletor de Bypass */
.bypass-container {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: white;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.bypass-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.bypass-select {
    border: none;
    outline: none;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    background: transparent;
    cursor: pointer;
}

/* Views Container */
.view-container {
    position: relative;
}

.content-view {
    display: none;
    flex-direction: column;
    gap: 28px;
}

.content-view.active {
    display: flex;
}

/* Grid de KPIs */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.kpi-card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background-color: rgba(16, 185, 129, 0.08);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.kpi-card:nth-child(2) .kpi-icon {
    background-color: rgba(139, 92, 246, 0.08);
    color: var(--secondary);
}

.kpi-card:nth-child(3) .kpi-icon {
    background-color: rgba(59, 130, 246, 0.08);
    color: var(--info);
}

.kpi-card:nth-child(4) .kpi-icon {
    background-color: rgba(245, 158, 11, 0.08);
    color: var(--warning);
}

.kpi-data {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kpi-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.kpi-value {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* Layout de Colunas do Dashboard */
.dashboard-content-layout {
    display: flex;
    gap: 28px;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

/* Cards Genéricos */
.panel-card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-sm);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.panel-header h2 {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.3px;
}

.panel-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

.icon-refresh {
    color: var(--text-muted);
    cursor: pointer;
    width: 18px;
    height: 18px;
    transition: transform 0.3s ease;
}

.icon-refresh:hover {
    transform: rotate(180deg);
    color: var(--text-primary);
}

/* Tabelas */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
}

.table th, .table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.table th {
    font-weight: 600;
    color: var(--text-secondary);
    background-color: #f8fafc;
}

.table tr:hover td {
    background-color: rgba(248, 250, 252, 0.5);
}

/* Ranking List */
.ranking-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.rank-number {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: var(--border);
    font-weight: 700;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ranking-item:nth-child(1) .rank-number {
    background-color: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.ranking-item:nth-child(2) .rank-number {
    background-color: rgba(148, 163, 184, 0.2);
    color: var(--text-secondary);
}

.ranking-item:nth-child(3) .rank-number {
    background-color: rgba(180, 83, 9, 0.2);
    color: #b45309;
}

.rank-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-grow: 1;
}

.rank-name {
    font-weight: 600;
    font-size: 14px;
}

.rank-sales {
    font-size: 12px;
    color: var(--text-muted);
}

.rank-value {
    font-weight: 700;
    font-size: 14px;
    color: var(--primary);
}

/* Formulários do Simulador */
.simulador-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-group input, .form-group select {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.form-group input:focus, .form-group select:focus {
    border-color: var(--primary);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: var(--border);
    color: var(--text-primary);
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

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

.w-full { width: 100%; }

/* Resultados da Simulação */
.simulation-results-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}

.result-box {
    background-color: #f8fafc;
    border: 1px solid var(--border);
    padding: 20px;
    border-radius: var(--radius-md);
}

.result-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 6px;
    display: block;
}

.result-value {
    font-size: 20px;
    font-weight: 700;
}

.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }

.margin-gauge-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.gauge-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.gauge-progress-bar {
    width: 100%;
    height: 12px;
    background-color: var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.gauge-fill {
    height: 100%;
    background-color: var(--primary);
    border-radius: 6px;
    transition: width 0.5s ease-in-out;
}

/* Estilo do Organograma CSS */
.organograma-wrapper {
    width: 100%;
    overflow-x: auto;
    padding: 20px 0;
    display: flex;
    justify-content: center;
}

/* Árvore Hierárquica */
.tree ul {
    padding-top: 20px; 
    position: relative;
    transition: all 0.5s;
    display: flex;
    justify-content: center;
}

.tree li {
    text-align: center;
    list-style-type: none;
    position: relative;
    padding: 20px 10px 0 10px;
    transition: all 0.5s;
}

/* Linhas superiores e horizontais de conexão */
.tree li::before, .tree li::after{
    content: '';
    position: absolute; 
    top: 0; 
    right: 50%;
    border-top: 1px solid var(--border);
    width: 50%; 
    height: 20px;
}
.tree li::after{
    right: auto; 
    left: 50%;
    border-left: 1px solid var(--border);
}

/* Único filho */
.tree li:only-child::after, .tree li:only-child::before {
    display: none;
}

.tree li:only-child{ 
    padding-top: 0;
}

/* Primeiro e último filho */
.tree li:first-child::before, .tree li:last-child::after{
    border: 0 none;
}
.tree li:last-child::before{
    border-right: 1px solid var(--border);
    border-radius: 0 5px 0 0;
}
.tree li:first-child::after{
    border-radius: 5px 0 0 0;
}

/* Adicionando conectores verticais */
.tree ul ul::before{
    content: '';
    position: absolute; 
    top: 0; 
    left: 50%;
    border-left: 1px solid var(--border);
    width: 0; 
    height: 20px;
}

/* Caixa do Nodo */
.node-card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    padding: 12px 18px;
    border-radius: var(--radius-md);
    display: inline-block;
    box-shadow: var(--shadow-sm);
    min-width: 150px;
    position: relative;
    z-index: 2;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.node-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
}

.node-name {
    font-size: 13px;
    font-weight: 600;
    display: block;
    margin-bottom: 2px;
}

.node-role {
    font-size: 10px;
    display: inline-block;
    margin-bottom: 4px;
}

.node-commission {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary);
    display: block;
}

/* Modais */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-overlay.active {
    display: flex;
}

.modal-card {
    background-color: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

/* Grelha de Equipes e Organogramas Compactos */
.organogramas-grid {
    margin-top: 10px;
}

.org-compact-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    overflow: hidden;
}

.org-compact-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background-color: var(--secondary);
    opacity: 0.8;
}

.org-compact-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--secondary);
}

.org-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.org-icon-wrapper {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(139, 92, 246, 0.1);
    color: var(--secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.org-title-group h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.org-title-group p {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.org-card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 4px;
}

.org-member-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.org-member-badge svg {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
}

.org-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 600;
    color: var(--secondary);
    border-top: 1px solid var(--border);
    padding-top: 12px;
    margin-top: auto;
}

.org-card-footer svg {
    width: 14px;
    height: 14px;
    transition: transform 0.2s ease;
}

.org-compact-card:hover .org-card-footer svg {
    transform: translateX(4px);
}
