:root {
    --primary-color: #351F65; /* Luma Navy */
    --secondary-color: #00B5E2; /* Luma Teal */
    --accent-color: #F7971E; /* Spark Orange */
    --success-color: #00D09C; /* Luma Green */
    --warning-color: #FFC107;
    --danger-color: #FF5A5F;
    --background-color: #F4F7FA;
    --card-bg: rgba(255, 255, 255, 0.7); /* Translucent white */
    --card-border: rgba(255, 255, 255, 0.4);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
    --text-primary: #1A202C;
    --text-secondary: #5a6a85;
    --border-color: rgba(226, 232, 240, 0.6);
    --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.025);
    --blur-amount: 12px;
    
    /* Typography weights and spacing for Plus Jakarta Sans */
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --font-weight-extrabold: 800;
    --letter-spacing-tight: -0.02em;
    --letter-spacing-normal: 0;
    --letter-spacing-wide: 0.025em;
}

body {
    font-family: var(--font-family);
    background: linear-gradient(135deg, #f6f8fd 0%, #f1f4f9 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
    overflow-x: hidden;
    font-weight: var(--font-weight-normal);
    letter-spacing: var(--letter-spacing-normal);
}

/* Background decorations for glassmorphism depth */
body::before, body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    opacity: 0.6;
}

body::before {
    width: 400px;
    height: 400px;
    background: rgba(0, 181, 226, 0.15); /* Secondary color */
    top: -100px;
    left: -100px;
}

body::after {
    width: 500px;
    height: 500px;
    background: rgba(53, 31, 101, 0.1); /* Primary color */
    bottom: -100px;
    right: -100px;
}

/* Navbar - Admin View */
.navbar {
    background-color: var(--primary-color) !important; /* Luma Navy - Dark header */
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 0;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    color: white;
}

.navbar-brand {
    font-size: 1.25rem;
    color: white !important;
    font-weight: var(--font-weight-extrabold);
    letter-spacing: var(--letter-spacing-tight);
}

.nav-link {
    color: rgba(255, 255, 255, 0.8) !important;
    font-weight: var(--font-weight-medium);
    letter-spacing: var(--letter-spacing-normal);
    transition: all 0.2s ease;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
}
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.nav-link:hover {
    color: white !important;
    background-color: rgba(255, 255, 255, 0.1);
}

.nav-link.active {
    color: white !important;
    font-weight: 600;
    background-color: rgba(255, 255, 255, 0.15);
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
    color: var(--primary-color);
    font-weight: var(--font-weight-bold);
    letter-spacing: var(--letter-spacing-tight);
    line-height: 1.2;
}

h1 {
    font-weight: var(--font-weight-extrabold);
    font-size: 2.25rem;
    letter-spacing: -0.03em;
}

h2 {
    font-weight: var(--font-weight-bold);
    font-size: 1.875rem;
}

h3 {
    font-weight: var(--font-weight-semibold);
    font-size: 1.5rem;
}

h4 {
    font-weight: var(--font-weight-semibold);
    font-size: 1.25rem;
}

h5 {
    font-weight: var(--font-weight-semibold);
    font-size: 1.125rem;
}

h6 {
    font-weight: var(--font-weight-medium);
    font-size: 1rem;
}

h1 {
    font-size: 1.875rem;
    margin-bottom: 0;
}

