/**
 * REELEX ERP - Main Stylesheet
 * Styles principaux du système
 */

:root {
    --primary-color: #2e3192;
    --secondary-color: #4a4db8;
    --primary-hover: #4a4db8;
    --primary-deep: #1a1d6e;
    --primary-10: rgba(46, 49, 146, 0.10);
    --white: #ffffff;
    --black: #000000;
    --secondary-surface: #f5f5f5;
    --accent-light: #e0e0ff;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --navbar-height: 55px;
    --font-size-base: 14px;
    --font-size-sm: 13px;
    --font-size-xs: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: var(--font-size-base);
    background-color: #f8f9fa;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

#wrapper {
    display: flex;
    flex: 1;
    min-height: 100vh;
}

/* ==================== Sidebar ==================== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    z-index: 1000;
    transition: all 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
}

/* التأكد من أن الـ sidebar يكون تحت الـ navbar */
@media (min-width: 992px) {
    .sidebar {
        z-index: 1000;
    }
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.sidebar-header {
    padding: 15px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    max-width: 130px;
    height: auto;
}

.sidebar-nav {
    padding: 20px 0;
}

.sidebar-nav .nav-link {
    color: rgba(255, 255, 255, 0.8);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
    text-decoration: none;
    border-left: 3px solid transparent;
    font-size: var(--font-size-sm);
}

.sidebar-nav .nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-left-color: white;
}

.sidebar-nav .nav-link.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-left-color: white;
}

.sidebar-nav .nav-link i {
    width: 22px;
    font-size: 16px;
    margin-right: 10px;
}

.sidebar-nav .badge {
    margin-left: auto;
}

/* ==================== Submenu Styles ==================== */
.sidebar-nav .has-submenu > .nav-link {
    cursor: pointer;
    user-select: none;
}

.sidebar-nav .submenu-arrow {
    transition: transform 0.3s ease;
    font-size: 12px;
}

.sidebar-nav .nav-link[aria-expanded="true"] .submenu-arrow {
    transform: rotate(180deg);
}

.sidebar-nav .submenu {
    list-style: none;
    padding-left: 0;
    background: rgba(0, 0, 0, 0.1);
    margin: 0;
    display: none;
    overflow: hidden;
}

.sidebar-nav .submenu.show {
    display: block;
}

.sidebar-nav .submenu li {
    padding: 0;
}

.sidebar-nav .submenu .nav-link {
    padding: 8px 20px 8px 45px;
    font-size: var(--font-size-xs);
    border-left: none;
}

.sidebar-nav .submenu .nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
    padding-left: 50px;
}

.sidebar-nav .submenu .nav-link i {
    width: 18px;
    font-size: 13px;
    margin-right: 8px;
}

/* ==================== Main Content ==================== */
#page-content-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    flex: 1;
    width: calc(100% - var(--sidebar-width));
    position: relative;
    padding-top: var(--navbar-height); /* مساحة للـ navbar الثابت */
}

#page-content-wrapper .container-fluid {
    flex: 1;
    padding-top: 15px;
    padding-bottom: 50px; /* مساحة للفوتر الثابت */
}

/* ==================== Module Navigation ==================== */
.module-nav {
    position: sticky;
    top: calc(var(--navbar-height) + 20px);
    z-index: 100;
}

