/* CSS Theme Isolation for Admin and Client Portal */

/* Admin Portal Theme Scoping */
.admin-portal-theme.admin-theme-dark {
    --bs-primary: #4f46e5;
    --bs-secondary: #64748b;
    --bs-success: #059669;
    --bs-info: #0ea5e9;
    --bs-warning: #d97706;
    --bs-danger: #dc2626;
    --bs-light: #f1f5f9;
    --bs-dark: #1e293b;
    --bs-body-color: #e2e8f0;
    --bs-body-bg: #0f172a;
    --bs-emphasis-color: #f8fafc;
    --bs-secondary-color: rgba(226, 232, 240, 0.75);
    --bs-tertiary-color: rgba(226, 232, 240, 0.5);
    --bs-border-color: #334155;
    --bs-border-color-translucent: rgba(148, 163, 184, 0.2);
}

/* Enhanced text visibility for dark theme */
.admin-portal-theme.admin-theme-dark {
    background-color: #0f172a;
    color: #e2e8f0;
}

/* Navigation menu text visibility for all admin themes */
.admin-portal-theme .navbar-nav .nav-link,
.admin-portal-theme .navbar-brand,
.admin-portal-theme .navbar-text {
    color: #ffffff !important;
}

.admin-portal-theme .navbar-nav .nav-link:hover,
.admin-portal-theme .navbar-nav .nav-link:focus {
    color: #f0f9ff !important;
}

.admin-portal-theme .dropdown-menu {
    background-color: #ffffff !important;
    border: 1px solid #e5e7eb !important;
}

.admin-portal-theme .dropdown-menu .dropdown-item {
    color: #1f2937 !important;
    background-color: transparent !important;
}

.admin-portal-theme .dropdown-menu .dropdown-item:hover,
.admin-portal-theme .dropdown-menu .dropdown-item:focus {
    background-color: var(--bs-primary) !important;
    color: #ffffff !important;
}

/* Specific targeting for Bootstrap dropdown items */
.admin-portal-theme .nav-item .dropdown-menu .dropdown-item,
.admin-portal-theme .navbar-nav .dropdown-menu .dropdown-item {
    color: #1f2937 !important;
    padding: 0.5rem 1rem !important;
    display: block !important;
    width: 100% !important;
    clear: both !important;
    font-weight: 400 !important;
    text-align: inherit !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    background-color: transparent !important;
    border: 0 !important;
}

.admin-portal-theme.admin-theme-dark .container,
.admin-portal-theme.admin-theme-dark .container-fluid,
.admin-portal-theme.admin-theme-dark main {
    background-color: #0f172a;
    color: #e2e8f0;
}

.admin-portal-theme.admin-theme-dark .table,
.admin-portal-theme.admin-theme-dark .table td,
.admin-portal-theme.admin-theme-dark .table th {
    background-color: #1e293b !important;
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}

.admin-portal-theme.admin-theme-dark .card,
.admin-portal-theme.admin-theme-dark .card-body {
    background-color: #1e293b !important;
    color: #e2e8f0 !important;
}

.admin-portal-theme.admin-theme-dark .text-dark,
.admin-portal-theme.admin-theme-dark .text-muted {
    color: #94a3b8 !important;
}

.admin-portal-theme.admin-theme-dark .bg-white {
    background-color: #1e293b !important;
    color: #e2e8f0 !important;
}

.admin-portal-theme.admin-theme-light {
    --bs-primary: #4f46e5;
    --bs-secondary: #64748b;
    --bs-success: #059669;
    --bs-info: #0ea5e9;
    --bs-warning: #d97706;
    --bs-danger: #dc2626;
    --bs-light: #f8fafc;
    --bs-dark: #1e293b;
    --bs-body-color: #1e293b;
    --bs-body-bg: #ffffff;
    --bs-emphasis-color: #0f172a;
    --bs-secondary-color: rgba(30, 41, 59, 0.75);
    --bs-tertiary-color: rgba(30, 41, 59, 0.5);
    --bs-border-color: #e2e8f0;
    --bs-border-color-translucent: rgba(100, 116, 139, 0.175);
    background-color: #ffffff;
    color: #1e293b;
}