/* Buttons */
.btn {
    font-weight: var(--font-weight-semibold);
    padding: 0.5rem 1rem;
    border-radius: 0.75rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    border: none;
    backdrop-filter: blur(4px);
    letter-spacing: var(--letter-spacing-normal);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #4c2d91);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-primary:hover, .btn-primary:active, .btn-primary:focus {
    background: linear-gradient(135deg, #2a1852, var(--primary-color));
    box-shadow: 0 4px 12px rgba(53, 31, 101, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color), #00a87d);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-success:hover {
    background: linear-gradient(135deg, #00b386, var(--success-color));
    box-shadow: 0 4px 12px rgba(0, 208, 156, 0.3);
}

.btn-info {
    background: linear-gradient(135deg, var(--secondary-color), #009ec5);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-info:hover {
    background: linear-gradient(135deg, #009ec5, var(--secondary-color));
    box-shadow: 0 4px 12px rgba(0, 181, 226, 0.3);
}

.btn-warning {
    background: linear-gradient(135deg, var(--accent-color), #e08312);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-outline-secondary {
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.5);
    box-shadow: none;
}

.btn-outline-secondary:hover {
    background: rgba(255, 255, 255, 0.8);
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

/* Cards */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(var(--blur-amount));
    -webkit-backdrop-filter: blur(var(--blur-amount));
    border: 1px solid var(--card-border);
    border-radius: 1rem;
    box-shadow: var(--glass-shadow);
    margin-bottom: 1.5rem;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    z-index: auto;
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    background-color: rgba(255, 255, 255, 0.4);
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
}

.card-body {
    padding: 1.5rem;
}

/* Column visibility dropdown - ensure it appears above table */
.filters-card {
    position: relative;
    z-index: 20;
    overflow: visible;
}

.filters-card .dropdown {
    position: relative;
}

.filters-card .dropdown-menu {
    z-index: 9999 !important;
    position: absolute !important;
}

/* Tables */
.table-responsive {
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(var(--blur-amount));
    -webkit-backdrop-filter: blur(var(--blur-amount));
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
    z-index: 1;
}

/* Scroll indicator for tables */
.table-responsive::after {
    content: '→';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    color: var(--text-secondary);
    opacity: 0.3;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.table-responsive:not(:hover)::after {
    opacity: 0.1;
}

/* Hide scroll indicator when scrolled to end */
.table-responsive[data-scrolled="true"]::after {
    display: none;
}

/* Favorite Star Styles */
.favorite-star {
    display: inline-block;
    transition: all 0.2s ease;
    color: #d1d5db;
    font-size: 1.2rem;
    line-height: 1;
    user-select: none;
}

.favorite-star:hover {
    transform: scale(1.2);
    color: #fbbf24;
}

.favorite-star.favorited {
    color: #fbbf24;
    text-shadow: 0 0 4px rgba(251, 191, 36, 0.5);
}

.favorite-star.favorited:hover {
    color: #f59e0b;
    transform: scale(1.1);
}

.favorite-star:active {
    transform: scale(0.95);
}

.table {
    margin-bottom: 0;
    --bs-table-bg: transparent;
    min-width: 1200px; /* Ensure minimum width for readability */
}

.table thead th {
    background-color: rgba(255, 255, 255, 0.6);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Sortable table headers */
.table thead th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease, color 0.2s ease;
    position: relative;
    padding-right: 1.5rem;
}

.table thead th.sortable:hover {
    background-color: rgba(53, 31, 101, 0.1);
    color: var(--primary-color);
}

.table thead th.sortable.active {
    background-color: rgba(53, 31, 101, 0.15);
    color: var(--primary-color);
}

.sort-indicator {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    opacity: 0.3;
    transition: opacity 0.2s ease;
    display: inline-block;
    width: 0.75rem;
    text-align: center;
}

.table thead th.sortable:hover .sort-indicator {
    opacity: 0.6;
}

.table thead th.sortable.active .sort-indicator {
    opacity: 1;
    color: var(--primary-color);
}

.sort-indicator::before {
    content: '⇅';
}

.table thead th.sortable.active.sort-asc .sort-indicator::before {
    content: '↑';
}

.table thead th.sortable.active.sort-desc .sort-indicator::before {
    content: '↓';
}

.table tbody td {
    padding: 0.75rem 0.5rem;
    vertical-align: middle;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.8125rem;
    max-width: 200px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Responsive table columns - hide less important columns on smaller screens */
@media (max-width: 1400px) {
    .table thead th:nth-child(7),
    .table tbody td:nth-child(7),
    .table thead th:nth-child(8),
    .table tbody td:nth-child(8),
    .table thead th:nth-child(9),
    .table tbody td:nth-child(9) {
        display: none;
    }
}

@media (max-width: 1200px) {
    .table thead th:nth-child(10),
    .table tbody td:nth-child(10) {
        display: none;
    }
}

@media (max-width: 992px) {
    .table thead th:nth-child(4),
    .table tbody td:nth-child(4) {
        display: none;
    }
}

/* URL column styling - truncate long URLs (now 5th column after adding favorite column) */
.table tbody td:nth-child(5) {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table tbody td:nth-child(5):hover {
    white-space: normal;
    word-break: break-all;
    position: relative;
    z-index: 5;
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 0.5rem;
    border-radius: 0.25rem;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.4);
}

/* Organization name cell styling */
.org-name-cell {
    min-width: 150px;
    max-width: 250px;
}

.org-name-cell .fw-semibold {
    font-weight: 600;
    line-height: 1.3;
    word-wrap: break-word;
}

/* Better button sizing for compressed views */
.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    white-space: nowrap;
}

/* Improve table scrolling on mobile */
@media (max-width: 768px) {
    .table-responsive {
        border-radius: 0.5rem;
    }
    
    .table {
        min-width: 800px;
    }
    
    .table thead th,
    .table tbody td {
        padding: 0.5rem 0.375rem;
        font-size: 0.75rem;
    }
    
    /* Hide more columns on mobile */
    .table thead th:nth-child(4),
    .table tbody td:nth-child(4),
    .table thead th:nth-child(5),
    .table tbody td:nth-child(5),
    .table thead th:nth-child(6),
    .table tbody td:nth-child(6),
    .table thead th:nth-child(7),
    .table tbody td:nth-child(7),
    .table thead th:nth-child(8),
    .table tbody td:nth-child(8),
    .table thead th:nth-child(9),
    .table tbody td:nth-child(9) {
        display: none;
    }
    
    /* Show only essential columns: checkbox, ID, Name, Status, Actions */
    .org-name-cell {
        max-width: 200px;
    }
}

/* Improve header readability */
@media (max-width: 992px) {
    h1 {
        font-size: 1.5rem;
    }
    
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}

/* Better spacing for compressed views */
@media (max-width: 1200px) {
    .table thead th {
        font-size: 0.7rem;
        padding: 0.625rem 0.375rem;
    }
    
    .table tbody td {
        font-size: 0.75rem;
        padding: 0.625rem 0.375rem;
    }
}

/* Improve checkbox visibility */
.org-checkbox {
    cursor: pointer;
    width: 1.125rem;
    height: 1.125rem;
    margin: 0;
}

/* Better badge visibility */
.badge.bg-light {
    background-color: rgba(248, 250, 252, 0.8) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color);
    font-weight: 500;
}

/* Card improvements */
.card {
    transition: all 0.3s ease;
}

.card-header h4,
.card-header h5,
.card-header h6 {
    line-height: 1.4;
}

/* Better button spacing */
.d-flex.gap-2 > * {
    margin: 0 !important;
}

/* Improved section spacing */
.mb-5 {
    margin-bottom: 3rem !important;
}

/* Improve action buttons visibility */
.table tbody td:last-child {
    white-space: nowrap;
    min-width: 120px;
}

.table tbody td:last-child .btn {
    margin: 0.125rem;
}

/* Sticky Actions Column for Providers Table */
.providers-table-wrapper {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
}

.providers-table .actions-column-header,
.providers-table .actions-column {
    position: sticky;
    right: 0;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 5;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.08);
    padding-left: 1rem;
    padding-right: 1rem;
    min-width: 200px;
}

.providers-table .actions-column-header {
    z-index: 15;
    background-color: rgba(255, 255, 255, 0.98);
    border-left: 1px solid var(--border-color);
}

.providers-table tbody tr:hover .actions-column {
    background-color: rgba(255, 255, 255, 0.98);
}

.providers-table .actions-column {
    border-left: 1px solid rgba(226, 232, 240, 0.5);
}

/* Ensure buttons in actions column are properly spaced */
.providers-table .actions-column .btn {
    white-space: nowrap;
    margin: 0.125rem;
    display: inline-block;
}

/* Responsive: Stack buttons vertically on very small screens */
@media (max-width: 576px) {
    .providers-table .actions-column {
        min-width: 150px;
    }
    
    .providers-table .actions-column .btn {
        display: block;
        width: 100%;
        margin: 0.25rem 0;
    }
}

/* Inputs */
.form-control, .form-select {
    background-color: rgba(255, 255, 255, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    backdrop-filter: blur(4px);
    transition: all 0.2s ease;
}

.form-control:focus, .form-select:focus {
    background-color: rgba(255, 255, 255, 0.9);
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 4px rgba(0, 181, 226, 0.1);
}

/* Stats Boxes */
.stats-box {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(var(--blur-amount));
    -webkit-backdrop-filter: blur(var(--blur-amount));
    border-radius: 1rem;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.stats-box:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(255, 255, 255, 0.8);
}
.form-check-input {
    border-color: var(--border-color);
    width: 1.125rem;
    height: 1.125rem;
    margin-top: 0.2rem;
}

.form-check-input:checked {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
}

.form-check-label {
    font-size: 0.875rem;
    color: var(--text-primary);
    margin-left: 0.5rem;
}

/* Badges */
.badge {
    padding: 0.35em 0.8em;
    font-weight: 600;
    font-size: 0.75rem;
    border-radius: 9999px; /* Pill shape */
    letter-spacing: 0.025em;
}

.bg-success {
    background-color: rgba(0, 208, 156, 0.15) !important;
    color: #008A68;
}

.bg-danger {
    background-color: rgba(255, 90, 95, 0.15) !important;
    color: #C53030;
}

.bg-secondary {
    background-color: rgba(113, 128, 150, 0.15) !important;
    color: #4A5568;
}

.bg-primary {
    background-color: rgba(53, 31, 101, 0.1) !important;
    color: var(--primary-color);
}

.bg-info {
    background-color: rgba(0, 181, 226, 0.15) !important;
    color: #007A99;
}

/* Stats Boxes */
.stats-box {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(var(--blur-amount));
    -webkit-backdrop-filter: blur(var(--blur-amount));
    border-radius: 1rem;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.stats-box:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(255, 255, 255, 0.8);
}

.stats-box h3 {
    color: var(--primary-color);
    font-size: 2.25rem;
    margin-bottom: 0.25rem;
}

.stats-box p {
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

/* Modals */
.modal-content {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 1rem;
    box-shadow: var(--glass-shadow);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.5);
}

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

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 1.5rem;
    background-color: #F8FAFC;
    border-bottom-left-radius: 1rem;
    border-bottom-right-radius: 1rem;
}

/* Ensure modals appear above portal header (portal header has z-index: 10000) */
.modal {
    z-index: 10050 !important;
}

.modal-backdrop {
    z-index: 10040 !important;
}

/* Specific rule for job status modal to ensure it's above portal header */
#jobStatusModal {
    z-index: 10050 !important;
}

#jobStatusModal.modal.show {
    z-index: 10050 !important;
}

/* Ensure modal dialog is positioned correctly above portal header */
#jobStatusModal .modal-dialog {
    margin-top: 1.5rem;
    z-index: 10051 !important;
}

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

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

