/* Base Utilities (Retained) */
.error { color: #EF4444 !important; }
.hidden { display: none !important; }
.img_display { border: 2px solid #E5E7EB; border-radius: 8px; padding: 4px; height: 80px; width: 90px; margin-top: 3px; margin-right: 15px; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.blue_icon { color: #6366F1 !important; }
.red_icon { color: #EF4444 !important; }
.text-muted { color: #6B7280 !important; }
.text-gray-400 { color: #9CA3AF !important; }
.text-right { text-align: right !important; }
.text-center { text-align: center !important; }
.font-20 { font-size: 20px !important; }
.mr-5 { margin-right: 5px !important; }

/* ========================================================================
   NEW THEME: Blue-Purple Gradient (Indigo/Violet)
   ======================================================================== */

:root {
    --theme-primary: #007bff; /* Emerald Green */
    --theme-primary-hover: #007bff; /* Forest Green */
    --theme-primary-light: #D1FAE5; /* Emerald 100 */
    --theme-sidebar-bg: #1F2937; /* Charcoal Gray */
    --theme-sidebar-bg-end: #475569; /* Slate */
    --theme-sidebar-hover: rgba(255, 255, 255, 0.08);
    --theme-sidebar-active: #007bff;
    --theme-bg: #F3F4F6; /* Pure Light Gray */
    --theme-card-bg: #FFFFFF;
    --theme-border: #E5E7EB;
    --theme-text-dark: #1F2937;
}

/* --- Body & Typography --- */
body, #kt_body {
    background-color: var(--theme-bg) !important;
    font-family: 'Poppins', sans-serif !important;
    color: var(--theme-text-dark);
}

/* --- Aside / Sidebar --- */
.aside-dark {
    background: linear-gradient(180deg, var(--theme-sidebar-bg) 0%, var(--theme-sidebar-bg-end) 100%) !important;
    border-right: none !important;
    box-shadow: 4px 0 15px rgba(0,0,0,0.05);
}

.aside-dark .menu .menu-item .menu-link {
    border-radius: 8px;
    margin: 0 12px;
    transition: all 0.3s ease;
    padding-left: 15px !important;
    padding-right: 15px !important;
}

.aside-dark .aside-logo {
    background-color: transparent !important;
}

.aside-dark .menu .menu-item .menu-link {
    padding-left: 15px !important;
    padding-right: 15px !important;
}

.aside-dark .menu .menu-item.hover > .menu-link:not(.disabled):not(.active),
.aside-dark .menu .menu-item .menu-link:hover:not(.disabled):not(.active) {
    background-color: var(--theme-sidebar-hover) !important;
    color: #fff !important;
}

/* Main menu link active state */
.aside-dark .menu .menu-item.here > .menu-link,
.aside-dark .menu .menu-item.show > .menu-link,
.aside-dark .menu .menu-item .menu-link.active {
    background-color: var(--theme-sidebar-active) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

.aside-dark .menu .menu-item.here > .menu-link .menu-title,
.aside-dark .menu .menu-item.show > .menu-link .menu-title,
.aside-dark .menu .menu-item .menu-link.active .menu-title,
.aside-dark .menu .menu-item.here > .menu-link .menu-icon i,
.aside-dark .menu .menu-item.show > .menu-link .menu-icon i,
.aside-dark .menu .menu-item .menu-link.active .menu-icon i {
    color: #ffffff !important;
}

.aside-dark .menu .menu-item .menu-link .menu-icon i {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.1rem;
}

.aside-dark .menu .menu-item .menu-link .menu-title {
    color: rgba(255, 255, 255, 0.75);
    font-weight: 500;
}

/* Header / Toolbar */
.header, #kt_header {
    background-color: #ffffff !important;
    box-shadow: 0 2px 10px rgba(18, 14, 14, 0.03);
    border-bottom: 1px solid rgba(229, 231, 235, 0.5);
    z-index: 105 !important;
}

/* Ensure profile dropdown and other menus stay on top */
.menu-dropdown {
    z-index: 106 !important;
}

.toolbar {
    border-bottom: none !important;
}

.page-title h1 {
    color: var(--theme-text-dark) !important;
    font-weight: 600 !important;
}

/* --- Cards --- */
.card {
    background-color: var(--theme-card-bg);
    border: none !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03) !important;
    margin-bottom: 1.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04) !important;
}

.card .card-header {
    border-bottom: 1px solid var(--theme-border) !important;
    min-height: 60px;
}

.card .card-title h3 {
    color: var(--theme-text-dark);
    font-weight: 600;
}

/* Fix dashboard stat cards background overrides */
.card.bg-success { background-color: #50CD89 !important; }
.card.bg-warning { background-color: #FFC700 !important; }
.card.bg-danger { background-color: #F1416C !important; }
.card.bg-info { background-color: #7239EA !important; }

/* Fix dashboard stat cards text color override */
.card.bg-success .card-body div,
.card.bg-warning .card-body div,
.card.bg-danger .card-body div,
.card.bg-info .card-body div {
    color: #ffffff !important;
}

/* --- Buttons --- */
.btn.btn-primary {
    background-color: var(--theme-primary) !important;
    border-color: var(--theme-primary) !important;
    color: #fff !important;
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.3) !important;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.btn.btn-primary:hover, .btn.btn-primary:active, .btn.btn-primary:focus {
    background-color: var(--theme-primary-hover) !important;
    border-color: var(--theme-primary-hover) !important;
    box-shadow: 0 4px 8px rgba(79, 70, 229, 0.4) !important;
    transform: translateY(-1px);
}

.btn.btn-danger {
    background-color: #EF4444 !important;
    border-color: #EF4444 !important;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3) !important;
    border-radius: 8px;
}
.btn.btn-danger:hover {
    background-color: #DC2626 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.4) !important;
}

/* --- Form Elements --- */
.form-control.form-control-solid,
.form-select.form-select-solid {
    background-color: #F9FAFB !important;
    border: 1px solid #E5E7EB !important;
    color: var(--theme-text-dark) !important;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.form-control.form-control-solid:focus,
.form-select.form-select-solid:focus {
    background-color: #fff !important;
    border-color: var(--theme-primary) !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15) !important;
}

label.fw-bold {
    color: #4B5563 !important;
    font-weight: 500 !important;
}

/* --- Tables (Reference Design) --- */
.table:not(.summary-table) {
    border-collapse: collapse;
    border-spacing: 0;
    width: 100%;
    margin-bottom: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
}

.table > thead > tr > th {
    background-color: #007bff !important; /* Blue header */
    color: #ffffff !important;
    font-weight: 600;
    padding: 12px 16px !important;
    border: 1px solid #7dd3fc !important;
    vertical-align: middle;
    white-space: nowrap;
}

/* Ensure first column has proper left padding (DataTables override fix) */
.table > thead > tr > th:first-child,
.table > tbody > tr > td:first-child {
    padding-left: 20px !important;
}

/* Ensure last column has proper right padding */
.table > thead > tr > th:last-child,
.table > tbody > tr > td:last-child {
    padding-right: 20px !important;
}

.table > tbody > tr,
table.dataTable tbody tr {
    background: #ffffff !important;
    background-color: #ffffff !important;
    transition: background-color 0.2s;
}

.table > tbody > tr:nth-of-type(even),
table.dataTable tbody tr:nth-of-type(even) {
    background-color: #f8fafc !important; /* Light alternating row */
}

.table > tbody > tr:hover {
    background-color: #f1f5f9 !important;
}

.table > tbody > tr > td {
    padding: 12px 16px;
    border: 1px solid #e2e8f0 !important;
    vertical-align: middle;
    color: #334155;
}

.table > tbody > tr:last-child > td {
    border-bottom: none !important;
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #D1D5DB;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: #9CA3AF;
}

/* --- Badges --- */
.badge.badge-light-success {
    background-color: #D1FAE5 !important;
    color: #065F46 !important;
}
.badge.badge-light-danger {
    background-color: #FEE2E2 !important;
    color: #991B1B !important;
}
.badge.badge-light-primary {
    background-color: var(--theme-primary-light) !important;
    color: var(--theme-primary-hover) !important;
}
.badge.badge-light-warning {
    background-color: #FEF3C7 !important;
    color: #92400E !important;
}

/* SweetAlert customization */
.swal2-popup {
    border-radius: 16px !important;
}
.swal2-confirm.btn-primary {
    background-color: var(--theme-primary) !important;
}

/* DataTables pagination */
.page-item.active .page-link {
    background-color: var(--theme-primary) !important;
    border-color: var(--theme-primary) !important;
}