.module-nav-wrapper {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.module-nav-menu {
    padding: 0;
}

.module-nav-menu .nav-link {
    color: #495057;
    padding: 10px 16px;
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    text-decoration: none;
    font-size: var(--font-size-sm);
}

.module-nav-menu .nav-link:hover {
    background-color: #f8f9fa;
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

.module-nav-menu .nav-link.active {
    background-color: var(--primary-10);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    font-weight: 600;
}

.module-nav-menu .nav-link i {
    width: 20px;
    text-align: center;
}

@media (max-width: 768px) {
    .module-nav {
        margin-bottom: 20px;
        position: relative;
        top: 0;
    }
}

/* ==================== Navbar ==================== */
.navbar {
    height: var(--navbar-height) !important;
    min-height: var(--navbar-height) !important;
    max-height: var(--navbar-height) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    position: fixed !important;
    top: 0 !important;
    left: var(--sidebar-width);
    right: 0;
    width: calc(100% - var(--sidebar-width));
    z-index: 1030 !important;
    background-color: white !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    visibility: visible !important;
    opacity: 1 !important;
    overflow: visible !important;
}

/* Admin navbar: primary background and white text */
.admin-portal .navbar {
    background-color: var(--primary-color) !important;
    color: var(--white) !important;
}
.admin-portal .navbar .navbar-brand,
.admin-portal .navbar .nav-link,
.admin-portal .navbar .btn,
.admin-portal .navbar a.btn-link,
.admin-portal .navbar .dropdown-toggle {
    color: var(--white) !important;
}
.admin-portal .navbar .btn-link:hover,
.admin-portal .navbar .nav-link:hover {
    color: var(--white) !important;
    background-color: rgba(255, 255, 255, 0.08) !important;
}
.admin-portal .navbar .dropdown-menu {
    background-color: var(--white) !important;
    color: var(--black) !important;
}
.admin-portal .navbar .dropdown-item:hover { background-color: var(--primary-10) !important; }

.navbar .container-fluid {
    padding-left: 20px !important;
    padding-right: 20px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    height: 100% !important;
    min-height: var(--navbar-height) !important;
    flex-wrap: nowrap !important;
}

.navbar-brand {
    padding: 0 !important;
    margin: 0 !important;
    margin-left: 0 !important;
    font-size: 1.25rem !important;
    font-weight: 600 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100vw - 650px);
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    line-height: 1.2 !important;
    height: 100% !important;
    color: #333 !important;
    text-decoration: none !important;
    visibility: visible !important;
    opacity: 1 !important;
}

@media (max-width: 1400px) {
    .navbar-brand {
        max-width: calc(100vw - 580px);
        font-size: 1.2rem !important;
    }
}

@media (max-width: 1200px) {
    .navbar-brand {
        max-width: calc(100vw - 520px);
        font-size: 1.1rem !important;
    }
}

@media (max-width: 991px) {
    .navbar .container-fluid {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }
    
    .navbar-brand {
        max-width: calc(100vw - 380px);
        font-size: 1rem !important;
    }
}

@media (max-width: 768px) {
    .navbar-brand {
        max-width: calc(100vw - 280px);
        font-size: 0.95rem !important;
    }
}

/* RTL Support for navbar-brand */
[dir="rtl"] .navbar-brand {
    padding-right: 0 !important;
}

[dir="rtl"] .navbar .container-fluid {
    padding-right: 20px !important;
    padding-left: 20px !important;
}

.notification-dropdown {
    min-width: 350px;
    max-height: 400px;
    overflow-y: auto;
}

.notification-dropdown .dropdown-item {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    white-space: normal;
}

.notification-dropdown .dropdown-item:hover {
    background-color: #f8f9fa;
}

/* ==================== Notification Badges ==================== */
.notification-badge {
    font-size: 0.65rem !important;
    min-width: 18px !important;
    height: 18px !important;
    padding: 2px 5px !important;
    line-height: 14px !important;
    font-weight: 600 !important;
    border: 2px solid white;
    top: -2px !important;
    right: -2px !important;
}

.notification-badge:empty {
    display: none !important;
}

/* ==================== Navbar Right Side (Icons, Notifications, Profile) ==================== */
.navbar .ms-auto {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 0.5rem !important;
    height: 100% !important;
    visibility: visible !important;
    opacity: 1 !important;
    flex-shrink: 0 !important;
}

/* All items in ms-auto should be vertically centered */
.navbar .ms-auto > * {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 100% !important;
    min-height: var(--navbar-height) !important;
}

/* Dropdown containers */
.navbar .dropdown {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 100% !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
}

/* All buttons and links in navbar */
.navbar button,
.navbar .btn,
.navbar a.btn-link {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 100% !important;
    min-height: var(--navbar-height) !important;
    padding: 0 0.75rem !important;
    margin: 0 !important;
    visibility: visible !important;
    opacity: 1 !important;
    color: #495057;
    border: none !important;
    background: transparent !important;
    transition: all 0.2s ease !important;
}

.navbar .btn-link:hover {
    color: var(--primary-color) !important;
    background: rgba(0, 0, 0, 0.02) !important;
}

/* Icons in navbar */
.navbar .btn-link i,
.navbar button i {
    font-size: 1.1rem !important;
    color: inherit !important;
    visibility: visible !important;
    opacity: 1 !important;
    display: inline-block !important;
    line-height: 1 !important;
    margin: 0 !important;
}

/* Admin-only: set navbar buttons and icons to primary color */
.admin-portal .navbar .btn-link i,
.admin-portal .navbar button i,
.admin-portal .navbar i { color: var(--white) !important; }

/* Dropdown buttons specifically */
.navbar .dropdown > button {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 100% !important;
    min-height: var(--navbar-height) !important;
    padding: 0 0.75rem !important;
    margin: 0 !important;
}

/* Language dropdown button */
.navbar .btn-outline-secondary {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: auto !important;
    min-height: 36px !important;
    padding: 0.375rem 0.75rem !important;
    color: #6c757d !important;
    border-color: #6c757d !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Position relative for badges */
.navbar .position-relative {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative !important;
    height: 100% !important;
    min-height: var(--navbar-height) !important;
}

/* Notification badges */
.navbar .notification-badge {
    position: absolute !important;
    top: 8px !important;
    right: 4px !important;
    z-index: 10 !important;
}

/* Profile image and avatar */
.navbar img.rounded-circle {
    display: block !important;
    width: 34px !important;
    height: 34px !important;
    object-fit: cover !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.navbar .bg-primary.rounded-circle {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 34px !important;
    height: 34px !important;
    visibility: visible !important;
    opacity: 1 !important;
    font-size: 0.9rem !important;
    font-weight: 600 !important;
}

/* Force visibility for all navbar children */
.navbar * {
    visibility: visible !important;
}

.navbar *:not(.dropdown-menu) {
    opacity: 1 !important;
}

/* Ensure icons are visible */
.navbar .fas,
.navbar .fa,
.navbar i {
    color: inherit !important;
    visibility: visible !important;
    opacity: 1 !important;
    display: inline-block !important;
}

/* Ensure buttons are visible and clickable */
.navbar button,
.navbar .btn {
    pointer-events: auto !important;
    cursor: pointer !important;
}

/* Fix for Font Awesome icons */
.navbar i.fa,
.navbar i.fas,
.navbar i.far,
.navbar i.fal,
.navbar i.fab {
    font-family: "Font Awesome 6 Free" !important;
    font-weight: 900 !important;
    font-style: normal !important;
}

/* ==================== Cards ==================== */
.card {
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid #f0f0f0;
    font-weight: 600;
    font-size: var(--font-size-base);
    padding: 12px 16px;
}

/* Admin-only: card icons use primary color */
.admin-portal .card i,
.admin-portal .card .fa,
.admin-portal .card .fas,
.admin-portal .card .far,
.admin-portal .card .bi { color: var(--primary-color) !important; }

/* Admin-only: make stat circles readable with light backgrounds */
.admin-portal .card .rounded-circle.bg-primary {
    background-color: var(--primary-10) !important;
    color: var(--primary-color) !important;
    border: 1px solid var(--primary-30) !important;
}
.admin-portal .card .rounded-circle.bg-success {
    background-color: rgba(var(--bs-success-rgb, 25, 135, 84), .1) !important;
    color: rgb(var(--bs-success-rgb, 25, 135, 84)) !important;
    border: 1px solid rgba(var(--bs-success-rgb, 25, 135, 84), .25) !important;
}
.admin-portal .card .rounded-circle.bg-warning {
    background-color: rgba(var(--bs-warning-rgb, 255, 193, 7), .15) !important;
    color: rgb(var(--bs-warning-rgb, 255, 193, 7)) !important;
    border: 1px solid rgba(var(--bs-warning-rgb, 255, 193, 7), .3) !important;
}
.admin-portal .card .rounded-circle.bg-danger {
    background-color: rgba(var(--bs-danger-rgb, 220, 53, 69), .1) !important;
    color: rgb(var(--bs-danger-rgb, 220, 53, 69)) !important;
    border: 1px solid rgba(var(--bs-danger-rgb, 220, 53, 69), .25) !important;
}
.admin-portal .card .rounded-circle.bg-info {
    background-color: rgba(var(--bs-info-rgb, 13, 202, 240), .1) !important;
    color: rgb(var(--bs-info-rgb, 13, 202, 240)) !important;
    border: 1px solid rgba(var(--bs-info-rgb, 13, 202, 240), .25) !important;
}
.admin-portal .card .rounded-circle.bg-secondary {
    background-color: rgba(var(--bs-secondary-rgb, 108, 117, 125), .12) !important;
    color: rgb(var(--bs-secondary-rgb, 108, 117, 125)) !important;
    border: 1px solid rgba(var(--bs-secondary-rgb, 108, 117, 125), .25) !important;
}
.admin-portal .card .rounded-circle i,
.admin-portal .card .rounded-circle svg {
    filter: none !important;
    opacity: 1 !important;
}

/* ==================== Tables ==================== */
.table {
    background-color: white;
}

.table thead th {
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    color: #6c757d;
    padding: 10px 12px;
}

/* Admin: ensure table header titles are white on colored headers */
.admin-portal .table thead th,
.admin-portal .table thead th i {
    color: var(--white) !important;
}

/* Admin: make icons readable inside solid color blocks */
.admin-portal .card .bg-primary:not(.bg-opacity-10):not(.rounded-circle) i,
.admin-portal .bg-primary:not(.bg-opacity-10):not(.rounded-circle) i { color: var(--white) !important; }
.admin-portal .card .bg-success:not(.bg-opacity-10):not(.rounded-circle) i,
.admin-portal .bg-success:not(.bg-opacity-10):not(.rounded-circle) i { color: var(--white) !important; }
.admin-portal .card .bg-danger:not(.bg-opacity-10):not(.rounded-circle) i,
.admin-portal .bg-danger:not(.bg-opacity-10):not(.rounded-circle) i { color: var(--white) !important; }
.admin-portal .card .bg-info:not(.bg-opacity-10):not(.rounded-circle) i,
.admin-portal .bg-info:not(.bg-opacity-10):not(.rounded-circle) i { color: var(--white) !important; }
/* Warning blocks keep dark icon for contrast */
.admin-portal .card .bg-warning:not(.bg-opacity-10):not(.rounded-circle) i,
.admin-portal .bg-warning:not(.bg-opacity-10):not(.rounded-circle) i { color: #111 !important; }

.table tbody td {
    padding: 10px 12px;
    font-size: var(--font-size-sm);
}

.table-hover tbody tr:hover {
    background-color: #f8f9fa;
}

/* ==================== Buttons ==================== */
.btn {
    border-radius: 6px;
    padding: 6px 16px;
    font-weight: 500;
    font-size: var(--font-size-sm);
    transition: all 0.3s ease;
}

.btn-lg {
    padding: 10px 24px;
    font-size: var(--font-size-base);
}

.btn-sm {
    padding: 4px 12px;
    font-size: var(--font-size-xs);
}

.btn-primary {
    background: var(--primary-color);
    color: var(--white);
    border: none;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(26, 29, 110, 0.25);
}

/* Secondary (outline) button aligned to spec */
.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background: transparent;
}
.btn-outline-primary:hover {
    color: var(--white);
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

/* ==================== Forms ==================== */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(46, 49, 146, 0.25);
}

/* ==================== Badges ==================== */
.badge {
    padding: 4px 10px;
    font-weight: 500;
    font-size: 0.75rem;
    border-radius: 4px;
}

/* ==================== Footer ==================== */
.footer {
    background-color: white;
    border-top: 1px solid #dee2e6;
    margin-left: var(--sidebar-width);
    position: fixed;
    bottom: 0;
    z-index: 1020;
    box-shadow: 0 -2px 4px rgba(0,0,0,0.08);
    width: calc(100% - var(--sidebar-width));
    margin-top: auto;
    padding: 0 !important;
}

.footer .container-fluid {
    padding: 8px 20px !important;
}

.footer p {
    margin: 0 !important;
    font-size: 0.8rem !important;
    line-height: 1.4 !important;
}

.footer a {
    font-size: 0.8rem !important;
}

/* ==================== Responsive ==================== */
@media (max-width: 991px) {
    .sidebar {
        margin-left: calc(-1 * var(--sidebar-width));
    }
    
    .sidebar.show {
        margin-left: 0;
    }
    
    #page-content-wrapper {
        margin-left: 0;
        width: 100%;
    }
    
    .footer {
        margin-left: 0;
        width: 100% !important;
    }
    
    #page-content-wrapper .container-fluid {
        padding-bottom: 60px;
    }
    
    .navbar {
        position: fixed !important;
        top: 0 !important;
        left: 0;
        right: 0;
        width: 100% !important;
        z-index: 1030 !important;
    }
    
    #page-content-wrapper {
        padding-top: var(--navbar-height);
        margin-left: 0;
        width: 100%;
    }
}