::-webkit-scrollbar-thumb {
    background: #CBD5E0;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #A0AEC0;
}

/* Utils */
.text-muted {
    color: var(--text-secondary) !important;
}

.fw-bold {
    font-weight: 700 !important;
}

/* Animation */
.tab-content {
    animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(10px);
        filter: blur(4px);
    }
    to { 
        opacity: 1; 
        transform: translateY(0);
        filter: blur(0);
    }
}

/* Loading State */
.spinner-border {
    color: var(--secondary-color);
}

/* Custom overwrites for specific elements */
#organizations-tab .card {
    border: none;
    box-shadow: none;
    background: transparent;
    padding: 0;
    margin-bottom: 1rem;
}

#organizations-tab .card-body {
    padding: 0;
}

/* Markdown Rendering Styles */
.markdown-body {
    line-height: 1.6;
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1.25;
}

.markdown-body h1 {
    font-size: 2rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.markdown-body h2 {
    font-size: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.375rem;
}

.markdown-body h3 {
    font-size: 1.25rem;
}

.markdown-body h4 {
    font-size: 1.125rem;
}

.markdown-body h5 {
    font-size: 1rem;
}

.markdown-body h6 {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.markdown-body p {
    margin-bottom: 1rem;
    line-height: 1.7;
}

.markdown-body ul,
.markdown-body ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.markdown-body li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.markdown-body li > p {
    margin-bottom: 0.5rem;
}

.markdown-body ul {
    list-style-type: disc;
}

.markdown-body ol {
    list-style-type: decimal;
}

.markdown-body code {
    background-color: rgba(53, 31, 101, 0.1);
    color: var(--primary-color);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.875em;
    font-family: 'Courier New', Courier, monospace;
}

.markdown-body pre {
    background-color: #1A202C;
    color: #E2E8F0;
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.markdown-body pre code {
    background-color: transparent;
    color: inherit;
    padding: 0;
    border-radius: 0;
    font-size: 0.875rem;
}

.markdown-body blockquote {
    border-left: 4px solid var(--secondary-color);
    padding-left: 1rem;
    margin-left: 0;
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-style: italic;
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    overflow: hidden;
}

.markdown-body table th,
.markdown-body table td {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    text-align: left;
}

.markdown-body table th {
    background-color: #F8FAFC;
    font-weight: 600;
    color: var(--primary-color);
}

.markdown-body table tr:nth-child(even) {
    background-color: #F8FAFC;
}

.markdown-body a {
    color: var(--secondary-color);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.markdown-body a:hover {
    border-bottom-color: var(--secondary-color);
}

.markdown-body strong {
    font-weight: 700;
    color: var(--text-primary);
}

.markdown-body em {
    font-style: italic;
}

.markdown-body hr {
    border: none;
    border-top: 2px solid var(--border-color);
    margin: 2rem 0;
}

.markdown-body img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    margin: 1rem 0;
}

/* Marketing Plan Specific Styles */
.marketing-plan-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 1.25rem;
    box-shadow: 0 20px 40px -5px rgba(0, 0, 0, 0.08), 0 10px 15px -5px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin-bottom: 2rem;
}

.marketing-plan-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.12);
}

