/* ==============================================
   COMPLETE THEME FIXES - Light & Dark Mode
   ============================================== */

/* 1. TABLE HEADER FIXES - HIGH CONTRAST */
.thead-light th {
    background-color: #f8f9fc !important;
    color: #2d3748 !important;
    /* Very dark gray - high contrast */
    font-weight: 600 !important;
    border-bottom: 2px solid #e2e8f0 !important;
}

[data-theme="dark"] .thead-light th {
    background-color: #374151 !important;
    /* Visible gray background */
    color: #f9fafb !important;
    /* Almost white - high contrast */
    border-bottom-color: #4b5563 !important;
}

/* Also target .table thead th directly */
[data-theme="dark"] .table thead th {
    background-color: #374151 !important;
    color: #f9fafb !important;
}

/* 2. CARD HEADER FIXES - HIGH CONTRAST */
.card-header {
    background-color: #f8f9fc !important;
    color: #1a202c !important;
    /* Very dark */
    font-weight: 600 !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

[data-theme="dark"] .card-header {
    background-color: #2d3748 !important;
    color: #f7fafc !important;
    /* Almost white */
    border-bottom-color: #4a5568 !important;
}

.card-header .text-primary {
    color: #3b82f6 !important;
    /* Keep blue visible in both */
}

/* 3. TABLE BORDERS - VISIBLE IN BOTH THEMES */
.table-bordered,
.table-bordered th,
.table-bordered td {
    border-color: #cbd5e1 !important;
}

[data-theme="dark"] .table-bordered,
[data-theme="dark"] .table-bordered th,
[data-theme="dark"] .table-bordered td {
    border-color: #4a5568 !important;
    /* Medium gray - visible */
}

/* 4. TOPBAR NAV LINKS - LIGHT THEME FIX */
.topbar .nav-link,
.topbar .navbar-nav .nav-link {
    color: #1a202c !important;
    /* Dark text for light background */
}

.topbar .nav-link:hover,
.topbar .navbar-nav .nav-link:hover {
    color: #3b82f6 !important;
}

[data-theme="dark"] .topbar .nav-link,
[data-theme="dark"] .topbar .navbar-nav .nav-link {
    color: #f7fafc !important;
    /* Light text for dark background */
}

/* 5. BUTTON CONTRAST FIXES */
.btn-outline-success {
    color: #059669 !important;
    border-color: #059669 !important;
}

.btn-outline-success:hover {
    background-color: #059669 !important;
    color: #fff !important;
}

.btn-outline-secondary {
    color: #64748b !important;
    border-color: #64748b !important;
}

.btn-outline-secondary:hover {
    background-color: #64748b !important;
    color: #fff !important;
}

.btn-outline-danger {
    color: #dc2626 !important;
    border-color: #dc2626 !important;
}

.btn-outline-danger:hover {
    background-color: #dc2626 !important;
    color: #fff !important;
}

.btn-outline-primary {
    color: #3b82f6 !important;
    border-color: #3b82f6 !important;
}

.btn-outline-primary:hover {
    background-color: #3b82f6 !important;
    color: #fff !important;
}

/* Dark theme button adjustments */
[data-theme="dark"] .btn-outline-success {
    color: #10b981 !important;
    border-color: #10b981 !important;
}

[data-theme="dark"] .btn-outline-secondary {
    color: #94a3b8 !important;
    border-color: #94a3b8 !important;
}

/* 6. TEXT COLOR FIXES */
.text-gray-800 {
    color: #1e293b !important;
}

[data-theme="dark"] .text-gray-800 {
    color: #f1f5f9 !important;
}

.text-muted {
    color: #64748b !important;
}

[data-theme="dark"] .text-muted {
    color: #94a3b8 !important;
}

/* 7. TABLE RESPONSIVE - HORIZONTAL SCROLL */
.table-responsive {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    display: block !important;
    width: 100% !important;
}

.table-responsive>.table {
    margin-bottom: 0 !important;
    min-width: 800px;
    /* Force min width so tables can scroll */
}

/* 8. IDENTITY AREA FIXES */
.identity-layout .sidebar {
    z-index: 999 !important;
}

.identity-layout #content-wrapper {
    position: relative;
    z-index: 1 !important;
}

/* Ensure clickable links in Identity sidebar */
.identity-layout .sidebar .nav-link {
    pointer-events: auto !important;
    cursor: pointer !important;
}