/* ==================== RTL Support ==================== */
[dir="rtl"] .sidebar {
    left: auto;
    right: 0;
}

[dir="rtl"] .navbar {
    left: auto;
    right: var(--sidebar-width);
}

[dir="rtl"] #page-content-wrapper {
    margin-left: 0;
    margin-right: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
}

[dir="rtl"] .footer {
    margin-left: 0;
    margin-right: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
}

/* Footer fixed positioning support */

[dir="rtl"] .sidebar-nav .nav-link {
    border-left: none;
    border-right: 3px solid transparent;
}

[dir="rtl"] .sidebar-nav .nav-link:hover,
[dir="rtl"] .sidebar-nav .nav-link.active {
    border-right-color: white;
}

[dir="rtl"] .sidebar-nav .nav-link i {
    margin-right: 0;
    margin-left: 10px;
}

[dir="rtl"] .sidebar-nav .submenu .nav-link {
    padding: 10px 50px 10px 20px;
}

[dir="rtl"] .sidebar-nav .submenu .nav-link:hover {
    padding-right: 55px;
    padding-left: 20px;
}

[dir="rtl"] .sidebar-nav .submenu .nav-link i {
    margin-right: 8px;
    margin-left: 0;
}

/* ==================== Animations ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease;
}

/* ==================== Custom Utilities ==================== */
.shadow-sm {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08) !important;
}