.marketing-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    padding: 1.75rem 2.5rem;
    color: white;
    display: none !important; /* Hidden on all marketing assets pages */
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.marketing-header::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: linear-gradient(45deg, transparent 0%, rgba(255, 255, 255, 0.1) 50%, transparent 100%);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.marketing-plan-card:hover .marketing-header::after {
    transform: translateX(100%);
}

.marketing-header h5 {
    color: white;
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.marketing-body {
    padding: 2.5rem;
}

.marketing-meta {
    background: #F8FAFC;
    border-radius: 1rem;
    padding: 1rem 1.5rem;
    margin-bottom: 2.5rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border-color);
    gap: 1rem;
}

.marketing-meta-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.marketing-meta-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: white;
    color: var(--text-secondary);
    box-shadow: var(--shadow-sm);
}

/* Enhanced Markdown Content for Marketing Plan */
.marketing-plan-content h1 {
    font-size: 2.25rem;
    background: linear-gradient(135deg, var(--primary-color), #4c2d91);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    border-bottom: 2px solid rgba(53, 31, 101, 0.1);
    padding-bottom: 1rem;
    margin-top: 0;
}

.marketing-plan-content h2 {
    font-size: 1.75rem;
    color: var(--primary-color);
    border-bottom: none;
    margin-top: 2.5rem;
    padding-bottom: 0;
    position: relative;
    padding-left: 1rem;
}

.marketing-plan-content h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.25em;
    bottom: 0.25em;
    width: 4px;
    background: var(--secondary-color); /* Luma Teal to match header */
    border-radius: 2px;
}

.marketing-plan-content h3 {
    font-size: 1.35rem;
    color: #4A5568;
    margin-top: 2rem;
}

.marketing-plan-content ul {
    background: linear-gradient(to right, #F8FAFC, transparent);
    border-radius: 0.75rem;
    padding: 1.5rem 1.5rem 1.5rem 2.5rem;
    border-left: 4px solid var(--secondary-color);
    margin: 1.5rem 0;
}

.marketing-plan-content li {
    margin-bottom: 0.75rem;
    position: relative;
}

.marketing-plan-content li::marker {
    color: var(--secondary-color);
}

.marketing-plan-content blockquote {
    background: #FFF8E5;
    border-left-color: var(--accent-color);
    color: #925400;
    padding: 1.5rem;
    border-radius: 0.5rem;
    font-style: normal;
    box-shadow: var(--shadow-sm);
}

.marketing-plan-content strong {
    color: var(--primary-color);
}

/* Marketing Pipeline (Multi-step) */
.pipeline-steps {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.pipeline-step {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    background: rgba(248, 250, 252, 0.8);
}

.pipeline-step .step-title {
    font-weight: 700;
    color: var(--primary-color);
}

.pipeline-step .step-message {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.pipeline-step .step-badge {
    white-space: nowrap;
}

/* Marketing Assets Tabs */
#marketingAssetsTabs,
#marketingAssetsTabsLive {
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1rem;
}

#marketingAssetsTabs .nav-link,
#marketingAssetsTabsLive .nav-link {
    color: var(--text-secondary);
    border: none;
    border-bottom: 3px solid transparent;
    padding: 0.75rem 1.25rem;
    font-weight: 500;
    transition: all 0.2s ease;
    background: transparent;
}

#marketingAssetsTabs .nav-link:hover,
#marketingAssetsTabsLive .nav-link:hover {
    color: var(--primary-color);
    background-color: rgba(53, 31, 101, 0.05);
    border-bottom-color: rgba(53, 31, 101, 0.3);
}

#marketingAssetsTabs .nav-link.active,
#marketingAssetsTabsLive .nav-link.active {
    color: var(--primary-color);
    background-color: rgba(53, 31, 101, 0.08);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

#marketingAssetsTabContent .tab-pane,
#marketingAssetsTabContentLive .tab-pane {
    padding: 1rem 0;
}

.pipeline-preview-frame {
    width: 100%;
    min-height: 520px;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    background: white;
    box-shadow: var(--shadow-sm);
}

