:root {
    /* Corporate Light Theme */
    --bg-primary: #f4f6f9;
    --bg-secondary: #ffffff;
    --sidebar-bg: #1e293b;
    --header-bg: #ffffff;
    --accent-primary: #2563eb;
    --accent-hover: #1d4ed8;
    --active-bg: rgba(37, 99, 235, 0.10);
    --text-primary: #1e293b;
    /* Dark Slate */
    --text-secondary: #475569;
    /* Darker Slate for better visibility */
    --border-color: #e2e8f0;
    --card-bg: #ffffff;
    --content-padding: 3.5rem;
    --content-gap: 2rem;

    /* Layout Constants */
    --sidebar-width: 64px;
    --sidebar-expanded: 240px;
    --header-height: 70px;
    --radius-sm: 6px;
    --radius-md: 10px;
}

/* ===== Base ===== */
body {
    background-color: var(--bg-primary) !important;
    color: var(--text-primary) !important;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    overflow: hidden;
    height: 100vh;
}

/* ===== Layout ===== */
#wrapper {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar (Force slim version) --- */
#accordionSidebar,
.modern-sidebar,
.sidebar {
    width: 64px !important;
    min-width: 64px !important;
    max-width: 64px !important;
    background-color: var(--sidebar-bg) !important;
    background-image: none !important;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    transition: none !important;
    display: flex !important;
    flex-direction: column !important;
    z-index: 1000;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    padding: 0 !important;
    margin: 0 !important;
}

#content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    margin-left: 64px !important;
    height: 100vh;
    overflow-y: auto;
    padding-top: var(--header-height);
    background-color: var(--bg-primary) !important;
}

/* --- Header --- */
.navbar,
#content-wrapper .navbar {
    height: var(--header-height);
    background: var(--header-bg) !important;
    border-bottom: 1px solid var(--border-color);
    padding: 0 1.5rem !important;
    position: fixed;
    top: 0;
    left: 64px !important;
    right: 0;
    z-index: 900;
    width: calc(100% - 64px) !important;
}

/* Kill any legacy gradients */
.bg-gradient-primary,
.bg-primary {
    background-image: none !important;
    background-color: var(--bg-primary) !important;
}

/* --- Nav Links (header area) --- */
#content {
    flex: 1;
}

#content .container-fluid,
#content .container {
    width: 100%;
    max-width: none !important;
    padding-left: var(--content-padding) !important;
    padding-right: var(--content-padding) !important;
    margin-left: auto;
    margin-right: auto;
    margin-top: 10px;
    margin-bottom: 10px;
}

.nav-item .nav-link {
    color: var(--text-secondary);
    padding: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    border-radius: var(--radius-md);
    margin: 4px 8px;
}

.nav-item .nav-link:hover,
.nav-item.active .nav-link {
    color: var(--accent-primary);
    background: var(--active-bg);
}

.nav-item .nav-link i {
    font-size: 1.25rem;
}

/* ===== Cards ===== */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* ===== Buttons ===== */
.btn-primary {
    background: var(--accent-primary) !important;
    border-color: var(--accent-primary) !important;
    font-weight: 500;
    padding: 0.5rem 1rem;
    color: #fff !important;
}

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

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ===== Dropdown ===== */
.dropdown-menu {
    background: var(--card-bg) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
}

.dropdown-item {
    color: var(--text-primary) !important;
}

.dropdown-item:hover {
    background-color: rgba(37, 99, 235, 0.06) !important;
    color: var(--accent-primary) !important;
}

/* ===== GLOBAL LIGHT THEME OVERRIDES ===== */
/* Force all names and text to be visible */
#content-wrapper .text-white,
.container-fluid .text-white,
.modal-content .text-white {
    color: var(--text-primary) !important;
}

/* Fix lingering dark backgrounds */
#content-wrapper .bg-dark,
.modal-content.bg-secondary,
.modal-content .bg-secondary,
.modal-content.bg-dark,
.modal-content .bg-dark {
    background-color: var(--card-bg) !important;
}

/* Ensure labels are extremely visible (the "names") */
.form-label,
label {
    color: var(--text-primary) !important;
    font-weight: 600 !important;
    opacity: 1 !important;
}

/* Fix Bootstrap .bg-opacity-10, .bg-opacity-25 on white backgrounds */
.bg-opacity-10,
.bg-opacity-25 {
    --bs-bg-opacity: 0.1 !important;
    background-color: rgba(var(--bs-primary-rgb, 37, 99, 235), 0.1) !important;
}

/* Override bg-primary on body */
body.bg-primary,
.bg-primary {
    background-color: var(--bg-primary) !important;
}

/* Tables: ensure readable text */
.table {
    color: var(--text-primary) !important;
    --bs-table-bg: transparent;
}

.table-dark {
    --bs-table-bg: var(--card-bg) !important;
    --bs-table-color: var(--text-primary) !important;
    color: var(--text-primary) !important;
}

.table th,
.table td {
    border-color: var(--border-color) !important;
}

/* Form controls */
.form-control,
.form-select {
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: var(--text-primary) !important;
}

.form-control:focus,
.form-select:focus {
    background-color: #ffffff !important;
    border-color: var(--accent-primary) !important;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1) !important;
}

/* --- Tabs Styling --- */
.nav-tabs .nav-link {
    transition: all 0.2s ease;
    border: 1px solid transparent !important;
    font-weight: 500;
}

.nav-tabs .nav-link.active {
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.3), 0 2px 4px -1px rgba(37, 99, 235, 0.2) !important;
    font-weight: 700 !important;
    background-color: var(--accent-primary) !important;
    color: #ffffff !important;
    transform: translateY(-1px);
}

.nav-tabs .nav-link:not(.active) {
    background-color: #f1f5f9 !important;
    color: #64748b !important;
}

.nav-tabs .nav-link:not(.active):hover {
    background-color: #e2e8f0 !important;
    color: var(--accent-primary) !important;
}

.input-group-text {
    background-color: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    color: var(--text-secondary) !important;
}

/* Modals */
.modal-content {
    background-color: var(--card-bg) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1) !important;
}

.modal-header,
.modal-footer {
    border-color: var(--border-color) !important;
    background-color: #f8fafc !important;
}

.modal-title {
    color: var(--text-primary) !important;
}

.btn-close {
    filter: invert(1) grayscale(100%) brightness(0.5) !important;
    /* Make close button dark */
}

/* ng-cloak */
[ng-cloak] {
    display: none !important;
}

/* --- Logo in header/menu --- */
.header-logo {
    height: 32px;
    width: auto;
    object-fit: contain;
}

/* ===== Utilities ===== */
.hover-bg-light:hover {
    background-color: var(--bg-primary) !important;
    cursor: pointer;
}

.transition-all {
    transition: all 0.2s ease-in-out;
}

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

/* Animations */
.animate__animated {
    animation-duration: 0.3s;
    animation-fill-mode: both;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate__fadeIn {
    animation-name: fadeIn;
}