/* MedLab Pro - Theme System */
/* This file contains all theme variables and can be included in all pages */

/* Dark Theme (Default) */
:root,
[data-theme="dark"] {
    /* Hardcoded fallbacks for visibility */
    background-color: var(--bg-primary, #080c14);
    color: var(--text-primary, #f8fafc);

    --primary-color: #10b981;
    --primary-dark: #059669;
    --primary-light: #34d399;
    --secondary-color: #06b6d4;
    --accent-color: #8b5cf6;

    --bg-primary: #080c14;
    /* Slightly darker for more depth */
    --bg-secondary: #0f172a;
    /* Lighter than primary for cards/sidebar */
    --bg-tertiary: #1e293b;
    --bg-hover: #2d3748;

    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    /* Brighter muted text for better legibility */
    --text-inverse: #0f172a;

    --border-color: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.04);

    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.4);

    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.2);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.2);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.2);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.2);

    --gradient-primary: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    --gradient-accent: linear-gradient(135deg, var(--accent-color), #a78bfa);

    --navbar-bg: rgba(15, 23, 42, 0.95);
    --card-bg: var(--bg-secondary);
    --input-bg: rgba(255, 255, 255, 0.05);
    --input-bg-focus: rgba(255, 255, 255, 0.08);
}

/* Light Theme */
[data-theme="light"] {
    --primary-color: #059669;
    --primary-dark: #047857;
    --primary-light: #10b981;
    --secondary-color: #0891b2;
    --accent-color: #7c3aed;

    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-hover: #e2e8f0;

    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --text-inverse: #f8fafc;

    --border-color: rgba(0, 0, 0, 0.08);
    --border-light: rgba(0, 0, 0, 0.04);

    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

    --success: #16a34a;
    --success-bg: rgba(22, 163, 74, 0.15);
    --warning: #d97706;
    --warning-bg: rgba(217, 119, 6, 0.15);
    --danger: #dc2626;
    --danger-bg: rgba(220, 38, 38, 0.15);
    --info: #2563eb;
    --info-bg: rgba(37, 99, 235, 0.15);

    --gradient-primary: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    --gradient-accent: linear-gradient(135deg, var(--accent-color), #8b5cf6);

    --navbar-bg: rgba(255, 255, 255, 0.95);
    --card-bg: var(--bg-secondary);
    --input-bg: rgba(0, 0, 0, 0.03);
    --input-bg-focus: rgba(0, 0, 0, 0.05);
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

/* Theme Toggle Button */
.theme-toggle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.sidebar {
    background: var(--bg-secondary);
    height: calc(100vh - 48px);
    border-right: 1px solid var(--border-color);
    /* Added border for separation */
    padding: 1rem 0.75rem;
    position: fixed;
    left: 0;
    width: 210px;
    top: 48px;
    transition: transform 0.3s ease-in-out;
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Gap filler - extends sidebar background to cover any gap */
.sidebar::after {
    content: '';
    position: absolute;
    top: 0;
    right: -10px;
    width: 10px;
    height: 100%;
    background: var(--bg-secondary);
    z-index: -1;
}

/* Thin Scrollbar for Sidebar */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.theme-toggle:hover {
    background: var(--bg-hover);
    transform: scale(1.05);
    border-color: var(--primary-color);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    position: absolute;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-toggle .icon-sun {
    color: #f59e0b;
}

.theme-toggle .icon-moon {
    color: #6366f1;
}

[data-theme="dark"] .theme-toggle .icon-sun {
    opacity: 1;
    transform: rotate(0deg);
}

[data-theme="dark"] .theme-toggle .icon-moon {
    opacity: 0;
    transform: rotate(-90deg);
}

[data-theme="light"] .theme-toggle .icon-sun {
    opacity: 0;
    transform: rotate(90deg);
}

[data-theme="light"] .theme-toggle .icon-moon {
    opacity: 1;
    transform: rotate(0deg);
}

/* Global Table Theme Overrides */
.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-primary);
    --bs-table-border-color: var(--border-light);
    --bs-table-accent-bg: transparent;
    --bs-table-striped-color: var(--text-primary);
    --bs-table-striped-bg: rgba(255, 255, 255, 0.02);
    --bs-table-active-color: var(--text-primary);
    --bs-table-active-bg: var(--bg-tertiary);
    --bs-table-hover-color: var(--text-primary);
    --bs-table-hover-bg: var(--bg-tertiary);

    color: var(--text-primary);
    border-color: var(--border-light);
}

[data-theme="light"] .table {
    --bs-table-striped-bg: rgba(0, 0, 0, 0.02);
}

.table-custom {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}

.table-custom thead th {
    background: var(--bg-tertiary) !important;
    color: var(--text-muted) !important;
    border-bottom: 1px solid var(--border-color) !important;
}

.table-custom tbody td {
    background: transparent !important;
    color: var(--text-primary) !important;
    border-color: var(--border-light) !important;
}

/* Theme Transition */
body,
.navbar-custom,
.sidebar,
.card-custom,
.stat-card,
.table-wrapper,
.table,
.table td,
.table th,
.modal-content {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Mobile Sidebar & Navigation */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        width: 250px;
        box-shadow: var(--shadow-lg);
    }

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

    .main-content {
        margin-left: 0;
        width: 100%;
    }

    .navbar-custom {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    #sidebarToggle {
        color: var(--text-primary);
        font-size: 1.25rem;
        padding: 0;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* --- Portal-Specific Enhancements (Unified Theme v2.0) --- */

/* Global Navbar */
.navbar-custom {
    background: var(--bg-secondary) !important;
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    z-index: 1050;
}

.navbar-custom .navbar-brand,
.navbar-custom .nav-link,
.navbar-custom .navbar-toggler {
    color: var(--text-primary) !important;
}

.navbar-custom .nav-link:hover {
    color: var(--primary-color) !important;
}

.navbar-custom .btn-link {
    color: var(--text-primary) !important;
}

/* Sidebar Links */
.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.55rem 0.75rem;
    color: var(--text-secondary);
    /* Using text-secondary instead of text-muted for better visibility */
    text-decoration: none !important;
    border-radius: 0.5rem;
    margin-bottom: 0.2rem;
    transition: all 0.2s ease;
    gap: 10px;
    font-size: 0.85rem;
}

.sidebar-link:hover {
    background: var(--bg-tertiary);
    color: var(--primary-color);
}

.sidebar-link.active {
    background: var(--primary-color);
    color: white !important;
}

.sidebar-link i {
    width: 18px;
    font-size: 0.9rem;
    text-align: center;
}

/* Global Main Content - Compact Layout */
.main-content {
    margin-left: 210px;
    width: calc(100% - 210px);
    padding: 1rem 1.25rem;
    margin-top: 48px;
    min-height: calc(100vh - 48px);
    background: var(--bg-primary);
}

/* Fill any potential gap between sidebar and content */
body {
    background: var(--bg-primary) !important;
}

/* Compact Typography for Content */
.main-content h1,
.main-content h2 {
    font-size: 1.5rem;
}

.main-content h3 {
    font-size: 1.25rem;
}

.main-content p,
.main-content span,
.main-content td {
    font-size: 0.875rem;
}

/* Global Navbar - Compact */
.navbar-custom {
    height: 48px;
    padding-top: 0;
    padding-bottom: 0;
    font-size: 0.875rem;
}

.navbar-brand {
    font-size: 1rem;
}

/* Owner Executive Overrides (Gold) */
.sidebar-owner .sidebar-link.active {
    background: var(--warning) !important;
    color: #0f172a !important;
    font-weight: 700 !important;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.sidebar-owner .sidebar-link.active i {
    color: #0f172a !important;
}

/* Doctor Portal Overrides (Indigo) */
.sidebar-doctor .sidebar-link.active {
    background: #6366f1 !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4) !important;
}

.sidebar-doctor .sidebar-link.active i {
    color: #ffffff !important;
}

.sidebar-doctor .sidebar-link:hover:not(.active) {
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
}

/* Nurse Portal Overrides (Pink/Rose) */
.sidebar-nurse .sidebar-link.active {
    background: #ec4899 !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 12px rgba(236, 72, 153, 0.4) !important;
}

.sidebar-nurse .sidebar-link.active i {
    color: #ffffff !important;
}

.sidebar-nurse .sidebar-link:hover:not(.active) {
    background: rgba(236, 72, 153, 0.1);
    color: #ec4899;
}

/* Intelligence Portal Overrides (Indigo/Purple) */
.sidebar-intelligence .sidebar-link.active {
    background: #6366f1 !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4) !important;
}

.sidebar-intelligence .sidebar-link.active i {
    color: #ffffff !important;
}

.sidebar-intelligence .sidebar-link:hover:not(.active) {
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
}

/* Pharmacy Portal Overrides (Blue/Cyan) */
.sidebar-pharmacy .sidebar-link.active {
    background: #38bdf8 !important;
    color: #0f172a !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.4) !important;
}

.sidebar-pharmacy .sidebar-link.active i {
    color: #0f172a !important;
}

.sidebar-pharmacy .sidebar-link:hover:not(.active) {
    background: rgba(56, 189, 248, 0.1);
    color: #38bdf8;
}

/* Admin Portal Overrides (Emerald) */
.sidebar-admin .sidebar-link.active {
    background: #10b981 !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4) !important;
}

.sidebar-admin .sidebar-link.active i {
    color: #ffffff !important;
}

.sidebar-admin .sidebar-link:hover:not(.active) {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

/* Billing Portal Overrides (Rose/Red) */
.sidebar-billing .sidebar-link.active {
    background: #f43f5e !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.4) !important;
}

.sidebar-billing .sidebar-link.active i {
    color: #ffffff !important;
}

.sidebar-billing .sidebar-link:hover:not(.active) {
    background: rgba(244, 63, 94, 0.1);
    color: #f43f5e;
}

/* Reception Portal Overrides (Purple/Violet) */
.sidebar-reception .sidebar-link.active {
    background: #8b5cf6 !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4) !important;
}

.sidebar-reception .sidebar-link.active i {
    color: #ffffff !important;
}

.sidebar-reception .sidebar-link:hover:not(.active) {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

/* Lab Portal Overrides (Amber/Orange) */
.sidebar-lab .sidebar-link.active {
    background: #f59e0b !important;
    color: #0f172a !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4) !important;
}

.sidebar-lab .sidebar-link.active i {
    color: #0f172a !important;
}

.sidebar-lab .sidebar-link:hover:not(.active) {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

/* Inventory Portal Overrides (Silver/Teal) */
.sidebar-inventory .sidebar-link.active {
    background: #0d9488 !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.4) !important;
}

.sidebar-inventory .sidebar-link.active i {
    color: #ffffff !important;
}

.sidebar-inventory .sidebar-link:hover:not(.active) {
    background: rgba(13, 148, 136, 0.1);
    color: #0d9488;
}

/* Analytics Portal Overrides (Deep Navy / Neon Blue) */
.sidebar-analytics .sidebar-link.active {
    background: #38bdf8 !important;
    color: #0f172a !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.4) !important;
}

.sidebar-analytics .sidebar-link.active i {
    color: #0f172a !important;
}

.sidebar-analytics .sidebar-link:hover:not(.active) {
    background: rgba(56, 189, 248, 0.1);
    color: #38bdf8;
}

/* Card Styling */
.card-executive {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 1.25rem;
    box-shadow: var(--shadow-sm);
}

/* Dark Mode Specific Overrides for Contrast */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background-color: var(--bg-tertiary) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .form-label,
[data-theme="dark"] .form-check-label,
[data-theme="dark"] label {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .modal-content {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
}

[data-theme="dark"] .table {
    --bs-table-color: var(--text-primary);
    --bs-table-bg: transparent;
    --bs-table-border-color: var(--border-color);
}

/* Success/Warning Badges */
.badge-gold {
    background: rgba(11, 10, 8, 0.15);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Mobile responsiveness for main content */
@media (max-width: 992px) {
    .main-content {
        margin-left: 0;
        width: 100%;
    }
}

/* ========== ENHANCED VISIBILITY FOR BOTH THEMES ========== */

/* Sidebar Link Improvements */
.sidebar-link i {
    width: 20px;
    font-size: 1rem;
    opacity: 0.85;
}

.sidebar-link:hover i {
    opacity: 1;
}

/* Light Theme Specific Visibility Enhancements */
[data-theme="light"] .sidebar {
    background: #ffffff;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .sidebar-link {
    color: #475569;
}

[data-theme="light"] .sidebar-link:hover {
    background: #f1f5f9;
    color: #059669;
}

[data-theme="light"] .card,
[data-theme="light"] .card-custom {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .navbar-custom {
    background: rgba(255, 255, 255, 0.98) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .text-muted {
    color: #64748b !important;
}

[data-theme="light"] .badge {
    font-weight: 600;
}

/* Dark Theme Specific Visibility Enhancements */
[data-theme="dark"] .sidebar {
    background: #1e293b;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .sidebar-link {
    color: #cbd5e1;
}

[data-theme="dark"] .sidebar-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #10b981;
}

[data-theme="dark"] .card,
[data-theme="dark"] .card-custom {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .navbar-custom {
    background: rgba(15, 23, 42, 0.98) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .text-muted {
    color: #94a3b8 !important;
}

/* Enhanced Badge Visibility */
.badge-info,
.bg-info-subtle {
    background: rgba(6, 182, 212, 0.15) !important;
    color: #06b6d4 !important;
}

.badge-success,
.bg-success-subtle {
    background: rgba(34, 197, 94, 0.15) !important;
    color: #22c55e !important;
}

.badge-warning,
.bg-warning-subtle {
    background: rgba(245, 158, 11, 0.15) !important;
    color: #f59e0b !important;
}

.badge-danger,
.bg-danger-subtle {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #ef4444 !important;
}

.badge-purple,
.bg-purple-subtle {
    background: rgba(168, 85, 247, 0.15) !important;
    color: #a855f7 !important;
}

/* Improved Button Visibility */
.btn-outline-indigo {
    border-color: #6366f1;
    color: #6366f1;
}

.btn-outline-indigo:hover {
    background: #6366f1;
    color: white;
}

/* Section Headers */
.sidebar small.text-muted {
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    opacity: 0.7;
}

/* Table Row Hover */
[data-theme="light"] .table-hover tbody tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] .table-hover tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* end here =============== */

/* --- Premium Inventory Portal UI Styles --- */

[data-theme="dark"] .bg-inventory-dark {
    background-color: #0b1220 !important;
    /* Deep Navy from reference image */
}

[data-theme="light"] .bg-inventory-dark {
    background-color: var(--bg-primary) !important;
}

/* Glassmorphism Card System */
.glass-card {
    background: var(--bg-secondary);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 1.5rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(13, 148, 136, 0.3);
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

/* Premium Table System */
.table-premium {
    width: 100%;
    margin-bottom: 0;
    color: var(--text-primary);
    border-collapse: separate;
    border-spacing: 0 8px;
}

.table-premium thead th {
    background: var(--bg-tertiary) !important;
    border: none;
    font-size: 0.70rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 1.25rem 1rem;
    color: var(--text-muted);
}

.table-premium tbody tr {
    background: var(--bg-secondary);
    transition: all 0.3s ease;
    border-radius: 1rem;
}

.table-premium tbody tr:hover {
    background: var(--bg-hover) !important;
    transform: scale(1.005);
}

.table-premium tbody td {
    padding: 1.25rem 1rem;
    border: none;
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
}

.table-premium tbody td:first-child {
    border-left: 1px solid var(--border-light);
    border-top-left-radius: 1rem;
    border-bottom-left-radius: 1rem;
}

.table-premium tbody td:last-child {
    border-right: 1px solid var(--border-light);
    border-top-right-radius: 1rem;
    border-bottom-right-radius: 1rem;
}

/* Premium Buttons */
.btn-premium-teal {
    background: linear-gradient(135deg, #0d9488, #2dd4bf);
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(13, 148, 136, 0.3);
    transition: all 0.3s ease;
}

.btn-premium-teal:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(13, 148, 136, 0.5);
    color: white;
}

.smaller {
    font-size: 0.75rem;
}

.smaller-x {
    font-size: 0.65rem;
}

.ls-1 {
    letter-spacing: 0.05em;
}

/* Color Utilities */
.bg-teal-500 {
    background-color: #0d9488 !important;
}

.text-teal-400 {
    color: #2dd4bf !important;
}

.bg-blue-500 {
    background-color: #3b82f6 !important;
}

.text-blue-400 {
    color: #60a5fa !important;
}

.bg-orange-500 {
    background-color: #f59e0b !important;
}

.bg-indigo-500 {
    background-color: #6366f1 !important;
}

.text-indigo-400 {
    color: #818cf8 !important;
}

.bg-rose-500 {
    background-color: #f43f5e !important;
}

.text-rose-400 {
    color: #fb7185 !important;
}

.bg-emerald-500 {
    background-color: #10b981 !important;
}

.text-emerald-400 {
    color: #34d399 !important;
}

.bg-amber-500 {
    background-color: #f59e0b !important;
}

.text-amber-400 {
    color: #fbbf24 !important;
}

.bg-pink-500 {
    background-color: #ec4899 !important;
}

.text-pink-400 {
    color: #f472b6 !important;
}

.bg-purple-500 {
    background-color: #8b5cf6 !important;
}

.text-purple-400 {
    color: #a78bfa !important;
}

.bg-red-500 {
    background-color: #ef4444 !important;
}

.text-red-400 {
    color: #f87171 !important;
}

.bg-opacity-5 {
    --bs-bg-opacity: 0.05;
}

.bg-opacity-10 {
    --bs-bg-opacity: 0.1;
    background-color: rgba(var(--bs-emphasis-color-rgb), 0.1) !important;
}

/* Custom opacity since Bootstrap might override */
.bg-opacity-10 {
    background-color: var(--bs-bg-opacity-10, rgba(128, 128, 128, 0.1)) !important;
}

/* Re-defining opacity more reliably */
.bg-opacity-10 {
    opacity: 1;
    /* reset */
}

.bg-indigo-500.bg-opacity-10 {
    background-color: rgba(99, 102, 241, 0.1) !important;
}

.bg-rose-500.bg-opacity-10 {
    background-color: rgba(244, 63, 94, 0.1) !important;
}

.bg-emerald-500.bg-opacity-10 {
    background-color: rgba(16, 185, 129, 0.1) !important;
}

.bg-amber-500.bg-opacity-10 {
    background-color: rgba(245, 158, 11, 0.1) !important;
}

.bg-pink-500.bg-opacity-10 {
    background-color: rgba(236, 72, 153, 0.1) !important;
}

.bg-purple-500.bg-opacity-10 {
    background-color: rgba(139, 92, 246, 0.1) !important;
}

.bg-red-500.bg-opacity-10 {
    background-color: rgba(239, 68, 68, 0.1) !important;
}

.bg-teal-500.bg-opacity-10 {
    background-color: rgba(13, 148, 136, 0.1) !important;
}

.bg-blue-500.bg-opacity-10 {
    background-color: rgba(59, 130, 246, 0.1) !important;
}

.bg-orange-500.bg-opacity-10 {
    background-color: rgba(245, 158, 11, 0.1) !important;
}

/* --- Responsive Hub Headers --- */

.inventory-header,
.intel-header,
.analytics-header,
.reception-header,
.lab-header,
.doctor-header,
.admin-header,
.owner-header,
.patient-header {
    border-radius: 1.5rem;
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
    color: #f8fafc;
}

[data-theme="dark"] .inventory-header {
    background: linear-gradient(135deg, #134e4a 0%, #0f172a 100%);
    border: 1px solid rgba(20, 184, 166, 0.2);
}

[data-theme="light"] .inventory-header {
    background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
}

[data-theme="dark"] .intel-header {
    background: linear-gradient(135deg, #312e81 0%, #0f172a 100%);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

[data-theme="light"] .intel-header {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
}

[data-theme="dark"] .analytics-header {
    background: linear-gradient(135deg, #0c4a6e 0%, #0f172a 100%);
    border: 1px solid rgba(14, 165, 233, 0.2);
}

[data-theme="light"] .analytics-header {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
}

/* Reception Header */
[data-theme="dark"] .reception-header {
    background: linear-gradient(135deg, #4c1d95 0%, #0f172a 100%);
    border: 1px solid rgba(139, 92, 246, 0.2);
}

[data-theme="light"] .reception-header {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

/* Lab Header */
[data-theme="dark"] .lab-header {
    background: linear-gradient(135deg, #065f46 0%, #0f172a 100%);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

[data-theme="light"] .lab-header {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

/* Doctor Header */
[data-theme="dark"] .doctor-header {
    background: linear-gradient(135deg, #1e3a8a 0%, #0f172a 100%);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

[data-theme="light"] .doctor-header {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

/* Admin Header */
[data-theme="dark"] .admin-header {
    background: linear-gradient(135deg, #111827 0%, #374151 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .admin-header {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
}

/* Owner Header */
[data-theme="dark"] .owner-header {
    background: linear-gradient(135deg, #78350f 0%, #0f172a 100%);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

[data-theme="light"] .owner-header {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

/* Patient Header */
[data-theme="dark"] .patient-header {
    background: linear-gradient(135deg, #134e4a 0%, #0f172a 100%);
    border: 1px solid rgba(20, 184, 166, 0.2);
}

[data-theme="light"] .patient-header {
    background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%);
}

.inventory-header::after,
.intel-header::after,
.analytics-header::after,
.reception-header::after,
.lab-header::after,
.doctor-header::after,
.admin-header::after,
.owner-header::after,
.patient-header::after {
    content: '';
    position: absolute;
    top: -20%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    border-radius: 50%;
}

/* Billing Portal Specifics */
.billing-header {
    background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
    color: white;
    border-radius: 1.5rem;
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px -10px rgba(244, 63, 94, 0.3);
    position: relative;
    overflow: hidden;
}

[data-theme="dark"] .billing-header {
    background: linear-gradient(135deg, #881337 0%, #0f172a 100%);
    border: 1px solid rgba(244, 63, 94, 0.2);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

.billing-header::after {
    content: '';
    position: absolute;
    top: -20%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, transparent 70%);
    border-radius: 50%;
}



/* Pharmacy Portal Specifics */
.pharmacy-header {
    background: linear-gradient(135deg, #38bdf8 0%, #0ea5e9 100%);
    color: white;
    border-radius: 1.5rem;
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px -10px rgba(56, 189, 248, 0.3);
    position: relative;
    overflow: hidden;
}

[data-theme="dark"] .pharmacy-header {
    background: linear-gradient(135deg, #075985 0%, #0f172a 100%);
    border: 1px solid rgba(56, 189, 248, 0.2);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

.pharmacy-header::after {
    content: '';
    position: absolute;
    top: -20%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, transparent 70%);
    border-radius: 50%;
}


/* Nurse Portal Specifics */
.nurse-header {
    background: linear-gradient(135deg, #ec4899 0%, #d946ef 100%);
    color: white;
    border-radius: 1.5rem;
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px -10px rgba(236, 72, 153, 0.3);
    position: relative;
    overflow: hidden;
}

[data-theme="dark"] .nurse-header {
    background: linear-gradient(135deg, #831843 0%, #0f172a 100%);
    border: 1px solid rgba(236, 72, 153, 0.2);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

.nurse-header::after {
    content: '';
    position: absolute;
    top: -20%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, transparent 70%);
    border-radius: 50%;
}






.text-theme {
    color: var(--text-primary) !important;
}

.text-theme-muted {
    color: var(--text-muted) !important;
}

.bg-secondary-theme {
    background-color: var(--bg-secondary) !important;
}

.bg-tertiary-theme {
    background-color: var(--bg-tertiary) !important;
}

.border-color-theme {
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .bg-white {
    background-color: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .bg-light {
    background-color: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .btn-light {
    color: var(--text-inverse) !important;
}

.lab-order-card {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
}

/* Form Elements Theme Support */
[data-theme="light"] .form-select,
[data-theme="light"] .form-control {
    background-color: #ffffff;
    border-color: #e2e8f0;
    color: #0f172a;
}

[data-theme="dark"] .form-select,
[data-theme="dark"] .form-control {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: #f8fafc;
}

.text-orange-400 {
    color: #fbbf24 !important;
}

.bg-amber-500 {
    background-color: #f59e0b !important;
}

.text-amber-400 {
    color: #fbbf24 !important;
}

.bg-pink-500 {
    background-color: #ec4899 !important;
}

.text-pink-400 {
    color: #f472b6 !important;
}

.text-pink-500 {
    color: #ec4899 !important;
}

.text-pink-600 {
    color: #db2777 !important;
}

.bg-red-500 {
    background-color: #ef4444 !important;
}

.text-red-400 {
    color: #f87171 !important;
}

.bg-indigo-500 {
    background-color: #6366f1 !important;
}

.text-indigo-400 {
    color: #818cf8 !important;
}

.bg-purple-500 {
    background-color: #8b5cf6 !important;
}

.text-purple-400 {
    color: #a78bfa !important;
}

.ls-1 {
    letter-spacing: 0.05em;
}


.btn-pink-theme {
    background: #ec4899;
    color: white;
}

.btn-pink-theme:hover {
    background: #db2777;
    color: white;
}

.btn-outline-pink {
    color: #ec4899;
    border-color: rgba(236, 72, 153, 0.4);
}

.btn-outline-pink:hover {
    background: #ec4899;
    color: white;
}


/* Global Dashboard Components */
.metric-card,
.glass-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 1.5rem;
    padding: 1.75rem;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: var(--shadow-sm);
    height: 100%;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.metric-card:hover,
.glass-card:hover {
    transform: translateY(-8px);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-lg), 0 15px 30px -10px rgba(0, 0, 0, 0.3);
    background: var(--bg-tertiary);
}

[data-theme="dark"] .metric-card:hover,
[data-theme="dark"] .glass-card:hover {
    background: linear-gradient(180deg, var(--bg-secondary) 0%, rgba(255, 255, 255, 0.02) 100%);
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary-color);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.metric-card:hover::before {
    opacity: 1;
}

.metric-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary-color);
    margin-bottom: 1.25rem;
}

.hub-link {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 1.25rem;
    padding: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    display: block;
    height: 100%;
}

.hub-link:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
    background: var(--bg-tertiary);
    box-shadow: var(--shadow-md);
}

.insight-value {
    font-family: 'Outfit';
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

/* end here =============== */

/* ========== LIGHT THEME OVERRIDES FOR BOOTSTRAP DARK CLASSES ========== */
/* These overrides make admin pages (like workers.html) adapt to light theme */

/* Override Bootstrap bg-secondary in light theme */
[data-theme="light"] .bg-secondary {
    background-color: #f1f5f9 !important;
}

/* Override Bootstrap bg-dark in light theme */
[data-theme="light"] .bg-dark {
    background-color: #e2e8f0 !important;
}

/* Override text-white in light theme for input elements */
[data-theme="light"] .form-control.text-white,
[data-theme="light"] .form-select.text-white,
[data-theme="light"] .input-group-text.text-muted {
    color: #0f172a !important;
}

[data-theme="light"] .form-control.bg-secondary,
[data-theme="light"] .form-select.bg-secondary {
    background-color: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    color: #0f172a !important;
}

[data-theme="light"] .input-group-text.bg-secondary {
    background-color: #f8fafc !important;
    color: #64748b !important;
}

/* Table Dark Override for Light Theme */
[data-theme="light"] .table-dark {
    --bs-table-bg: transparent !important;
    --bs-table-color: #0f172a !important;
    --bs-table-border-color: #e2e8f0 !important;
    --bs-table-striped-bg: rgba(0, 0, 0, 0.02) !important;
    --bs-table-striped-color: #0f172a !important;
    --bs-table-hover-bg: #f8fafc !important;
    --bs-table-hover-color: #0f172a !important;
    background-color: transparent !important;
    color: #0f172a !important;
}

[data-theme="light"] .table-dark th,
[data-theme="light"] .table-dark td {
    color: #0f172a !important;
    border-color: #e2e8f0 !important;
}

[data-theme="light"] .table-dark thead {
    background-color: #f8fafc !important;
}

/* Pagination Light Theme Override */
[data-theme="light"] .page-link.bg-dark {
    background-color: #ffffff !important;
    color: #0f172a !important;
    border-color: #e2e8f0 !important;
}

[data-theme="light"] .page-link.bg-dark:hover {
    background-color: #f1f5f9 !important;
    color: #0f172a !important;
}

[data-theme="light"] .page-item.active .page-link.bg-dark {
    background-color: #f59e0b !important;
    color: #ffffff !important;
    border-color: #f59e0b !important;
}

[data-theme="light"] .page-link.text-white {
    color: #0f172a !important;
}

[data-theme="light"] .page-link.border-secondary {
    border-color: #e2e8f0 !important;
}

/* Modal Light Theme Override */
[data-theme="light"] .modal-content {
    background-color: #ffffff !important;
    color: #0f172a !important;
}

[data-theme="light"] .modal-content .form-control,
[data-theme="light"] .modal-content .form-select {
    background-color: #ffffff !important;
    border-color: #e2e8f0 !important;
    color: #0f172a !important;
}

[data-theme="light"] .modal-content .form-label {
    color: #334155 !important;
}

[data-theme="light"] .modal-content .btn-close-white {
    filter: invert(1) grayscale(100%) brightness(0);
}

/* Plan Usage Card Light Theme */
[data-theme="light"] .card .text-white {
    color: #0f172a !important;
}

/* Input Group Text Override */
[data-theme="light"] .input-group-text {
    background-color: #f8fafc !important;
    color: #64748b !important;
    border-color: #e2e8f0 !important;
}

/* ========== COLLAPSIBLE SIDEBAR STYLES ========== */
/* Premium accordion-style sidebar with smooth animations */

.sidebar-section {
    margin-bottom: 0.5rem;
}

.sidebar-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.75rem;
    margin: 0.25rem 0;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.sidebar-section-header:hover {
    background: var(--bg-hover);
}

.sidebar-section-header .section-title {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin: 0;
    transition: color 0.2s ease;
}

.sidebar-section-header:hover .section-title {
    color: var(--text-primary);
}

.sidebar-section-header .section-chevron {
    font-size: 0.65rem;
    color: var(--text-muted);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s ease;
}

.sidebar-section-header:hover .section-chevron {
    color: var(--primary-color);
}

.sidebar-section-header[aria-expanded="true"] .section-chevron {
    transform: rotate(90deg);
}

.sidebar-section-header[aria-expanded="false"] .section-chevron {
    transform: rotate(0deg);
}

/* Fallback: rotate chevron when sibling content has show class */
.sidebar-section-header:has(+ .sidebar-section-content.show) .section-chevron {
    transform: rotate(90deg);
}

/* Collapsible content smooth animation */
.sidebar-section-content {
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
}

.sidebar-section-content.collapsing {
    transition: height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Links inside sections - slightly indented */
.sidebar-section-content .sidebar-link {
    padding-left: 1.25rem;
    font-size: 0.85rem;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

/* Active section header highlight */
.sidebar-section.has-active .sidebar-section-header .section-title {
    color: var(--primary-color);
}

/* Light theme adjustments */
[data-theme="light"] .sidebar-section-header:hover {
    background: #f1f5f9;
}

[data-theme="light"] .sidebar-section-header .section-title {
    color: #64748b;
}

[data-theme="light"] .sidebar-section-header:hover .section-title {
    color: #0f172a;
}

/* Glow effect on active section (dark theme only) */
[data-theme="dark"] .sidebar-section.has-active .sidebar-section-header {
    background: rgba(16, 185, 129, 0.05);
    border-left: 2px solid var(--primary-color);
}

/* Badge count for sections (optional future use) */
.sidebar-section-header .section-badge {
    font-size: 0.6rem;
    padding: 0.15rem 0.4rem;
    border-radius: 9999px;
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}