/* Chat Interface Styles */
.chat-messages {
    min-height: 400px;
    max-height: 600px;
    overflow-y: auto;
    padding: 1rem;
    background: var(--background-color);
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.chat-message {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
}

.chat-message-user {
    align-items: flex-end;
}

.chat-message-assistant {
    align-items: flex-start;
}

.chat-message-content {
    max-width: 80%;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    word-wrap: break-word;
}

.chat-message-user .chat-message-content {
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 0.25rem;
}

.chat-message-assistant .chat-message-content {
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 0.25rem;
    box-shadow: var(--shadow-sm);
}

.chat-message-text {
    line-height: 1.5;
    margin-bottom: 0.25rem;
}

.chat-message-text code {
    background: rgba(0, 0, 0, 0.1);
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.chat-message-assistant .chat-message-text code {
    background: rgba(53, 31, 101, 0.1);
    color: var(--primary-color);
}

.chat-message-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    opacity: 0.7;
}

.chat-message-user .chat-message-time {
    color: rgba(255, 255, 255, 0.8);
}

.chat-loading {
    opacity: 0.8;
}

.chat-loading .chat-message-content {
    display: flex;
    align-items: center;
}

.chat-loading .spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
}

.chat-loading .loading-text {
    color: var(--text-secondary);
    font-style: italic;
}

.chat-input-container {
    display: flex;
    gap: 0.5rem;
}

.chat-input-container textarea {
    resize: vertical;
    min-height: 60px;
}

.chat-input-container .input-group {
    display: flex;
    gap: 0.5rem;
}

.chat-input-container .input-group textarea {
    flex: 1;
}

.chat-input-container .input-group button {
    align-self: flex-end;
    min-width: 80px;
}

/* Dashboard Layout */
.dashboard-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
    min-height: calc(100vh - 200px);
}

/* Org Selector */
.org-selector-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 200px);
    padding: 2rem;
}

.org-selector-container .card {
    overflow: visible !important;
}

.org-selector-container .card-body {
    overflow: visible !important;
}

.org-selector-container .position-relative {
    overflow: visible;
}

.org-search-results {
    position: absolute;
    top: calc(100% + 1px);
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(var(--blur-amount));
    -webkit-backdrop-filter: blur(var(--blur-amount));
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-lg);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1050;
    display: none;
    margin-top: 0;
}

.org-search-result-item {
    padding: 1rem 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--border-color);
}

.org-search-result-item:last-child {
    border-bottom: none;
}

.org-search-result-item:hover {
    background: rgba(53, 31, 101, 0.08);
}

.org-search-result-item:active {
    background: rgba(53, 31, 101, 0.15);
}

.org-search-result-item.no-results {
    cursor: default;
    color: var(--text-secondary);
    text-align: center;
    padding: 1.5rem;
}

.org-search-result-item.no-results:hover {
    background: transparent;
}

.org-result-name {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
    font-size: 0.9375rem;
}

.org-result-name mark {
    background: rgba(0, 181, 226, 0.2);
    color: var(--primary-color);
    padding: 0 0.125rem;
    border-radius: 0.25rem;
    font-weight: 700;
}

.org-result-id {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-family: 'Courier New', Courier, monospace;
}

.dashboard-sidebar {
    background: var(--card-bg);
    backdrop-filter: blur(var(--blur-amount));
    -webkit-backdrop-filter: blur(var(--blur-amount));
    border: 1px solid var(--card-border);
    border-radius: 1rem;
    box-shadow: var(--glass-shadow);
    padding: 1.25rem;
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-header {
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.sidebar-header h5 {
    color: var(--primary-color);
    font-weight: 600;
    margin: 0;
    font-size: 1rem;
    word-break: break-word;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.sidebar-nav-item:hover {
    background: rgba(53, 31, 101, 0.08);
    color: var(--primary-color);
    border-color: var(--border-color);
}

.sidebar-nav-item.active {
    background: rgba(53, 31, 101, 0.15);
    color: var(--primary-color);
    font-weight: 600;
    border-color: var(--primary-color);
}

.sidebar-nav-item .nav-icon {
    font-size: 1.25rem;
    width: 1.5rem;
    text-align: center;
}

.sidebar-nav-item .nav-label {
    flex: 1;
}

.sidebar-nav-item .nav-arrow {
    font-size: 0.75rem;
    transition: transform 0.2s ease;
    color: var(--text-secondary);
}

.sidebar-nav-group {
    display: flex;
    flex-direction: column;
}

.sidebar-nav-parent {
    cursor: pointer;
}

.sidebar-nav-group.expanded .sidebar-nav-parent .nav-arrow {
    transform: rotate(180deg);
}

.sidebar-subnav {
    display: none;
    flex-direction: column;
    margin-left: 1.5rem;
    margin-top: 0.25rem;
    padding-left: 0.5rem;
    border-left: 2px solid var(--border-color);
    gap: 0.25rem;
}

.sidebar-nav-group.expanded .sidebar-subnav {
    display: flex;
}

.sidebar-subnav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    font-size: 0.9rem;
}

.sidebar-subnav-item:hover {
    background: rgba(53, 31, 101, 0.08);
    color: var(--primary-color);
    border-color: var(--border-color);
}

.sidebar-subnav-item.active {
    background: rgba(53, 31, 101, 0.15);
    color: var(--primary-color);
    font-weight: 600;
    border-color: var(--primary-color);
}

.sidebar-subnav-item .nav-icon {
    font-size: 1rem;
    width: 1.25rem;
    text-align: center;
}

.sidebar-subnav-item .nav-label {
    flex: 1;
}

.dashboard-content {
    min-width: 0;
}


.dashboard-section {
    animation: fadeIn 0.3s ease;
    position: relative;
    z-index: 1;
}

#dashboard-assets-section {
    position: relative;
    z-index: 1;
    display: block !important;
}

#dashboard-assets-section[style*="display: none"] {
    display: none !important;
}