/* Enhanced text visibility for light theme */
.admin-portal-theme.admin-theme-light .container,
.admin-portal-theme.admin-theme-light .container-fluid,
.admin-portal-theme.admin-theme-light main {
    background-color: #ffffff;
    color: #1e293b;
}

.admin-portal-theme.admin-theme-light .table,
.admin-portal-theme.admin-theme-light .table td,
.admin-portal-theme.admin-theme-light .table th {
    background-color: #ffffff !important;
    color: #1e293b !important;
    border-color: #e2e8f0 !important;
}

.admin-portal-theme.admin-theme-light .card,
.admin-portal-theme.admin-theme-light .card-body {
    background-color: #ffffff !important;
    color: #1e293b !important;
}

/* Add admin theme variations with proper contrast */
.admin-portal-theme.admin-theme-blue {
    --bs-primary: #3b82f6;
    --bs-secondary: #64748b;
    --bs-success: #059669;
    --bs-info: #0ea5e9;
    --bs-warning: #d97706;
    --bs-danger: #dc2626;
    --bs-light: #dbeafe;
    --bs-dark: #1e3a8a;
    --bs-body-color: #dbeafe;
    --bs-body-bg: #1e40af;
    background-color: #1e40af;
    color: #dbeafe;
}

.admin-portal-theme.admin-theme-blue .container,
.admin-portal-theme.admin-theme-blue .container-fluid,
.admin-portal-theme.admin-theme-blue main,
.admin-portal-theme.admin-theme-blue .table,
.admin-portal-theme.admin-theme-blue .table td,
.admin-portal-theme.admin-theme-blue .table th {
    background-color: #1e3a8a !important;
    color: #dbeafe !important;
    border-color: #3b82f6 !important;
}

.admin-portal-theme.admin-theme-green {
    --bs-primary: #10b981;
    --bs-secondary: #6b7280;
    --bs-success: #059669;
    --bs-info: #0ea5e9;
    --bs-warning: #d97706;
    --bs-danger: #dc2626;
    --bs-light: #d1fae5;
    --bs-dark: #064e3b;
    --bs-body-color: #d1fae5;
    --bs-body-bg: #065f46;
    background-color: #065f46;
    color: #d1fae5;
}

.admin-portal-theme.admin-theme-green .container,
.admin-portal-theme.admin-theme-green .container-fluid,
.admin-portal-theme.admin-theme-green main,
.admin-portal-theme.admin-theme-green .table,
.admin-portal-theme.admin-theme-green .table td,
.admin-portal-theme.admin-theme-green .table th {
    background-color: #064e3b !important;
    color: #d1fae5 !important;
    border-color: #10b981 !important;
}

.admin-portal-theme.admin-theme-purple {
    --bs-primary: #8b5cf6;
    --bs-secondary: #a855f7;
    --bs-success: #10b981;
    --bs-info: #06b6d4;
    --bs-warning: #d97706;
    --bs-danger: #dc2626;
    --bs-light: #ddd6fe;
    --bs-dark: #581c87;
    --bs-body-color: #ddd6fe;
    --bs-body-bg: #2e1065;
    background-color: #2e1065;
    color: #ddd6fe;
}

.admin-portal-theme.admin-theme-purple .container,
.admin-portal-theme.admin-theme-purple .container-fluid,
.admin-portal-theme.admin-theme-purple main,
.admin-portal-theme.admin-theme-purple .table,
.admin-portal-theme.admin-theme-purple .table td,
.admin-portal-theme.admin-theme-purple .table th {
    background-color: #581c87 !important;
    color: #ddd6fe !important;
    border-color: #8b5cf6 !important;
}

