/* styles.css - Folha de Estilo Premium (Tema Escuro / TI) */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    /* Paleta de Cores */
    --bg-primary: #0a0f1d;
    --bg-secondary: #121829;
    --bg-card: rgba(22, 30, 49, 0.75);
    --border-color: rgba(56, 189, 248, 0.15);
    --border-hover: rgba(56, 189, 248, 0.35);
    
    --color-text-primary: #f8fafc;
    --color-text-secondary: #94a3b8;
    --color-text-muted: #64748b;
    
    --color-primary: #0ea5e9;
    --color-primary-hover: #38bdf8;
    --color-primary-glow: rgba(14, 165, 233, 0.25);
    
    --color-success: #10b981;
    --color-success-hover: #34d399;
    --color-success-glow: rgba(16, 185, 129, 0.2);
    
    --color-danger: #f43f5e;
    --color-danger-hover: #fb7185;
    --color-danger-glow: rgba(244, 63, 94, 0.2);

    --color-warning: #f59e0b;

    /* Fontes */
    --font-sans: 'Outfit', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Efeitos */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 15px var(--color-primary-glow);
    --border-radius: 12px;
    --border-radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset Geral */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--color-text-primary);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: #1e293b;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #334155;
}

/* Layout Principal */
.app-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Barra Lateral de Navegação (Sidebar) */
.sidebar {
    width: 260px;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: var(--transition);
}

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

.brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--color-primary), #3b82f6);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 15px rgba(14, 165, 233, 0.4);
}

.brand-icon svg {
    width: 22px;
    height: 22px;
    fill: #fff;
}

.sidebar-brand h1 {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 0.5px;
}

.sidebar-brand p {
    font-size: 0.75rem;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
    margin-top: -2px;
}

.brand-text {
    display: flex;
    flex-direction: column;
}

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

.menu-item a {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    color: var(--color-text-secondary);
    text-decoration: none;
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: var(--transition);
    border: 1px solid transparent;
}

.menu-item a svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    transition: var(--transition);
}

.menu-item a:hover {
    color: var(--color-primary-hover);
    background-color: rgba(14, 165, 233, 0.05);
    border-color: rgba(14, 165, 233, 0.1);
}

.menu-item.active a {
    color: var(--color-text-primary);
    background: linear-gradient(90deg, rgba(14, 165, 233, 0.15) 0%, rgba(14, 165, 233, 0.02) 100%);
    border-color: var(--border-color);
    box-shadow: inset 3px 0 0 var(--color-primary);
}

.menu-item.active a svg {
    color: var(--color-primary);
    filter: drop-shadow(0 0 5px var(--color-primary));
}

.sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.system-status {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-success);
    background: rgba(16, 185, 129, 0.1);
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-dot {
    width: 6px;
    height: 6px;
    background-color: var(--color-success);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--color-success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.9); opacity: 0.6; }
    50% { transform: scale(1.2); opacity: 1; box-shadow: 0 0 12px var(--color-success); }
    100% { transform: scale(0.9); opacity: 0.6; }
}

.status-text {
    font-size: 0.7rem;
    color: var(--color-text-muted);
}

/* Área de Conteúdo Principal */
.main-content {
    flex-grow: 1;
    margin-left: 260px;
    padding: 40px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

/* Cabeçalho da Página */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.page-title h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-text-primary);
}

.page-title p {
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    margin-top: 4px;
}

/* Botões */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

.btn-primary {
    background-color: var(--color-primary);
    color: #fff;
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
    background-color: var(--color-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(14, 165, 233, 0.4);
}

.btn-secondary {
    background-color: rgba(30, 41, 59, 0.5);
    color: var(--color-text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background-color: rgba(30, 41, 59, 0.8);
    border-color: var(--border-hover);
}

.btn-danger {
    background-color: rgba(244, 63, 94, 0.1);
    color: var(--color-danger);
    border-color: rgba(244, 63, 94, 0.2);
}

.btn-danger:hover {
    background-color: var(--color-danger);
    color: #fff;
    box-shadow: 0 0 15px var(--color-danger-glow);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

/* Cards de Estatísticas (Dashboard) */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    color: var(--color-text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

.stat-value {
    color: var(--color-text-primary);
    font-size: 2rem;
    font-weight: 700;
    margin-top: 4px;
}

.stat-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-card.blue .stat-icon-wrapper {
    background: rgba(14, 165, 233, 0.1);
    color: var(--color-primary);
}

.stat-card.green .stat-icon-wrapper {
    background: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
}

.stat-card.purple .stat-icon-wrapper {
    background: rgba(139, 92, 246, 0.1);
    color: #a78bfa;
}

.stat-icon-wrapper svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

/* Gráficos e Analytics (Dashboard) */
.dashboard-analytics {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

.analytics-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
}

.analytics-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Gráfico de Barras em CSS Puro */
.chart-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chart-bar-item {
    display: flex;
    align-items: center;
    gap: 16px;
}

.bar-label {
    width: 140px;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bar-track {
    flex-grow: 1;
    height: 12px;
    background: rgba(30, 41, 59, 0.5);
    border-radius: 6px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary) 0%, #3b82f6 100%);
    border-radius: 6px;
    width: 0;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 8px rgba(14, 165, 233, 0.4);
}

.bar-value {
    width: 40px;
    text-align: right;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-primary);
}

/* Indicadores de Destaque */
.indicators-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.indicator-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(56, 189, 248, 0.08);
}

.indicator-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.indicator-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.indicator-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text-primary);
}