/* KPI Widgets */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-widget {
    background: var(--card-bg);
    backdrop-filter: blur(var(--blur-amount));
    -webkit-backdrop-filter: blur(var(--blur-amount));
    border: 1px solid var(--card-border);
    border-radius: 1rem;
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.kpi-widget:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.kpi-widget .kpi-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.kpi-widget .kpi-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.kpi-widget .kpi-change {
    font-size: 0.75rem;
    margin-top: 0.5rem;
    color: var(--text-secondary);
}

/* Responsive Dashboard */
@media (max-width: 992px) {
    .dashboard-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .dashboard-sidebar {
        position: relative;
        top: 0;
        max-height: none;
    }
}

@media (max-width: 768px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .org-selector-container {
        padding: 1rem;
    }
}

/* ============================================
   Decision Tree Visualization Styles
   ============================================ */

/* Decision Tree Badge */
.decision-tree-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    background: linear-gradient(135deg, rgba(0, 181, 226, 0.15), rgba(53, 31, 101, 0.1));
    color: var(--primary-color);
    border: 1px solid rgba(0, 181, 226, 0.3);
    cursor: pointer;
    transition: all 0.2s ease;
}

.decision-tree-badge:hover {
    background: linear-gradient(135deg, rgba(0, 181, 226, 0.25), rgba(53, 31, 101, 0.15));
    border-color: var(--secondary-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 181, 226, 0.2);
}

.decision-tree-badge .badge-icon {
    font-size: 0.875rem;
}

/* Decision Tree Modal */
.decision-tree-modal .modal-dialog {
    max-width: 900px;
    margin-top: 3rem;
    margin-bottom: 3rem;
}

.decision-tree-modal .modal-header {
    background: linear-gradient(135deg, var(--primary-color), #4c2d91);
    color: white;
    border-bottom: none;
}

.decision-tree-modal .modal-title {
    color: white;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.decision-tree-modal .modal-header .btn-close {
    filter: brightness(0) invert(1);
    opacity: 0.8;
}

.decision-tree-modal .modal-header .btn-close:hover {
    opacity: 1;
}

/* Decision Tree Tabs */
.decision-tree-tabs {
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1.25rem;
}

/* Decision Tree Tab Content */
#decisionTreeViewContent {
    display: block !important; /* Override any inline styles */
}

#decisionTreeViewContent .tab-pane {
    padding: 1.5rem;
    min-height: 300px;
    background: #f8f9fa;
}

#decisionTreePathsContent,
#decisionTreeTextContent,
#decisionTreeMermaidContainer {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.decision-tree-tabs .nav-link {
    color: var(--text-primary);
    border: none;
    border-bottom: 3px solid transparent;
    padding: 0.75rem 1.25rem;
    font-weight: 600;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.5);
    margin-bottom: -2px;
    font-size: 0.9375rem;
}

.decision-tree-tabs .nav-link:hover {
    color: var(--primary-color);
    background-color: rgba(53, 31, 101, 0.1);
    border-bottom-color: rgba(53, 31, 101, 0.5);
}

.decision-tree-tabs .nav-link.active {
    color: white;
    background: linear-gradient(135deg, var(--primary-color), #4c2d91);
    border-bottom-color: var(--secondary-color);
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(53, 31, 101, 0.2);
}

/* Decision Tree Path Cards */
.decision-tree-paths-section {
    margin-bottom: 1rem;
}

.decision-tree-path-card {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.decision-tree-path-card:hover {
    box-shadow: var(--shadow-sm);
    transform: translateX(4px);
}

.decision-tree-path-card.success {
    border-left: 4px solid var(--success-color);
    background: linear-gradient(to right, rgba(0, 208, 156, 0.08), transparent);
}

.decision-tree-path-card.failure {
    border-left: 4px solid var(--danger-color);
    background: linear-gradient(to right, rgba(255, 90, 95, 0.08), transparent);
}

.decision-tree-path-card .path-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.decision-tree-path-card .path-string {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 600;
}

.decision-tree-path-card .path-detail {
    font-size: 0.8125rem;
    margin-top: 0.375rem;
}

.decision-tree-summary-footer {
    font-size: 0.875rem;
}

/* Mermaid Flowchart Container */
.mermaid-container {
    background: #fafbfc;
    border-radius: 0.75rem;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    overflow-x: auto;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mermaid-container svg {
    max-width: 100%;
    height: auto;
}

/* Mermaid node styling overrides */
.mermaid-container .node rect {
    rx: 8px;
    ry: 8px;
}

/* Text Tree Fallback */
.text-tree-container {
    background: #1A202C;
    color: #E2E8F0;
    border-radius: 0.75rem;
    padding: 1.5rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre;
}

/* Decision Tree Summary Stats */
.decision-tree-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.decision-tree-stat {
    background: rgba(255, 255, 255, 0.6);
    border-radius: 0.75rem;
    padding: 1rem;
    text-align: center;
    border: 1px solid var(--border-color);
}

.decision-tree-stat .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.decision-tree-stat .stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.decision-tree-stat.success .stat-value {
    color: var(--success-color);
}

.decision-tree-stat.danger .stat-value {
    color: var(--danger-color);
}

/* Visit Type Row with Decision Tree */
.visit-type-row-with-tree {
    position: relative;
}

.visit-type-row-with-tree .decision-tree-indicator {
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background: linear-gradient(to bottom, var(--secondary-color), var(--primary-color));
    border-radius: 2px;
}

/* Decision Tree Card in Dashboard Section */
.decision-tree-card {
    transition: all 0.2s ease;
    border: 1px solid var(--border-color);
}

.decision-tree-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--secondary-color);
}

.decision-tree-card.border-success {
    border-left: 4px solid var(--success-color);
}

.specialty-decision-trees {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .decision-tree-modal .modal-dialog {
        max-width: 95%;
        margin: 0.5rem auto;
    }

    .decision-tree-path-card .path-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .decision-tree-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .mermaid-container {
        padding: 1rem;
    }
}

/* ============================================
   Portal Layout Styles
   ============================================ */

.portal-header {
    background: var(--primary-color) !important; /* Luma Navy - Dark header for portal view only */
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 10000 !important;
    overflow: visible;
    padding-bottom: 0;
    isolation: isolate;
    color: white;
}

.portal-header .container-fluid {
    max-width: 1200px;
    margin: 0 auto;
}

/* Admin nav dropdown styling */
#admin-nav .navbar .dropdown-toggle {
    color: rgba(255, 255, 255, 0.8) !important;
}