/* Client Portal Theme Scoping */
.client-portal-theme.client-theme-dark {
    --bs-primary: #7c3aed;
    --bs-secondary: #6b7280;
    --bs-success: #10b981;
    --bs-info: #0ea5e9;
    --bs-warning: #f59e0b;
    --bs-danger: #ef4444;
    --bs-light: #f3f4f6;
    --bs-dark: #1f2937;
    --bs-body-color: #e5e7eb;
    --bs-body-bg: #1f2937;
    --bs-emphasis-color: #fff;
    --bs-secondary-color: rgba(229, 231, 235, 0.75);
    --bs-tertiary-color: rgba(229, 231, 235, 0.5);
    --bs-border-color: #374151;
    --bs-border-color-translucent: rgba(255, 255, 255, 0.15);
}

/* Navigation menu text visibility for client portal themes */
.client-portal-theme .navbar-nav .nav-link,
.client-portal-theme .navbar-brand,
.client-portal-theme .navbar-text {
    color: #ffffff !important;
}

.client-portal-theme .navbar-nav .nav-link:hover,
.client-portal-theme .navbar-nav .nav-link:focus {
    color: #f0f9ff !important;
}

.client-portal-theme .dropdown-menu {
    background-color: #ffffff !important;
    border: 1px solid #e5e7eb !important;
}

.client-portal-theme .dropdown-menu .dropdown-item {
    color: #1f2937 !important;
    background-color: transparent !important;
}

.client-portal-theme .dropdown-menu .dropdown-item:hover,
.client-portal-theme .dropdown-menu .dropdown-item:focus {
    background-color: var(--bs-primary) !important;
    color: #ffffff !important;
}

/* Specific targeting for Bootstrap dropdown items in client portal */
.client-portal-theme .nav-item .dropdown-menu .dropdown-item,
.client-portal-theme .navbar-nav .dropdown-menu .dropdown-item {
    color: #1f2937 !important;
    padding: 0.5rem 1rem !important;
    display: block !important;
    width: 100% !important;
    clear: both !important;
    font-weight: 400 !important;
    text-align: inherit !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    background-color: transparent !important;
    border: 0 !important;
}

/* Enhanced text visibility for client portal dark theme */
.client-portal-theme.client-theme-dark {
    background-color: #1f2937;
    color: #e5e7eb;
}

.client-portal-theme.client-theme-dark .container,
.client-portal-theme.client-theme-dark .container-fluid,
.client-portal-theme.client-theme-dark main {
    background-color: #1f2937;
    color: #e5e7eb;
}

.client-portal-theme.client-theme-dark .table,
.client-portal-theme.client-theme-dark .table td,
.client-portal-theme.client-theme-dark .table th {
    background-color: #374151 !important;
    color: #e5e7eb !important;
    border-color: #4b5563 !important;
}

.client-portal-theme.client-theme-dark .card,
.client-portal-theme.client-theme-dark .card-body {
    background-color: #374151 !important;
    color: #e5e7eb !important;
}

.client-portal-theme.client-theme-dark .text-dark,
.client-portal-theme.client-theme-dark .text-muted {
    color: #e5e7eb !important;
}

.client-portal-theme.client-theme-light {
    --bs-primary: #7c3aed;
    --bs-secondary: #6b7280;
    --bs-success: #10b981;
    --bs-info: #0ea5e9;
    --bs-warning: #f59e0b;
    --bs-danger: #ef4444;
    --bs-light: #f9fafb;
    --bs-dark: #111827;
    --bs-body-color: #111827;
    --bs-body-bg: #fff;
    --bs-emphasis-color: #000;
    --bs-secondary-color: rgba(17, 24, 39, 0.75);
    --bs-tertiary-color: rgba(17, 24, 39, 0.5);
    --bs-border-color: #e5e7eb;
    --bs-border-color-translucent: rgba(0, 0, 0, 0.175);
}

