/* ============================================================
   VARIÁVEIS E RESET
   ============================================================ */
:root {
    --primary: #1e293b;    /* Azul Navy (Sidebar) */
    --secondary: #3b82f6;  /* Azul Destaque */
    --success: #10b981;    /* Verde (Novo Cadastro/CNPJ) */
    --danger: #ef4444;     /* Vermelho (Excluir/Logout) */
    --warning: #f59e0b;    /* Amarelo */
    --bg-body: #f8fafc;    /* Fundo da Página */
    --bg-card: #ffffff;    /* Fundo de Tabelas e Modais */
    --text-main: #334155;  /* Texto Principal */
    --text-muted: #64748b; /* Texto Secundário */
    --border: #e2e8f0;     /* Linhas de Divisão */
    --radius: 12px;        /* Arredondamento Padrão */
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
}

/* ============================================================
   ESTRUTURA (LAYOUT)
   ============================================================ */
.content {
    padding: 2.5rem;
    max-width: 1400px;
    margin-left: 260px; /* Largura da Sidebar */
    transition: margin-left 0.3s ease;
}

.header-main { margin-bottom: 2rem; }
.header-main h1 { font-size: 1.75rem; font-weight: 800; color: var(--primary); }
.subtitle { color: var(--text-muted); font-size: 0.95rem; }

/* ============================================================
   SIDEBAR (MENU LATERAL)
   ============================================================ */
.sidebar {
    width: 260px;
    background: var(--primary);
    height: 100vh;
    position: fixed;
    left: 0; top: 0;
    display: flex;
    flex-direction: column;
    color: white;
    z-index: 1000;
}

.sidebar-logo { padding: 30px 25px; text-align: center; border-bottom: 1px solid #334155; }
.sidebar-logo img { max-width: 150px; }

.nav-label {
    display: block;
    padding: 20px 25px 8px;
    text-transform: uppercase;
    font-size: 0.7rem;
    color: #94a3b8;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.sidebar-nav a {
    padding: 12px 25px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #cbd5e1;
    text-decoration: none;
    transition: all 0.2s;
}

.sidebar-nav a i { width: 20px; font-size: 1.1rem; }
.sidebar-nav a:hover, .sidebar-nav a.active {
    background: #334155;
    color: var(--secondary);
    border-right: 4px solid var(--secondary);
}

.sidebar-footer { margin-top: auto; padding: 20px; }
.btn-logout-sidebar {
    width: 100%;
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}
.btn-logout-sidebar:hover { background: var(--danger); color: white; }

/* Permite rolagem no menu se houver muitas opções */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 20px;
}

/* Customização da barra de rolagem do menu para ficar discreta */
.sidebar-nav::-webkit-scrollbar {
    width: 5px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 10px;
}

/* Destaque para as labels de seção */
.nav-label {
    display: block;
    padding: 25px 25px 10px;
    font-size: 0.65rem;
    color: #3b82f6; /* Cor azul para destacar o título da seção */
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

/* Ícones com cores suaves para não cansar a vista */
.sidebar-nav i {
    opacity: 0.7;
}

.sidebar-nav a.active i {
    opacity: 1;
    color: #3b82f6;
}

/* ============================================================
   COMPONENTES (BUSCA, TABELAS, BOTÕES)
   ============================================================ */
.action-bar {
    background: var(--bg-card);
    padding: 1.25rem;
    border-radius: var(--radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.search-group { position: relative; flex: 1; }
.search-group i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.search-input {
    width: 100%;
    padding: 12px 12px 12px 45px;
    border: 1px solid var(--border);
    border-radius: 8px;
    outline: none;
    font-size: 0.95rem;
}
.search-input:focus { border-color: var(--secondary); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); }

/* Botões */
.btn {
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: 0.2s;
}
.btn-primary { background: var(--secondary); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-outline { background: white; border: 1px solid var(--border); color: var(--text-main); }
.btn:hover { opacity: 0.9; transform: translateY(-1px); }

/* Tabela */
.table-container {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
table { width: 100%; border-collapse: collapse; }
th { background: #f1f5f9; padding: 15px; text-align: left; font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; }
td { padding: 15px; border-bottom: 1px solid var(--border); }
.bold { font-weight: 600; color: var(--primary); }

/* Badges */
.badge { padding: 4px 8px; border-radius: 6px; font-size: 0.75rem; font-weight: 600; }
.badge-light { background: #f1f5f9; color: var(--text-muted); }
.badge-info { background: #e0f2fe; color: #0369a1; }

/* ============================================================
   MODAIS E FORMULÁRIOS
   ============================================================ */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0; top: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
}
.modal-content {
    background: white;
    margin: 3% auto;
    padding: 2rem;
    width: 90%;
    max-width: 800px;
    border-radius: var(--radius);
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
}
.modal-sm { max-width: 450px; }

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: span 2; }
.form-group label { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); }
.form-group input, .form-group select {
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
}

/* ============================================================
   NOTIFICAÇÕES (TOAST)
   ============================================================ */
#notificacao {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 3000;
    padding: 16px 24px;
    border-radius: 8px;
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow);
    display: none;
    animation: slideIn 0.3s ease-out;
}
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ============================================================
   RESPONSIVIDADE (MOBILE)
   ============================================================ */
@media (max-width: 1024px) {
    .sidebar { display: none; }
    .content { margin-left: 0; padding: 1.5rem; padding-bottom: 100px; }
    .form-grid { grid-template-columns: 1fr; }
    .action-bar { flex-direction: column; align-items: stretch; }
}

.mobile-footer {
    display: none;
    position: fixed;
    bottom: 0; left: 0; width: 100%;
    background: var(--primary);
    padding: 10px;
    justify-content: space-around;
    z-index: 1000;
}
@media (max-width: 1024px) { .mobile-footer { display: flex; } }
.mobile-footer a { color: #94a3b8; font-size: 1.5rem; }
.mobile-footer a.active { color: var(--secondary); }

/* Layout da Dashboard */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card-stat {
    background: white;
    padding: 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.card-stat:hover { transform: translateY(-5px); }

.card-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-right: 15px;
}

/* Cores dos Cards */
.blue .card-icon { background: #e0f2fe; color: #0284c7; }
.green .card-icon { background: #dcfce7; color: #16a34a; }
.orange .card-icon { background: #ffedd5; color: #ea580c; }
.purple .card-icon { background: #f3e8ff; color: #9333ea; }

.card-value { display: block; font-size: 1.8rem; font-weight: 700; color: #1e293b; }
.card-title { font-size: 0.85rem; color: #64748b; text-transform: uppercase; letter-spacing: 0.5px; }

/* Grid de Conteúdo */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 20px;
}

.grid-item {
    background: white;
    padding: 20px;
    border-radius: 12px;
    min-height: 300px;
}

.table-minimal { width: 100%; border-collapse: collapse; margin-top: 15px; }
.table-minimal th { text-align: left; font-size: 0.8rem; color: #94a3b8; padding: 10px; border-bottom: 1px solid #f1f5f9; }
.table-minimal td { padding: 12px 10px; font-size: 0.9rem; border-bottom: 1px solid #f1f5f9; }

.alert-item { padding: 12px; border-radius: 8px; margin-bottom: 10px; font-size: 0.9rem; list-style: none; }
.alert-item.warning { background: #fffbeb; color: #92400e; border-left: 4px solid #f59e0b; }
.alert-item.danger { background: #fef2f2; color: #991b1b; border-left: 4px solid #ef4444; }
.alert-item.info { background: #f0f9ff; color: #075985; border-left: 4px solid #0ea5e9; }