#admin-nav .navbar .dropdown-toggle:hover,
#admin-nav .navbar .dropdown-toggle.show {
    color: white !important;
    background-color: rgba(255, 255, 255, 0.1);
}

#admin-nav .navbar .dropdown-menu {
    background-color: white;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    margin-top: 0.25rem;
}

#admin-nav .navbar .dropdown-item {
    color: var(--text-primary);
    padding: 0.5rem 1rem;
}

#admin-nav .navbar .dropdown-item:hover {
    background-color: var(--hover-bg);
    color: var(--primary-color);
}

.portal-header #portalOrgName {
    color: white !important;
}

.portal-header .btn-outline-secondary {
    border-color: rgba(255, 255, 255, 0.3);
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.portal-header .btn-outline-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: white;
}

.portal-header .vr {
    background-color: rgba(255, 255, 255, 0.2);
}

/* User Menu Dropdown */
.portal-header .dropdown {
    position: relative;
    z-index: 10010 !important; /* Higher than portal-nav (10001) */
    isolation: isolate;
}

.btn-user-menu {
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 42px;
    height: 42px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
    position: relative;
    z-index: 10011;
}

.btn-user-menu:hover,
.btn-user-menu:focus {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

.btn-user-menu.show {
    background: rgba(255, 255, 255, 0.3);
    border-color: white;
}

.btn-user-menu .user-icon {
    font-size: 1.25rem;
    filter: brightness(0) invert(1);
}

.btn-user-menu::after {
    display: none; /* Hide default Bootstrap dropdown arrow */
}

.portal-header .dropdown-menu {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    margin-top: 0.5rem;
    min-width: 220px;
    padding: 0.5rem;
    position: absolute !important;
    z-index: 10012 !important; /* Higher than dropdown container and portal-nav */
    top: 100% !important;
    right: 0 !important;
    left: auto !important;
    pointer-events: all !important;
    transform: translateY(0) !important;
}

.portal-header .dropdown-menu.show {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: all !important;
}

.portal-header .dropdown-item {
    color: var(--text-primary);
    padding: 0.625rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    position: relative;
    z-index: 10013;
    pointer-events: all !important;
    cursor: pointer;
}

.portal-header .dropdown-item:hover {
    background: rgba(53, 31, 101, 0.08);
    color: var(--primary-color);
}

.portal-header .dropdown-divider {
    margin: 0.5rem 0;
    border-color: var(--border-color);
    opacity: 0.5;
    pointer-events: none;
}

.portal-nav-container {
    position: relative;
    z-index: 10001 !important;
    overflow: visible;
    isolation: isolate;
    background: rgba(0, 0, 0, 0.1); /* Slightly darker sub-nav area */
}

.portal-nav .nav-item.dropdown {
    position: relative;
    z-index: 10002 !important;
    isolation: isolate;
    display: flex;
    align-items: center;
}

.portal-nav .dropdown-toggle {
    cursor: pointer;
}

.portal-nav .dropdown-toggle::after {
    margin-left: 0.35em;
    vertical-align: 0.1em;
    filter: brightness(0) invert(1);
    opacity: 0.9;
}

.portal-nav .dropdown-menu {
    z-index: 10003 !important;
    position: absolute !important;
    margin-top: 0.25rem !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15) !important;
    background-color: white !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 0.75rem !important;
    min-width: 200px !important;
    left: 0 !important;
    top: 100% !important;
    display: none; /* Hidden by default, Bootstrap will add 'show' class */
    isolation: isolate;
    padding: 0.5rem;
}

.portal-nav .dropdown-menu.show {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: all !important;
    transform: translateY(0) !important;
}

.portal-nav .dropdown-menu .dropdown-item {
    z-index: 10004 !important;
    position: relative;
    color: var(--text-primary) !important;
    padding: 0.625rem 1rem;
    background-color: white;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
    font-weight: 500;
}

.portal-nav .dropdown-menu .dropdown-item:hover {
    background-color: var(--hover-bg);
    color: var(--primary-color) !important;
    transform: translateX(2px);
}

.portal-nav .dropdown-menu .dropdown-item.active {
    background-color: rgba(53, 31, 101, 0.1);
    color: var(--primary-color) !important;
    font-weight: 600;
}

/* Make dropdown toggle appear active when a child item is active */
.portal-nav .nav-item.dropdown:has(.dropdown-item.active) .dropdown-toggle {
    color: white !important;
    background: rgba(255, 255, 255, 0.15);
}

.portal-nav {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    overflow: visible;
    padding-bottom: 0.5rem;
    position: relative;
    z-index: 10001 !important;
}

.portal-nav::-webkit-scrollbar {
    display: none;
}

