:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --sidebar-width: 260px;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    background-image:
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.15) 0px, transparent 50%);
    background-attachment: fixed;
    color: #f8fafc;
    min-height: 100vh;
}

/* Glassmorphism */
.glass-effect {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Login Page Specifics */
.login-body {
    background-image:
        radial-gradient(at 0% 0%, rgba(241, 102, 99, 0.2) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(246, 92, 139, 0.2) 0px, transparent 50%),
        radial-gradient(at 50% 50%, rgba(42, 23, 15, 1) 0px, transparent 100%);
}

.login-card {
    transition: transform 0.3s ease, box-shadow 0.9s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4) !important;
}

.login-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5) !important;
}

.login-floating {
    color: #94a3b8;
}

.login-floating .form-control {
    background-color: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    height: calc(3.5rem + 2px);
    padding: 1rem 0.75rem;
}

.login-floating .form-control:focus {
    background-color: rgba(15, 23, 42, 0.8);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(99, 102, 241, 0.25);
    color: white;
}

.login-floating label {
    padding: 1rem 0.75rem;
}

.login-floating .form-control:focus~label,
.login-floating .form-control:not(:placeholder-shown)~label {
    color: var(--primary-color);
    transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem);
    background-color: #27272a !important;
}

/* Base Layout & Sidebar */
.wrapper {
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    z-index: 1040;
}

.sidebar .nav-link {
    color: #94a3b8 !important;
    padding: 0.8rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    transition: all 0.2s;
    font-weight: 500;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    color: white !important;
    background-color: rgba(255, 255, 255, 0.05);
}

.sidebar .nav-link.active {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.2) 0%, transparent 100%);
    border-left: 3px solid var(--primary-color);
}

.btn-logout {
    background: rgba(220, 53, 69, 0.1);
    color: #ef4444 !important;
    border: 1px solid rgba(220, 53, 69, 0.2);
    transition: all 0.2s;
}

.btn-logout:hover {
    background: rgba(220, 53, 69, 0.2);
    color: white !important;
}

/* Topbar */
.topbar {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Dashboard Cards */
.stat-card {
    transition: transform 0.2s ease;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-card:hover {
    transform: translateY(-3px);
}

/* Global Table Override for Dark Theme */
.table {
    --bs-table-color: #f8fafc;
    --bs-table-bg: transparent;
    --bs-table-border-color: rgba(255, 255, 255, 0.05);
    --bs-table-striped-bg: rgba(255, 255, 255, 0.02);
    --bs-table-hover-bg: rgba(255, 255, 255, 0.05);
    color: var(--bs-table-color);
    vertical-align: middle;
    border-color: var(--bs-table-border-color);
}

.table th,
.table td {
    background-color: transparent !important;
    color: #f8fafc !important;
    border-bottom-color: rgba(255, 255, 255, 0.05) !important;
}

/* Custom Table */
.custom-table {
    color: #f8fafc;
    border-collapse: separate;
    border-spacing: 0;
}

.custom-table th {
    background-color: rgba(255, 255, 255, 0.02) !important;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.75rem;
    color: #94a3b8 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.custom-table td {
    background-color: transparent !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
    color: #f8fafc !important;
}

.custom-table tbody tr {
    transition: background-color 0.2s;
}

.custom-table tbody tr:hover td {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

/* Responsiveness */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        transform: translateX(-100%);
    }

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

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

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

.transition-all {
    transition: all 0.3s ease;
}

.hover-text-white:hover {
    color: white !important;
}

/* Forçar TODAS as tabelas a terem o fundo correto, ignorando classes do Bootstrap ou outros do tema */
table,
.table,
.custom-table,
.table-dark-custom,
table th,
.table th,
.custom-table th,
.table-dark-custom th,
table td,
.table td,
.custom-table td,
.table-dark-custom td,
table tr,
.table tr,
.custom-table tr,
.table-dark-custom tr,
.table-striped tbody tr:nth-of-type(odd) td,
.table-striped tbody tr:nth-of-type(even) td {
    background-color: #27272a !important;
    color: #f8fafc !important;
}

/* Hover effect */
table tbody tr:hover td,
.table tbody tr:hover td,
.custom-table tbody tr:hover td,
.table-dark-custom tbody tr:hover td {
    background-color: #3f3f46 !important;
}

/* Forçar TODAS as cards para o tema escuro */
.card {
    --bs-card-bg: #27272a !important;
    background-color: #27272a !important;
    color: #f8fafc !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
}

/* Campos de form dentro dos cards para tema escuro */
.card .form-control,
.card .form-select {
    background-color: rgba(15, 23, 42, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: white !important;
}

.card .form-control:focus,
.card .form-select:focus {
    background-color: rgba(15, 23, 42, 0.8) !important;
    border-color: var(--primary-color) !important;
    color: white !important;
}

.card .form-label {
    color: #94a3b8 !important;
}

/* Status da Logística - Linhas da Tabela */
.status-row-pendente td { background-color: rgba(255, 193, 7, 0.12) !important; }
.status-row-aguardando td { background-color: rgba(253, 126, 20, 0.15) !important; }
.status-row-em-rota td { background-color: rgba(25, 135, 84, 0.15) !important; }
.status-row-entregue td { background-color: rgba(13, 110, 253, 0.12) !important; }
.status-row-cancelada td { background-color: rgba(108, 117, 125, 0.12) !important; }

/* Status da Logística - Seletores */
.status-select {
    font-weight: 700 !important;
    text-align: center !important;
    border-radius: 20px !important;
    transition: all 0.2s ease !important;
}

.status-pendente { 
    background-color: #ffc107 !important; 
    color: #000 !important; 
}
.status-aguardando { 
    background-color: #fd7e14 !important; 
    color: #fff !important; 
}
.status-em-rota { 
    background-color: #198754 !important; 
    color: #fff !important; 
}
.status-entregue { 
    background-color: #0d6efd !important; 
    color: #fff !important; 
}
.status-cancelada { 
    background-color: #6c757d !important; 
    color: #fff !important; 
}

/* Override para o select quando focado */
.status-select:focus {
    box-shadow: 0 0 0 0.25rem rgba(255, 255, 255, 0.25) !important;
}

.bg-orange {
    background-color: #fd7e14 !important;
}