.client-portal-theme.client-theme-purple {
    --bs-primary: #8b5cf6;
    --bs-secondary: #a855f7;
    --bs-success: #10b981;
    --bs-info: #06b6d4;
    --bs-warning: #f59e0b;
    --bs-danger: #ef4444;
    --bs-light: #faf5ff;
    --bs-dark: #581c87;
    --bs-body-color: #ddd6fe;
    --bs-body-bg: #2e1065;
    --bs-emphasis-color: #fff;
    --bs-secondary-color: rgba(221, 214, 254, 0.75);
    --bs-tertiary-color: rgba(221, 214, 254, 0.5);
    --bs-border-color: #7c3aed;
    --bs-border-color-translucent: rgba(139, 92, 246, 0.25);
}

.client-portal-theme.client-theme-blue {
    --bs-primary: #3b82f6;
    --bs-secondary: #64748b;
    --bs-success: #10b981;
    --bs-info: #0ea5e9;
    --bs-warning: #f59e0b;
    --bs-danger: #ef4444;
    --bs-light: #eff6ff;
    --bs-dark: #1e3a8a;
    --bs-body-color: #dbeafe;
    --bs-body-bg: #1e40af;
    --bs-emphasis-color: #fff;
    --bs-secondary-color: rgba(219, 234, 254, 0.75);
    --bs-tertiary-color: rgba(219, 234, 254, 0.5);
    --bs-border-color: #3b82f6;
    --bs-border-color-translucent: rgba(59, 130, 246, 0.25);
}

.client-portal-theme.client-theme-green {
    --bs-primary: #10b981;
    --bs-secondary: #6b7280;
    --bs-success: #059669;
    --bs-info: #0ea5e9;
    --bs-warning: #f59e0b;
    --bs-danger: #ef4444;
    --bs-light: #ecfdf5;
    --bs-dark: #064e3b;
    --bs-body-color: #d1fae5;
    --bs-body-bg: #065f46;
    --bs-emphasis-color: #fff;
    --bs-secondary-color: rgba(209, 250, 229, 0.75);
    --bs-tertiary-color: rgba(209, 250, 229, 0.5);
    --bs-border-color: #10b981;
    --bs-border-color-translucent: rgba(16, 185, 129, 0.25);
}

/* Enhanced text visibility for client portal light theme */
.client-portal-theme.client-theme-light {
    background-color: #ffffff;
    color: #1f2937;
}

.client-portal-theme.client-theme-light .container,
.client-portal-theme.client-theme-light .container-fluid,
.client-portal-theme.client-theme-light main {
    background-color: #ffffff;
    color: #1f2937;
}

.client-portal-theme.client-theme-light .table,
.client-portal-theme.client-theme-light .table td,
.client-portal-theme.client-theme-light .table th {
    background-color: #ffffff !important;
    color: #1f2937 !important;
    border-color: #e5e7eb !important;
}

.client-portal-theme.client-theme-light .card,
.client-portal-theme.client-theme-light .card-body {
    background-color: #ffffff !important;
    color: #1f2937 !important;
}

/* Enhanced visibility for colored client portal themes */
.client-portal-theme.client-theme-purple .container,
.client-portal-theme.client-theme-purple .container-fluid,
.client-portal-theme.client-theme-purple main {
    background-color: #2e1065;
    color: #ddd6fe;
}

.client-portal-theme.client-theme-blue .container,
.client-portal-theme.client-theme-blue .container-fluid,
.client-portal-theme.client-theme-blue main {
    background-color: #1e40af;
    color: #dbeafe;
}

.client-portal-theme.client-theme-green .container,
.client-portal-theme.client-theme-green .container-fluid,
.client-portal-theme.client-theme-green main {
    background-color: #065f46;
    color: #d1fae5;
}

/* Apply themes globally within their scoped containers */
.admin-portal-theme body {
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
}

.client-portal-theme body {
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
}

/* Ensure navbar and components inherit scoped variables */
.admin-portal-theme .navbar {
    background-color: var(--bs-dark) !important;
    border-bottom: 1px solid var(--bs-border-color);
}