.shadow {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1) !important;
}

.shadow-lg {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15) !important;
}

.bg-gradient-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
}

.text-gradient {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

/* Admin cards per spec */
.admin-portal .card {
    background-color: var(--secondary-surface);
    border: 1px solid var(--accent-light);
}
.admin-portal .card-header,
.admin-portal .card-title,
.admin-portal .card .card-header h5,
.admin-portal .card .card-header .h5 {
    color: var(--primary-color);
}

/* Utilities aligned to palette */
.text-primary { color: var(--primary-color) !important; }
.bg-primary { background-color: var(--primary-color) !important; color: var(--white) !important; }
.border-primary { border-color: var(--primary-color) !important; }
.bg-primary-10 { background-color: var(--primary-10) !important; }
.text-white { color: var(--white) !important; }
.text-black { color: var(--black) !important; }

/* ==================== Typography Improvements ==================== */
h1 {
    font-size: 1.75rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.25rem;
}

h4 {
    font-size: 1.1rem;
}

h5 {
    font-size: 1rem;
}

h6 {
    font-size: 0.9rem;
}

.card-body {
    padding: 16px;
}

/* ==================== Global Contrast Fixes ==================== */
/* Ensure header links and icons inside colored table headers stay white */
.admin-portal .table thead th a,
.admin-portal .table thead th .btn-link,
.admin-portal .table thead th i,
.admin-portal .table thead th svg,
.client-portal .table thead th a,
.client-portal .table thead th .btn-link,
.client-portal .table thead th i,
.client-portal .table thead th svg { color: #fff !important; }

/* Make text and icons readable inside solid bg-* blocks (excluding light-opacity and circles) */
.admin-portal .bg-primary:not(.bg-opacity-10):not(.rounded-circle),
.admin-portal .bg-success:not(.bg-opacity-10):not(.rounded-circle),
.admin-portal .bg-danger:not(.bg-opacity-10):not(.rounded-circle),
.admin-portal .bg-info:not(.bg-opacity-10):not(.rounded-circle),
.admin-portal .bg-secondary:not(.bg-opacity-10):not(.rounded-circle),
.client-portal .bg-primary:not(.bg-opacity-10):not(.rounded-circle),
.client-portal .bg-success:not(.bg-opacity-10):not(.rounded-circle),
.client-portal .bg-danger:not(.bg-opacity-10):not(.rounded-circle),
.client-portal .bg-info:not(.bg-opacity-10):not(.rounded-circle),
.client-portal .bg-secondary:not(.bg-opacity-10):not(.rounded-circle) {
  color: #fff !important;
}
.admin-portal .bg-warning:not(.bg-opacity-10):not(.rounded-circle),
.client-portal .bg-warning:not(.bg-opacity-10):not(.rounded-circle) { color: #111 !important; }

/* Icons inside the above blocks */
.admin-portal .bg-primary:not(.bg-opacity-10):not(.rounded-circle) i,
.admin-portal .bg-success:not(.bg-opacity-10):not(.rounded-circle) i,
.admin-portal .bg-danger:not(.bg-opacity-10):not(.rounded-circle) i,
.admin-portal .bg-info:not(.bg-opacity-10):not(.rounded-circle) i,
.admin-portal .bg-secondary:not(.bg-opacity-10):not(.rounded-circle) i,
.client-portal .bg-primary:not(.bg-opacity-10):not(.rounded-circle) i,
.client-portal .bg-success:not(.bg-opacity-10):not(.rounded-circle) i,
.client-portal .bg-danger:not(.bg-opacity-10):not(.rounded-circle) i,
.client-portal .bg-info:not(.bg-opacity-10):not(.rounded-circle) i,
.client-portal .bg-secondary:not(.bg-opacity-10):not(.rounded-circle) i { color: #fff !important; }
.admin-portal .bg-warning:not(.bg-opacity-10):not(.rounded-circle) i,
.client-portal .bg-warning:not(.bg-opacity-10):not(.rounded-circle) i { color: #111 !important; }

/* Badges: force proper text/icon contrast for bg-* */
.badge.bg-primary,
.badge.bg-success,
.badge.bg-danger,
.badge.bg-info,
.badge.bg-secondary { color: #fff !important; }
.badge.bg-warning { color: #111 !important; }
.badge.bg-primary i,
.badge.bg-success i,
.badge.bg-danger i,
.badge.bg-info i,
.badge.bg-secondary i { color: #fff !important; }
.badge.bg-warning i { color: #111 !important; }

/* Small status squares on cards (badges without text) should still show white icons */
.card .badge.bg-primary i,
.card .badge.bg-success i,
.card .badge.bg-danger i,
.card .badge.bg-info i,
.card .badge.bg-secondary i { color: #fff !important; }

/* Card headers: keep text readable over dark solid backgrounds */
.admin-portal .card .card-header.bg-primary,
.admin-portal .card .card-header.bg-success,
.admin-portal .card .card-header.bg-danger,
.admin-portal .card .card-header.bg-info,
.admin-portal .card .card-header.bg-secondary,
.admin-portal .card .card-header.bg-dark { color: #fff !important; }
.admin-portal .card .card-header.bg-warning { color: #111 !important; }
.admin-portal .card .card-header.bg-primary i,
.admin-portal .card .card-header.bg-success i,
.admin-portal .card .card-header.bg-danger i,
.admin-portal .card .card-header.bg-info i,
.admin-portal .card .card-header.bg-secondary i,
.admin-portal .card .card-header.bg-dark i { color: #fff !important; }
.admin-portal .card .card-header.bg-warning i { color: #111 !important; }


.admin-portal .card .card-header[class*="bg-"] {
  color: #fff !important;
}
.admin-portal .card .card-header[class*="bg-"] i,
.admin-portal .card .card-header[class*="bg-"] svg,
.admin-portal .card .card-header[class*="bg-"] a,
.admin-portal .card .card-header[class*="bg-"] .btn-link,
.admin-portal .card .card-header[class*="bg-"] .card-title,
.admin-portal .card .card-header[class*="bg-"] .card-title *,
.admin-portal .card .card-header[class*="bg-"] .h1,
.admin-portal .card .card-header[class*="bg-"] .h2,
.admin-portal .card .card-header[class*="bg-"] .h3,
.admin-portal .card .card-header[class*="bg-"] .h4,
.admin-portal .card .card-header[class*="bg-"] .h5,
.admin-portal .card .card-header[class*="bg-"] .h6 { color: #fff !important; }
.admin-portal .card .card-header[class*="bg-warning"] { color: #111 !important; }
.admin-portal .card .card-header[class*="bg-warning"] i,
.admin-portal .card .card-header[class*="bg-warning"] svg,
.admin-portal .card .card-header[class*="bg-warning"] a,
.admin-portal .card .card-header[class*="bg-warning"] .btn-link { color: #111 !important; }


/* Also handle cases where the background class is applied on the card itself */
.admin-portal .card[class*="bg-"] .card-header { color: #fff !important; }
.admin-portal .card[class*="bg-"] .card-header i,
.admin-portal .card[class*="bg-"] .card-header svg,
.admin-portal .card[class*="bg-"] .card-header .card-title,
.admin-portal .card[class*="bg-"] .card-header .card-title *,
.admin-portal .card[class*="bg-"] .card-header .h1,
.admin-portal .card[class*="bg-"] .card-header .h2,
.admin-portal .card[class*="bg-"] .card-header .h3,
.admin-portal .card[class*="bg-"] .card-header .h4,
.admin-portal .card[class*="bg-"] .card-header .h5,
.admin-portal .card[class*="bg-"] .card-header .h6,
.admin-portal .card[class*="bg-"] .card-header .text-primary,
.admin-portal .card[class*="bg-"] .card-header .text-success,
.admin-portal .card[class*="bg-"] .card-header .text-danger,
.admin-portal .card[class*="bg-"] .card-header .text-info,
.admin-portal .card[class*="bg-"] .card-header .text-secondary { color: #fff !important; }
.admin-portal .card.bg-warning .card-header,
.admin-portal .card.bg-warning .card-header *,
.admin-portal .card[class*="bg-warning"] .card-header .text-primary,
.admin-portal .card[class*="bg-warning"] .card-header .text-success,
.admin-portal .card[class*="bg-warning"] .card-header .text-danger,
.admin-portal .card[class*="bg-warning"] .card-header .text-info,
.admin-portal .card[class*="bg-warning"] .card-header .text-secondary { color: #111 !important; }
.admin-portal .card.bg-light .card-header,
.admin-portal .card.bg-white .card-header { color: inherit !important; }

/* Client portal: ensure white text on colored card headers as well */
.client-portal .card .card-header[class*="bg-"] { color: #fff !important; }
.client-portal .card .card-header[class*="bg-"] i,
.client-portal .card .card-header[class*="bg-"] svg,
.client-portal .card .card-header[class*="bg-"] a,
.client-portal .card .card-header[class*="bg-"] .btn-link,
.client-portal .card .card-header[class*="bg-"] .card-title,
.client-portal .card .card-header[class*="bg-"] .card-title *,
.client-portal .card .card-header[class*="bg-"] .h1,
.client-portal .card .card-header[class*="bg-"] .h2,
.client-portal .card .card-header[class*="bg-"] .h3,
.client-portal .card .card-header[class*="bg-"] .h4,
.client-portal .card .card-header[class*="bg-"] .h5,
.client-portal .card .card-header[class*="bg-"] .h6,
.client-portal .card .card-header[class*="bg-"] .text-primary,
.client-portal .card .card-header[class*="bg-"] .text-success,
.client-portal .card .card-header[class*="bg-"] .text-danger,
.client-portal .card .card-header[class*="bg-"] .text-info,
.client-portal .card .card-header[class*="bg-"] .text-secondary { color: #fff !important; }
.client-portal .card .card-header[class*="bg-warning"],
.client-portal .card .card-header[class*="bg-warning"] * { color: #111 !important; }

/* Footer color contrast: ensure readable text on colored footers */
.admin-portal .card .card-footer[class*="bg-"] { color: #fff !important; }
.admin-portal .card .card-footer[class*="bg-"] i,
.admin-portal .card .card-footer[class*="bg-"] svg,
.admin-portal .card .card-footer[class*="bg-"] a,
.admin-portal .card .card-footer[class*="bg-"] .btn-link,
.admin-portal .card .card-footer[class*="bg-"] .h1,
.admin-portal .card .card-footer[class*="bg-"] .h2,
.admin-portal .card .card-footer[class*="bg-"] .h3,
.admin-portal .card .card-footer[class*="bg-"] .h4,
.admin-portal .card .card-footer[class*="bg-"] .h5,
.admin-portal .card .card-footer[class*="bg-"] .h6,
.admin-portal .card .card-footer[class*="bg-"] .text-primary,
.admin-portal .card .card-footer[class*="bg-"] .text-success,
.admin-portal .card .card-footer[class*="bg-"] .text-danger,
.admin-portal .card .card-footer[class*="bg-"] .text-info,
.admin-portal .card .card-footer[class*="bg-"] .text-secondary { color: #fff !important; }
.admin-portal .card .card-footer[class*="bg-warning"],
.admin-portal .card .card-footer[class*="bg-warning"] * { color: #111 !important; }
.admin-portal .card[class*="bg-"] .card-footer { color: #fff !important; }
.admin-portal .card[class*="bg-warning"] .card-footer,
.admin-portal .card[class*="bg-warning"] .card-footer * { color: #111 !important; }

.client-portal .card .card-footer[class*="bg-"] { color: #fff !important; }
.client-portal .card .card-footer[class*="bg-"] i,
.client-portal .card .card-footer[class*="bg-"] svg,
.client-portal .card .card-footer[class*="bg-"] a,
.client-portal .card .card-footer[class*="bg-"] .btn-link,
.client-portal .card .card-footer[class*="bg-"] .h1,
.client-portal .card .card-footer[class*="bg-"] .h2,
.client-portal .card .card-footer[class*="bg-"] .h3,
.client-portal .card .card-footer[class*="bg-"] .h4,
.client-portal .card .card-footer[class*="bg-"] .h5,
.client-portal .card .card-footer[class*="bg-"] .h6,
.client-portal .card .card-footer[class*="bg-"] .text-primary,
.client-portal .card .card-footer[class*="bg-"] .text-success,
.client-portal .card .card-footer[class*="bg-"] .text-danger,
.client-portal .card .card-footer[class*="bg-"] .text-info,
.client-portal .card .card-footer[class*="bg-"] .text-secondary { color: #fff !important; }
.client-portal .card .card-footer[class*="bg-warning"],
.client-portal .card .card-footer[class*="bg-warning"] * { color: #111 !important; }
.client-portal .card[class*="bg-"] .card-footer { color: #fff !important; }
.client-portal .card[class*="bg-warning"] .card-footer,
.client-portal .card[class*="bg-warning"] .card-footer * { color: #111 !important; }


