/* ===============================
   ESTILO GERAL DO SISTEMA
   =============================== */
:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
}

body {
    overflow-x: hidden;
    background-color: var(--bg-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    color: var(--text-primary);
}

/* ===============================
   SIDEBAR PRINCIPAL
   =============================== */
.sidebar {
    width: 230px;
    min-height: 100vh;
    transition: width 0.3s;
    background-color: #ffffff;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.sidebar.collapsed {
    width: 70px;
}

/* LINKS E ITENS DO MENU */
.sidebar a {
    text-decoration: none;
    font-size: 14px;
    color: var(--text-secondary);
    transition: all 0.3s;
    font-weight: 500;
}

.sidebar a:hover {
    background-color: var(--bg-primary);
    color: var(--primary);
    border-radius: 5px;
}

.sidebar a.active {
    color: var(--primary);
    background-color: rgba(37, 99, 235, 0.1);
    border-left: 3px solid var(--primary);
    padding-left: 17px;
}

/* TEXTO DOS LINKS */
.sidebar .txt {
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar.collapsed .txt {
    opacity: 0;
    visibility: hidden;
}

/* ÍCONES */
.sidebar i {
    width: 20px;
    text-align: center;
    margin-right: 8px;
}

/* CABEÇALHO DO SIDEBAR */
.sidebar-header {
    background-color: #ffffff;
    user-select: none;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h5 {
    color: var(--primary);
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

/* SETA DOS SUBMENUS */
.sidebar .dropdown-toggle::after {
    float: right;
    margin-top: 6px;
    transition: transform 0.3s;
    border-color: var(--text-secondary);
}

.sidebar .dropdown-toggle[aria-expanded="true"]::after {
    transform: rotate(180deg);
    border-color: var(--primary);
}

.sidebar.collapsed .dropdown-toggle::after {
    display: none;
}

/* ===============================
   SUBMENUS (CADASTROS / ORÇAMENTO / RELATÓRIOS / CONFIGURAÇÕES)
   =============================== */
.sidebar .collapse a {
    font-size: 13px;
    padding-left: 30px;
    display: flex;
    align-items: center;
    gap: 6px;
    border-left: 3px solid transparent;
    transition: all 0.3s;
    color: var(--text-secondary);
}

.sidebar .collapse a:hover {
    background-color: var(--bg-primary);
    border-left: 3px solid var(--primary);
    color: var(--primary);
}

.sidebar .collapse a.active {
    border-left: 3px solid var(--primary);
    color: var(--primary);
    background-color: rgba(37, 99, 235, 0.05);
}

.sidebar .collapse a i {
    font-size: 13px;
}

/* ===============================
   ÁREA DE CONTEÚDO
   =============================== */
#content {
    background-color: var(--bg-primary);
    border-radius: 0;
    box-shadow: none;
    padding: 24px;
    min-height: 100vh;
}

/* ===============================
   LOGOUT (RODAPÉ DO SIDEBAR)
   =============================== */
.sidebar .border-top {
    border-color: var(--border) !important;
    border-top: 1px solid var(--border) !important;
}

.sidebar .border-top a {
    display: flex;
    align-items: center;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s;
}

.sidebar .border-top a:hover {
    background-color: var(--bg-primary);
    color: var(--danger);
    border-radius: 5px;
}

/* ===============================
   ANIMAÇÕES SUAVES E DETALHES
   =============================== */
.sidebar a,
.sidebar .collapse a {
    transition: all 0.25s ease-in-out;
}

.sidebar.collapsed a {
    text-align: center;
}

.sidebar.collapsed a i {
    margin-right: 0;
}

/* Cards e elementos principais */
.card {
    border: 1px solid var(--border);
    background-color: var(--bg-secondary);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: all 0.3s;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* Tabelas */
.table {
    background-color: var(--bg-secondary);
}

.table thead {
    background-color: var(--bg-primary);
    border-bottom: 2px solid var(--border);
}

.table thead th {
    color: var(--text-primary);
    font-weight: 600;
    border: none;
}

.table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background-color 0.2s;
}

.table tbody tr:hover {
    background-color: var(--bg-primary);
}

/* Botões */
.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}

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

/* Badges e tags */
.badge {
    border-radius: 4px;
    font-weight: 600;
    font-size: 12px;
}

/* ===============================
   RESPONSIVIDADE
   =============================== */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        z-index: 1000;
        height: 100%;
        left: -230px;
    }

    .sidebar.active {
        left: 0;
    }

    #content {
        margin-left: 0 !important;
    }

    #toggleSidebar {
        cursor: pointer;
    }
}