.indicator-sub {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.indicator-badge {
    background: rgba(14, 165, 233, 0.1);
    color: var(--color-primary-hover);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid rgba(14, 165, 233, 0.2);
}

/* Seções e Abas */
.app-section {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.app-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Tabelas */
.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
}

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

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    background-color: rgba(18, 24, 41, 0.8);
    color: var(--color-text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 16px 24px;
    border-bottom: 1px solid rgba(56, 189, 248, 0.08);
    color: var(--color-text-primary);
    font-size: 0.9rem;
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: rgba(14, 165, 233, 0.02);
}

.table-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-secondary);
    padding: 6px;
    border-radius: 6px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--color-text-primary);
}

.action-btn.edit:hover {
    color: var(--color-primary-hover);
    background-color: rgba(14, 165, 233, 0.1);
}

.action-btn.delete:hover {
    color: var(--color-danger-hover);
    background-color: rgba(244, 63, 94, 0.1);
}

.action-btn svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

.badge-dept {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    background: rgba(56, 189, 248, 0.1);
    color: var(--color-primary-hover);
    border: 1px solid rgba(56, 189, 248, 0.15);
}

/* Modais */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 15, 29, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-md);
    transform: translateY(-20px);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.modal-overlay.active .modal-container {
    transform: translateY(0);
}

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

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    transition: var(--transition);
}

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

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background-color: rgba(10, 15, 29, 0.3);
}

/* Formulários */
.form-group {
    margin-bottom: 20px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    background-color: rgba(10, 15, 29, 0.6);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 10px 14px;
    color: var(--color-text-primary);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 10px rgba(14, 165, 233, 0.2);
    background-color: rgba(10, 15, 29, 0.8);
}

.form-control::placeholder {
    color: var(--color-text-muted);
}

.form-control-mono {
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

/* Barra de Ações de Tabela (Filtros e Busca) */
.table-filters {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    background-color: rgba(18, 24, 41, 0.4);
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.filters-group {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

/* Mobile Header / Hamburger */
.mobile-navbar {
    display: none;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 24px;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 200;
    align-items: center;
    justify-content: space-between;
}

.hamburger-btn {
    background: none;
    border: none;
    color: var(--color-text-primary);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hamburger-btn svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

/* Notificações Toast */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background-color: var(--bg-secondary);
    border-left: 4px solid var(--color-primary);
    border-radius: 6px;
    box-shadow: var(--shadow-md);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 450px;
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.toast.show {
    transform: translateX(0);
}

.toast-success {
    border-left-color: var(--color-success);
}

.toast-danger {
    border-left-color: var(--color-danger);
}

.toast-message {
    font-size: 0.85rem;
    font-weight: 500;
}

/* Gráfico de Pizza Simulado (SVG) */
.donut-chart-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    height: 180px;
}

.donut-chart {
    transform: rotate(-90deg);
}

.donut-segment {
    fill: none;
    stroke-width: 4;
}

.donut-center {
    fill: transparent;
}

.donut-text {
    font-family: var(--font-sans);
    font-weight: 700;
    fill: var(--color-text-primary);
    text-anchor: middle;
}

.donut-subtext {
    font-family: var(--font-sans);
    font-weight: 500;
    fill: var(--color-text-secondary);
    font-size: 5px;
    text-anchor: middle;
}

/* Responsividade */
@media (max-width: 1024px) {
    .dashboard-analytics {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    body {
        padding-top: 72px; /* Espaço para navbar mobile */
    }

    .sidebar {
        transform: translateX(-100%);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 24px 16px;
    }

    .mobile-navbar {
        display: flex;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .table-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .filters-group {
        flex-direction: column;
        align-items: stretch;
    }

    .btn {
        width: 100%;
    }
}

/* Ajustes de Alinhamento e Espaços */
.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gap-12 {
    display: flex;
    gap: 12px;
}

.mt-24 {
    margin-top: 24px;
}

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

.text-muted {
    color: var(--color-text-muted);
}

.empty-state {
    padding: 40px 20px;
    text-align: center;
    color: var(--color-text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.empty-state svg {
    width: 48px;
    height: 48px;
    color: var(--color-text-muted);
}