.portal-nav .nav-link {
    color: rgba(255, 255, 255, 0.8) !important;
    font-weight: var(--font-weight-semibold);
    padding: 0.75rem 1rem;
    border-radius: 0;
    white-space: nowrap;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    letter-spacing: var(--letter-spacing-normal);
    border-bottom: 3px solid transparent;
}

.portal-nav .nav-link:hover {
    color: white !important;
    background: rgba(255, 255, 255, 0.1);
}

.portal-nav .nav-link.active {
    color: white !important;
    background: transparent;
    border-bottom-color: var(--secondary-color); /* Luma Teal indicator */
}

.portal-nav .nav-icon {
    filter: brightness(0) invert(1);
    opacity: 0.9;
}

.dashboard-container-portal {
    min-height: calc(100vh - 140px);
}

.dashboard-content-portal {
    padding-top: 2.5rem;
    padding-bottom: 4rem;
    position: relative;
    z-index: 1;
    isolation: isolate;
    max-width: 1400px;
    margin: 0 auto;
}

/* KPI Card Styles */
.kpi-card {
    transition: all 0.3s ease;
    border-radius: 16px !important;
    overflow: hidden;
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15) !important;
}

.kpi-card .card-body {
    position: relative;
}

.kpi-card .display-5 {
    font-size: 2.5rem;
    line-height: 1.2;
}

/* Better table styling */
.table-light thead th {
    background-color: #f8f9fa;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
}

.table-hover tbody tr:hover {
    background-color: rgba(102, 126, 234, 0.05);
}

/* Load more control styling */
.bg-light.rounded {
    background-color: #f8f9fa !important;
    border: 1px solid #e9ecef;
}

/* Sleek KPI Widgets Update */
.kpi-widget {
    background: white;
    border: 1px solid rgba(226, 232, 240, 0.6);
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.kpi-widget:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.04);
    border-color: rgba(53, 31, 101, 0.15);
}

/* Dashboard section spacing */
.dashboard-section {
    margin-bottom: 2rem;
}

.dashboard-section .card {
    border-radius: 12px;
}

.dashboard-section .card-header {
    border-radius: 12px 12px 0 0 !important;
}

.kpi-value {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: var(--font-weight-extrabold);
    letter-spacing: var(--letter-spacing-tight);
    color: var(--text-primary);
}

.kpi-label {
    font-size: 0.75rem;
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-wide);
    color: #64748b;
}

/* Pill/Tag Styles for Specialties */
.specialty-pill {
    display: inline-block;
    padding: 0.35em 0.85em;
    font-size: 0.75rem;
    font-weight: var(--font-weight-semibold);
    line-height: 1.2;
    color: var(--primary-color);
    background-color: rgba(53, 31, 101, 0.06);
    border-radius: 9999px;
    margin-right: 0.35rem;
    margin-bottom: 0.35rem;
    transition: all 0.2s ease;
    letter-spacing: var(--letter-spacing-normal);
}

.specialty-pill:hover {
    background-color: rgba(53, 31, 101, 0.12);
}

.specialty-pill.more {
    background-color: #f1f5f9;
    color: #64748b;
}

.specialty-pill.more:hover {
    background-color: #e2e8f0;
    color: #475569;
}

.specialty-pill.clickable {
    cursor: pointer;
    transition: all 0.2s ease;
}

.specialty-pill.clickable:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Vertical Divider */
.vr {
    display: inline-block;
    align-self: stretch;
    width: 1px;
    min-height: 1em;
    background-color: var(--border-color);
    opacity: 1;
    margin: 0 0.5rem;
}

/* ============================================
   Provider Tabs Styling
   ============================================ */

.nav-tabs {
    border-bottom: 2px solid rgba(226, 232, 240, 0.6);
}

.nav-tabs .nav-link {
    color: var(--text-secondary) !important;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.75rem 1.25rem;
    font-weight: var(--font-weight-semibold);
    transition: all 0.2s ease;
}

.nav-tabs .nav-link:hover {
    color: var(--primary-color) !important;
    border-bottom-color: rgba(53, 31, 101, 0.3);
}

.nav-tabs .nav-link.active {
    color: var(--primary-color) !important;
    background: transparent;
    border-bottom: 2px solid var(--primary-color);
}

/* ============================================
   Bulk Provider ID Update Panel
   ============================================ */

#bulkUpdateProviderIdsPanel {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 181, 226, 0.2);
    box-shadow: 0 2px 8px rgba(0, 181, 226, 0.1);
}

#bulkUpdateProviderIdsPanel .card-header {
    background: linear-gradient(135deg, rgba(0, 181, 226, 0.08), rgba(53, 31, 101, 0.05));
    border-bottom: 1px solid rgba(0, 181, 226, 0.2);
}

#bulkUpdateProviderIdsPanel .card-header h6 {
    color: var(--primary-color);
    font-weight: var(--font-weight-bold);
}

#providerIdTextarea {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    background-color: rgba(248, 250, 252, 0.8);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

#providerIdTextarea:focus {
    background-color: white;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(0, 181, 226, 0.1);
}

#providerIdPreview {
    margin-top: 1rem;
    animation: fadeIn 0.3s ease;
}

#providerIdPreview .table {
    background: white;
    border-radius: 0.5rem;
    overflow: hidden;
}

#providerIdPreview .table-warning {
    background-color: rgba(255, 193, 7, 0.1);
}

#providerIdPreview .table-warning td {
    border-color: rgba(255, 193, 7, 0.2);
}

#providerIdPreview code {
    background-color: rgba(53, 31, 101, 0.08);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
}

#providerIdPreview .text-primary {
    color: var(--secondary-color) !important;
    font-weight: var(--font-weight-bold);
}