/* ========================================
   VARIÁVEIS E RESET
   ======================================== */
:root {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    --secondary: #64748b;
    --dark: #0f172a;
    --light: #f1f5f9;
    --bg-body: #f8fafc;
    --sidebar-width: 270px;
    --header-height: 70px;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: #334155;
    overflow-x: hidden;
}

/* ========================================
   SIDEBAR
   ======================================== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--dark);
    background-image:
        radial-gradient(circle at 50% 0%, rgba(59, 130, 246, 0.15), transparent 50%),
        radial-gradient(circle at 50% 100%, rgba(139, 92, 246, 0.15), transparent 50%);
    color: #cbd5e1;
    overflow-y: auto;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.05);
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar-header {
    padding: 24px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-header .logo {
    width: 65px;
    height: auto;
    max-height: 75px;
    object-fit: contain;
    margin-bottom: 15px;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

.sidebar-header h4 {
    margin: 10px 0 5px;
    font-size: 1.4rem;
    font-weight: 700;
    color: white;
    letter-spacing: -0.025em;
}

.sidebar-header p {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-bottom: 0;
}

.sidebar-nav {
    padding: 20px 0;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    color: #94a3b8;
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    font-weight: 500;
}

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

.sidebar-nav .nav-link.active {
    background: rgba(59, 130, 246, 0.1);
    color: white;
    border-left-color: var(--primary);
}

.sidebar-nav .nav-link i {
    width: 24px;
    margin-right: 12px;
    font-size: 1.1rem;
    opacity: 0.8;
}

.sidebar-nav .nav-link.active i {
    opacity: 1;
    color: var(--primary);
}

.nav-section {
    padding: 24px 24px 10px;
}

.nav-section small {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #64748b;
}

/* ========================================
   MAIN CONTENT
   ======================================== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.top-header {
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 0 30px;
    height: var(--header-height);
    display: flex;
    align-items: center;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
    z-index: 999;
}

.top-header .btn-link {
    color: #475569;
    text-decoration: none;
    font-size: 1.2rem;
    transition: color 0.2s;
}

.top-header .btn-link:hover {
    color: var(--primary);
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--danger);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.65rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

.notification-dropdown {
    width: 340px;
    max-height: 400px;
    overflow-y: auto;
    border: none;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    padding: 0;
}

.notification-dropdown .dropdown-header {
    background: #f8fafc;
    padding: 15px;
    font-weight: 600;
    color: #1e293b;
    border-bottom: 1px solid #e2e8f0;
    border-radius: 12px 12px 0 0;
}

.notification-dropdown .dropdown-item {
    padding: 12px 15px;
    border-bottom: 1px solid #f1f5f9;
    white-space: normal;
    transition: background-color 0.2s;
}

.notification-dropdown .dropdown-item:active {
    background-color: #f1f5f9;
    color: #1e293b;
}

/* ========================================
   CARDS DE ESTATÍSTICAS
   ======================================== */
.stat-card {
    border: 1px solid rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.025);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 20px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}

.stat-card .card-body {
    padding: 1.5rem;
}

.stat-card .card-title {
    color: #64748b;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    margin-bottom: 0.25rem;
}

.stat-card h3 {
    font-size: 2rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.025em;
    margin-bottom: 0;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.stat-icon.bg-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
}

.stat-icon.bg-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
}

.stat-icon.bg-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.3);
}

.stat-icon.bg-info {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    box-shadow: 0 4px 10px rgba(14, 165, 233, 0.3);
}

.stat-icon.bg-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.3);
}

/* ========================================
   CARDS GERAIS E TABELAS
   ======================================== */
.card {
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    background: white;
    margin-bottom: 24px;
}

.card-header {
    background: white;
    border-bottom: 1px solid #f1f5f9;
    padding: 16px 20px;
    border-radius: 16px 16px 0 0 !important;
}

.card-header h5 {
    margin: 0;
    font-weight: 600;
}

/* ========================================
   TABELAS E DATATABLES
   ======================================== */
.table-responsive {
    border-radius: 12px;
    overflow: hidden;
}

.table {
    margin-bottom: 0;
    color: #334155;
}

.table thead th {
    background: #f8fafc;
    color: #64748b;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid #e2e8f0;
    padding: 16px 20px;
}

.table tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: all 0.2s ease;
}

.table tbody tr:hover {
    background: #f8fafc;
}

.table tbody td {
    padding: 16px 20px;
    vertical-align: middle;
    color: #475569;
    font-size: 0.9rem;
}

/* DataTables Overrides Premium */
div.dataTables_wrapper div.dataTables_filter input {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 6px 12px;
    transition: all 0.2s;
    font-family: inherit;
}

div.dataTables_wrapper div.dataTables_filter input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

div.dataTables_wrapper div.dataTables_length select {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 6px 30px 6px 12px;
}

.page-item.active .page-link {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.2);
    color: white !important;
}

.page-link {
    color: #475569;
    border-radius: 8px;
    margin: 0 4px;
    border: 1px solid #e2e8f0;
}

/* ========================================
   BOTÕES
   ======================================== */
.btn {
    border-radius: 8px;
    padding: 10px 20px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn i {
    margin-right: 6px;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border: none;
    color: white;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(59, 130, 246, 0.3);
    color: white;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .main-content {
        margin-left: 0;
    }

    .stat-card h3 {
        font-size: 1.5rem;
    }
}

/* ========================================
   UTILIDADES
   ======================================== */
.badge-status {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hover-shadow:hover {
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s;
}