.admin-portal-theme .navbar-brand,
.admin-portal-theme .navbar-nav .nav-link {
    color: var(--bs-body-color) !important;
}

.admin-portal-theme .navbar-nav .nav-link:hover {
    color: var(--bs-primary) !important;
}

.admin-portal-theme .dropdown-menu {
    background-color: var(--bs-dark);
    border: 1px solid var(--bs-border-color);
}

.admin-portal-theme .dropdown-item {
    color: var(--bs-body-color);
}

.admin-portal-theme .dropdown-item:hover {
    background-color: var(--bs-primary);
    color: white;
}

.client-portal-theme .navbar {
    background-color: var(--bs-primary) !important;
}

/* Cards and components styling */
.admin-portal-theme .card {
    --bs-card-bg: var(--bs-body-bg);
    --bs-card-border-color: var(--bs-border-color);
}

.client-portal-theme .card {
    --bs-card-bg: var(--bs-body-bg);
    --bs-card-border-color: var(--bs-border-color);
}

/* Button theming */
.admin-portal-theme .btn-primary {
    --bs-btn-bg: var(--bs-primary);
    --bs-btn-border-color: var(--bs-primary);
}

.client-portal-theme .btn-primary {
    --bs-btn-bg: var(--bs-primary);
    --bs-btn-border-color: var(--bs-primary);
}

/* Table theming */
.admin-portal-theme .table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--bs-body-color);
    --bs-table-border-color: var(--bs-border-color);
}

.client-portal-theme .table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--bs-body-color);
    --bs-table-border-color: var(--bs-border-color);
}

/* Form controls */
.admin-portal-theme .form-control {
    background-color: var(--bs-body-bg);
    border-color: var(--bs-border-color);
    color: var(--bs-body-color);
}

.client-portal-theme .form-control {
    background-color: var(--bs-body-bg);
    border-color: var(--bs-border-color);
    color: var(--bs-body-color);
}

/* Form controls focus state */
.admin-portal-theme .form-control:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.25rem rgba(79, 70, 229, 0.25);
}

.client-portal-theme .form-control:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary), 0.25);
}

/* Admin sidebar styling */
.admin-portal-theme .sidebar {
    background-color: var(--bs-dark);
    border-right: 1px solid var(--bs-border-color);
}

.admin-portal-theme .sidebar .nav-link {
    color: var(--bs-secondary-color);
    border-radius: 0.375rem;
    margin: 0.125rem 0;
    padding: 0.75rem 1rem;
    transition: all 0.15s ease-in-out;
}

.admin-portal-theme .sidebar .nav-link:hover {
    background-color: rgba(79, 70, 229, 0.1);
    color: var(--bs-primary);
}

.admin-portal-theme .sidebar .nav-link.active {
    background-color: var(--bs-primary);
    color: white;
}

.admin-portal-theme .sidebar .nav-link i {
    width: 1.25rem;
    text-align: center;
    margin-right: 0.5rem;
}

/* Admin table styling improvements */
.admin-portal-theme .table-hover tbody tr:hover {
    background-color: rgba(79, 70, 229, 0.05);
}

.admin-portal-theme .table th {
    background-color: var(--bs-dark);
    color: var(--bs-body-color);
    border-color: var(--bs-border-color);
    font-weight: 600;
}

/* Admin alert styling */
.admin-portal-theme .alert-primary {
    background-color: rgba(79, 70, 229, 0.1);
    border-color: rgba(79, 70, 229, 0.2);
    color: var(--bs-primary);
}

.admin-portal-theme .alert-success {
    background-color: rgba(5, 150, 105, 0.1);
    border-color: rgba(5, 150, 105, 0.2);
    color: var(--bs-success);
}

.admin-portal-theme .alert-danger {
    background-color: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.2);
    color: var(--bs-danger);
}

.admin-portal-theme .alert-warning {
    background-color: rgba(217, 119, 6, 0.1);
    border-color: rgba(217, 119, 6, 0.2);
    color: var(--bs-warning);
}