/* Theme Overrides - Ensures proper light/dark mode adaptation */

/* Global theme-aware text color overrides */
.theme-light {
    --text-primary: #212529 !important;
    --text-secondary: #495057 !important;
    --text-muted: #6c757d !important;
    --bg-primary: #ffffff !important;
    --bg-secondary: #f8f9fa !important;
    --bg-card: #ffffff !important;
    --bg-elev-1: #ffffff !important;
    --bg-elev-2: #e9ecef !important;
    --border-color: #dee2e6 !important;
    --accent-primary: #e3f2fd !important;
    --accent-secondary: #f3e5f5 !important;
    --accent-tertiary: #e8f5e8 !important;
    --accent-blue-600: #1a73e8 !important;
    --accent-purple-600: #7b1fa2 !important;
    --accent-green-600: #388e3c !important;
    --accent-info: #0288d1 !important;
    --accent-success: #198754 !important;
    --accent-error: #d32f2f !important;
}

.theme-dark {
    --text-primary: #e0e0e0 !important;
    --text-secondary: #cfcfcf !important;
    --text-muted: #a0a0a0 !important;
    --bg-primary: #121212 !important;
    --bg-secondary: #161616 !important;
    --bg-card: #1b1b1b !important;
    --bg-elev-1: #181818 !important;
    --bg-elev-2: #202020 !important;
    --border-color: #2e2e2e !important;
    --accent-primary: #bbdefb !important;
    --accent-secondary: #e1bee7 !important;
    --accent-tertiary: #c8e6c9 !important;
    --accent-blue-600: #1a73e8 !important;
    --accent-purple-600: #ce93d8 !important;
    --accent-green-600: #a5d6a7 !important;
    --accent-info: #90caf9 !important;
    --accent-success: #198754 !important;
    --accent-error: #ef9a9a !important;
}

/* Bootstrap component overrides for theme consistency */
.theme-light .table,
.theme-dark .table {
    --bs-table-bg: var(--bg-card);
    --bs-table-color: var(--text-primary);
    --bs-table-border-color: var(--border-color);
    --bs-table-striped-bg: var(--bg-card);
    --bs-table-striped-color: var(--text-primary);
    --bs-table-hover-bg: transparent;
    --bs-table-hover-color: var(--text-primary);
}

/* Table header overrides */
.theme-light .table thead th,
.theme-dark .table thead th {
    background-color: var(--bg-elev-1) !important;
    color: var(--text-primary) !important;
    border-bottom-color: var(--border-color) !important;
}

/* Table body overrides - consistent background for all rows */
.theme-light .table tbody td,
.theme-dark .table tbody td {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

/* Remove striped row effect - make all rows consistent */
.theme-light .table-striped > tbody > tr:nth-of-type(odd) > td,
.theme-dark .table-striped > tbody > tr:nth-of-type(odd) > td,
.theme-light .table-striped > tbody > tr:nth-of-type(even) > td,
.theme-dark .table-striped > tbody > tr:nth-of-type(even) > td {
    background-color: var(--bg-card) !important;
}

/* Ensure all table rows have consistent background */
.table tbody tr td {
    background-color: var(--bg-card) !important;
}

/* Table hover effect - removed light blue hover */
.theme-light .table-hover > tbody > tr:hover > td,
.theme-dark .table-hover > tbody > tr:hover > td {
    background-color: transparent !important;
}

/* Remove ALL table hover effects globally */
.table tbody tr:hover,
.table-hover tbody tr:hover,
.table tbody tr:hover td,
.table-hover tbody tr:hover td {
    background-color: transparent !important;
}

/* Override Bootstrap's default hover colors */
.table tbody tr:hover {
    background-color: transparent !important;
}

/* Additional global table overrides to ensure no hover effects */
.table-hover > tbody > tr:hover,
.table-hover > tbody > tr:hover > td,
.table-hover > tbody > tr:hover > th {
    background-color: transparent !important;
}

/* Override any remaining Bootstrap table classes */
.table-striped > tbody > tr:nth-of-type(odd) > td,
.table-striped > tbody > tr:nth-of-type(even) > td {
    background-color: var(--bg-card) !important;
}

/* Ensure consistent row backgrounds for all table types */
.table tbody tr,
.table-striped tbody tr,
.table-hover tbody tr {
    background-color: var(--bg-card) !important;
}

.table tbody tr td,
.table-striped tbody tr td,
.table-hover tbody tr td {
    background-color: var(--bg-card) !important;
}

/* Form controls theme adaptation */
.theme-light input,
.theme-light textarea,
.theme-light select {
    background-color: var(--bg-elev-1) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

.theme-dark input,
.theme-dark textarea,
.theme-dark select {
    background-color: var(--bg-elev-1) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

/* Button theme adaptation */
.theme-light .btn-outline-light {
    color: var(--text-secondary) !important;
    border-color: var(--border-color) !important;
}

.theme-dark .btn-outline-light {
    color: var(--text-secondary) !important;
    border-color: var(--border-color) !important;
}

/* Ensure all buttons have white text for better contrast */
.theme-light .btn-primary,
.theme-dark .btn-primary {
    color: white !important;
}

.theme-light .btn-success,
.theme-dark .btn-success {
    color: white !important;
}

.theme-light .btn-info,
.theme-dark .btn-info {
    color: white !important;
}

.theme-light .btn-warning,
.theme-dark .btn-warning {
    color: white !important;
}

.theme-light .btn-danger,
.theme-dark .btn-danger {
    color: white !important;
}

/* Modal theme adaptation */
.theme-light .modal-content {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

.theme-dark .modal-content {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

.theme-light .modal-header {
    background-color: var(--bg-elev-1) !important;
    border-bottom-color: var(--border-color) !important;
}

.theme-dark .modal-header {
    background-color: var(--bg-elev-1) !important;
    border-bottom-color: var(--border-color) !important;
}

.theme-light .modal-footer {
    background-color: var(--bg-elev-1) !important;
    border-top-color: var(--border-color) !important;
}

.theme-dark .modal-footer {
    background-color: var(--bg-elev-1) !important;
    border-top-color: var(--border-color) !important;
}

/* Dropdown theme adaptation */
.theme-light .dropdown-menu {
    background-color: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}

.theme-dark .dropdown-menu {
    background-color: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}

.theme-light .dropdown-item {
    color: var(--text-primary) !important;
}

.theme-dark .dropdown-item {
    color: var(--text-primary) !important;
}

.theme-light .dropdown-item:hover {
    background-color: var(--accent-primary) !important;
    color: var(--text-primary) !important;
}

.theme-dark .dropdown-item:hover {
    background-color: var(--accent-primary) !important;
    color: var(--text-primary) !important;
}

/* Nav tabs theme adaptation */
.theme-light .nav-tabs .nav-link {
    color: var(--text-secondary) !important;
    border-color: var(--border-color) !important;
}

.theme-dark .nav-tabs .nav-link {
    color: var(--text-secondary) !important;
    border-color: var(--border-color) !important;
}

.theme-light .nav-tabs .nav-link.active {
    color: var(--accent-blue-600) !important;
    background-color: var(--bg-card) !important;
    border-color: var(--accent-blue-600) var(--accent-blue-600) var(--bg-card) !important;
    border-width: 3px 3px 1px !important;
    font-weight: 600 !important;
    box-shadow: 0 -2px 8px rgba(26, 115, 232, 0.15) !important;
}

/* Ensure dropdown chevrons are visible in light theme */
.theme-light .form-select,
.theme-light select.form-select,
.theme-light select.form-select-sm {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23000000' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m1 6 7 7 7-7'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.75rem center !important;
    background-size: 16px 12px !important;
}

.theme-light .dropdown-toggle::after {
    color: #000000 !important;
    border-top-color: #000000 !important;
}

.theme-light select:not(.form-select) {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23000000' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m1 6 7 7 7-7'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.75rem center !important;
    background-size: 16px 12px !important;
}

.theme-dark .nav-tabs .nav-link.active {
    color: var(--accent-blue-400) !important;
    background: linear-gradient(135deg, var(--bg-card) 0%, color-mix(in oklab, var(--accent-blue-400) 8%, var(--bg-card)) 100%) !important;
    border-color: var(--accent-blue-400) var(--accent-blue-400) var(--bg-card) !important;
    border-width: 3px 3px 1px !important;
    font-weight: 600 !important;
    box-shadow: 0 -2px 8px rgba(96, 165, 250, 0.2) !important;
}

/* Ensure dropdown chevrons are visible in dark theme */
.theme-dark .form-select,
.theme-dark select.form-select,
.theme-dark select.form-select-sm {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m1 6 7 7 7-7'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.75rem center !important;
    background-size: 16px 12px !important;
}

.theme-dark .dropdown-toggle::after {
    color: #ffffff !important;
    border-top-color: #ffffff !important;
}

.theme-dark select:not(.form-select) {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m1 6 7 7 7-7'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.75rem center !important;
    background-size: 16px 12px !important;
}

/* Card theme adaptation */
.theme-light .card {
    background-color: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}

.theme-dark .card {
    background-color: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}

.theme-light .card-header {
    background-color: var(--bg-elev-1) !important;
    border-bottom-color: var(--border-color) !important;
}

.theme-dark .card-header {
    background-color: var(--bg-elev-1) !important;
    border-bottom-color: var(--border-color) !important;
}

/* Alert theme adaptation */
.theme-light .alert {
    background-color: var(--bg-elev-1) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

.theme-dark .alert {
    background-color: var(--bg-elev-1) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

/* Toast theme adaptation */
.theme-light .toast {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

.theme-dark .toast {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

.theme-light .toast-header {
    background-color: var(--bg-elev-1) !important;
    color: var(--text-secondary) !important;
    border-bottom-color: var(--border-color) !important;
}

.theme-dark .toast-header {
    background-color: var(--bg-elev-1) !important;
    color: var(--text-secondary) !important;
    border-bottom-color: var(--border-color) !important;
}

/* Pagination theme adaptation */
.theme-light .page-link {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

.theme-dark .page-link {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

.theme-light .page-item.active .page-link {
    background-color: var(--accent-blue-600) !important;
    border-color: var(--accent-blue-600) !important;
    color: white !important;
}

.theme-dark .page-item.active .page-link {
    background-color: var(--accent-blue-600) !important;
    border-color: var(--accent-blue-600) !important;
    color: white !important;
}

/* List group theme adaptation */
.theme-light .list-group-item {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

.theme-dark .list-group-item {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

/* Badge theme adaptation */
.theme-light .badge {
    color: var(--text-primary) !important;
}

.theme-dark .badge {
    color: var(--text-primary) !important;
}

/* Status chip consistency across all pages */
.status-select.status-active,
.toggle-workflow-public-btn[data-is-public="true"],
.toggle-template-public-btn[data-is-public="true"],
.toggle-public-btn[data-is-public="true"] {
    background-color: #198754 !important;
    border-color: #198754 !important;
    color: white !important;
}

.status-select.status-archived,
.toggle-workflow-public-btn[data-is-public="false"],
.toggle-template-public-btn[data-is-public="false"],
.toggle-public-btn[data-is-public="false"] {
    background-color: #6c757d !important;
    border-color: #6c757d !important;
    color: white !important;
}

.status-select.status-unset {
    color: #6c757d !important;
    font-weight: normal;
}

/* Text utility classes theme adaptation */
.theme-light .text-muted {
    color: var(--text-muted) !important;
}

.theme-dark .text-muted {
    color: var(--text-muted) !important;
}

/* Border utility classes theme adaptation */
.theme-light .border {
    border-color: var(--border-color) !important;
}

.theme-dark .border {
    border-color: var(--border-color) !important;
}

/* Background utility classes theme adaptation */
.theme-light .bg-light {
    background-color: var(--bg-elev-2) !important;
}

.theme-dark .bg-light {
    background-color: var(--bg-elev-2) !important;
}

.theme-light .bg-dark {
    background-color: var(--bg-elev-1) !important;
}

.theme-dark .bg-dark {
    background-color: var(--bg-elev-1) !important;
}

/* Ensure proper contrast for accessibility */
.theme-light * {
    color-scheme: light;
}

.theme-dark * {
    color-scheme: dark;
}

/* Focus states for accessibility */
.theme-light *:focus-visible {
    outline-color: var(--accent-blue-600) !important;
}

.theme-dark *:focus-visible {
    outline-color: var(--accent-blue-600) !important;
}

/* Radio button and checkbox styling for proper contrast in both themes */
/* Light mode - use black for selected state */
.theme-light .form-check-input[type="radio"]:checked {
    background-color: #000000 !important;
    border-color: #000000 !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='2' fill='%23ffffff'/%3e%3c/svg%3e") !important;
}

.theme-light .form-check-input[type="radio"]:not(:checked) {
    border-color: var(--border-color) !important;
    background-color: var(--bg-card) !important;
}

.theme-light .form-check-input[type="radio"]:focus {
    border-color: var(--accent-blue-600) !important;
    box-shadow: 0 0 0 0.2rem rgba(26, 115, 232, 0.25) !important;
}

/* Light mode - checkboxes */
.theme-light .form-check-input[type="checkbox"]:checked {
    background-color: #000000 !important;
    border-color: #000000 !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e") !important;
}

.theme-light .form-check-input[type="checkbox"]:not(:checked) {
    border-color: var(--border-color) !important;
    background-color: var(--bg-card) !important;
}

.theme-light .form-check-input[type="checkbox"]:focus {
    border-color: var(--accent-blue-600) !important;
    box-shadow: 0 0 0 0.2rem rgba(26, 115, 232, 0.25) !important;
}

/* Dark mode - use white for selected state */
.theme-dark .form-check-input[type="radio"]:checked {
    background-color: #ffffff !important;
    border-color: #ffffff !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='2' fill='%23000000'/%3e%3c/svg%3e") !important;
}

.theme-dark .form-check-input[type="radio"]:not(:checked) {
    border-color: var(--border-color) !important;
    background-color: var(--bg-card) !important;
}

.theme-dark .form-check-input[type="radio"]:focus {
    border-color: var(--accent-blue-600) !important;
    box-shadow: 0 0 0 0.2rem rgba(26, 115, 232, 0.25) !important;
}

/* Dark mode - checkboxes */
.theme-dark .form-check-input[type="checkbox"]:checked {
    background-color: #ffffff !important;
    border-color: #ffffff !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23000000' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e") !important;
}

.theme-dark .form-check-input[type="checkbox"]:not(:checked) {
    border-color: var(--border-color) !important;
    background-color: var(--bg-card) !important;
}

.theme-dark .form-check-input[type="checkbox"]:focus {
    border-color: var(--accent-blue-600) !important;
    box-shadow: 0 0 0 0.2rem rgba(26, 115, 232, 0.25) !important;
}

/* Hover states for better interactivity */
.theme-light .form-check-input:hover {
    border-color: var(--accent-blue-600) !important;
}

.theme-dark .form-check-input:hover {
    border-color: var(--accent-blue-600) !important;
}

/* Ensure proper sizing and spacing */
.form-check-input {
    width: 1.2em !important;
    height: 1.2em !important;
    margin-top: 0.1em !important;
}

/* Form check label styling */
.form-check-label {
    cursor: pointer;
    user-select: none;
}

.theme-light .form-check-label {
    color: var(--text-primary) !important;
}

.theme-dark .form-check-label {
    color: var(--text-primary) !important;
}

/* Form control focus states */
.theme-light .form-control:focus,
.theme-light .form-select:focus {
    border-color: var(--accent-blue-600) !important;
    box-shadow: 0 0 0 0.2rem rgba(26, 115, 232, 0.25) !important;
}

.theme-dark .form-control:focus,
.theme-dark .form-select:focus {
    border-color: var(--accent-blue-600) !important;
    box-shadow: 0 0 0 0.2rem rgba(26, 115, 232, 0.25) !important;
}

/* Sidebar Theme Section - Positioned at Bottom Right */
.sidebar-theme-section {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 16px;
    box-shadow: none;
}

.theme-section-header {
    margin-bottom: 12px;
    text-align: center;
}

.theme-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.theme-buttons-container {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.theme-buttons-container .theme-btn {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-elev-2);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 14px;
}

.theme-buttons-container .theme-btn:hover {
    background-color: color-mix(in oklab, var(--accent-primary) 25%, transparent);
    color: var(--text-primary);
    border-color: color-mix(in oklab, var(--accent-primary) 40%, var(--border-color));
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.theme-buttons-container .theme-btn.active {
    background-color: color-mix(in oklab, var(--accent-primary) 65%, transparent);
    color: var(--text-primary);
    border-color: color-mix(in oklab, var(--accent-primary) 80%, var(--border-color));
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.theme-buttons-container .theme-btn.active:hover {
    background-color: color-mix(in oklab, var(--accent-primary) 75%, transparent);
    border-color: color-mix(in oklab, var(--accent-primary) 85%, var(--border-color));
}

/* Ensure sidebar has relative positioning for absolute positioning of theme section */
.sidebar {
    position: relative;
}

/* Mobile responsiveness for theme section */
@media (max-width: 768px) {
    .sidebar-theme-section {
        position: relative;
        bottom: auto;
        left: auto;
        right: auto;
        margin-top: 20px;
        margin-left: 16px;
        margin-right: 16px;
    }
}

/* Admin Panel Dashboard Cards - Theme Aware Styling */
.admin-dashboard-card {
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.admin-dashboard-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Users Card */
.admin-dashboard-card.users-card {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-blue-600));
    color: #ffffff;
    border-color: var(--accent-blue-600);
}

.theme-light .admin-dashboard-card.users-card {
    background: linear-gradient(135deg, #e3f2fd, #1a73e8);
    color: #ffffff;
}

.theme-dark .admin-dashboard-card.users-card {
    background: linear-gradient(135deg, #bbdefb, #1a73e8);
    color: #ffffff;
}

/* Workflows Card */
.admin-dashboard-card.workflows-card {
    background: linear-gradient(135deg, var(--accent-tertiary), var(--accent-success));
    color: #ffffff;
    border-color: var(--accent-success);
}

.theme-light .admin-dashboard-card.workflows-card {
    background: linear-gradient(135deg, #e8f5e8, #198754);
    color: #ffffff;
}

.theme-dark .admin-dashboard-card.workflows-card {
    background: linear-gradient(135deg, #c8e6c9, #198754);
    color: #ffffff;
}

/* Prompt Lists Card */
.admin-dashboard-card.prompt-lists-card {
    background: linear-gradient(135deg, var(--accent-secondary), var(--accent-purple-600));
    color: #ffffff;
    border-color: var(--accent-purple-600);
}

.theme-light .admin-dashboard-card.prompt-lists-card {
    background: linear-gradient(135deg, #f3e5f5, #7b1fa2);
    color: #ffffff;
}

.theme-dark .admin-dashboard-card.prompt-lists-card {
    background: linear-gradient(135deg, #e1bee7, #7b1fa2);
    color: #ffffff;
}

/* Public Lists Card */
.admin-dashboard-card.public-lists-card {
    background: linear-gradient(135deg, var(--accent-tertiary), #ff9800);
    color: #ffffff;
    border-color: #ff9800;
}

.theme-light .admin-dashboard-card.public-lists-card {
    background: linear-gradient(135deg, #fff3e0, #ff9800);
    color: #ffffff;
}

.theme-dark .admin-dashboard-card.public-lists-card {
    background: linear-gradient(135deg, #ffe0b2, #ff9800);
    color: #ffffff;
}

/* Admin Panel Card Headers - Theme Aware */
.admin-panel-card-header {
    background: var(--bg-elev-1) !important;
    color: var(--text-primary) !important;
    border-bottom: 1px solid var(--border-color) !important;
}

/* Admin Panel Card Bodies - Theme Aware */
.admin-panel-card-body {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

/* Admin Panel Tables - Enhanced Theme Support */
.admin-panel-table {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

.admin-panel-table thead th {
    background: var(--bg-elev-1) !important;
    color: var(--text-primary) !important;
    border-bottom: 2px solid var(--border-color) !important;
}

.admin-panel-table tbody td {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

/* Admin Panel Buttons - Theme Aware */
.admin-panel-btn {
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.admin-panel-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Ensure text readability in all themes */
.admin-dashboard-card .card-title {
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.admin-dashboard-card .display-4 {
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {
    .admin-dashboard-card {
        margin-bottom: 1rem;
    }
    
    .admin-dashboard-card .display-4 {
        font-size: 2.5rem;
    }
}

/* Random Theme Comprehensive Coverage */
/* Ensure random theme colors are applied to ALL elements */

/* HTML and body background override for random themes - FORCE APPLICATION */
body.theme-randomized {
    background-color: var(--bg-primary) !important;
    background: linear-gradient(to bottom, var(--bg-primary), var(--bg-elev-2)) !important;
}

.theme-randomized html,
.theme-randomized body {
    background-color: var(--bg-primary) !important;
    background: var(--bg-primary) !important;
}

/* Force main wrapper background */
body.theme-randomized .main-wrapper {
    background: linear-gradient(to bottom, var(--bg-primary), var(--bg-elev-2)) !important;
}

/* Container and layout elements */
.theme-randomized .container,
.theme-randomized .container-fluid,
.theme-randomized .row,
.theme-randomized .col,
.theme-randomized [class*="col-"] {
    background-color: transparent !important;
}

/* All div elements (with exceptions for specific components) */
.theme-randomized div:not([class*="btn"]):not([class*="dropdown"]):not([class*="modal"]):not([class*="toast"]):not([class*="alert"]):not([class*="popover"]):not([class*="tooltip"]) {
    background-color: transparent !important;
}

/* Semantic HTML elements */
.theme-randomized section,
.theme-randomized article,
.theme-randomized aside,
.theme-randomized main,
.theme-randomized header:not(.top-header),
.theme-randomized footer {
    background-color: transparent !important;
}

/* Override ALL white/light background utility classes */
.theme-randomized .bg-white,
.theme-randomized .bg-light,
.theme-randomized .bg-body,
.theme-randomized .bg-body-secondary,
.theme-randomized .bg-body-tertiary,
.theme-randomized .bg-transparent {
    background-color: var(--bg-card) !important;
    background: var(--bg-card) !important;
}

/* Override inline styles with white backgrounds */
.theme-randomized *[style*="background-color: white"],
.theme-randomized *[style*="background-color: #fff"],
.theme-randomized *[style*="background-color: #ffffff"],
.theme-randomized *[style*="background: white"],
.theme-randomized *[style*="background: #fff"],
.theme-randomized *[style*="background: #ffffff"],
.theme-randomized *[bgcolor="white"],
.theme-randomized *[bgcolor="#fff"],
.theme-randomized *[bgcolor="#ffffff"] {
    background-color: var(--bg-card) !important;
    background: var(--bg-card) !important;
}

/* Table comprehensive coverage */
.theme-randomized .table,
.theme-randomized .table-responsive,
.theme-randomized .table-wrapper,
.theme-randomized table {
    background-color: var(--bg-card) !important;
}

.theme-randomized .table thead,
.theme-randomized .table thead th,
.theme-randomized table thead,
.theme-randomized table thead th {
    background-color: var(--bg-elev-1) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

.theme-randomized .table tbody,
.theme-randomized .table tbody td,
.theme-randomized .table tbody tr,
.theme-randomized table tbody,
.theme-randomized table tbody td,
.theme-randomized table tbody tr {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

/* Remove ALL table hover effects */
.theme-randomized .table tbody tr:hover,
.theme-randomized .table-hover tbody tr:hover,
.theme-randomized .table tbody tr:hover td,
.theme-randomized .table-hover tbody tr:hover td,
.theme-randomized table tbody tr:hover,
.theme-randomized table tbody tr:hover td {
    background-color: var(--bg-card) !important;
}

/* Content areas and wrappers */
.theme-randomized .content,
.theme-randomized .content-area,
.theme-randomized .main-area,
.theme-randomized .page-content,
.theme-randomized .wrapper,
.theme-randomized .inner-wrapper {
    background-color: transparent !important;
}

/* Panel and widget elements */
.theme-randomized .panel,
.theme-randomized .widget,
.theme-randomized .component,
.theme-randomized .box,
.theme-randomized .section {
    background-color: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}

/* Spacer and separator elements */
.theme-randomized .spacer,
.theme-randomized .separator,
.theme-randomized .divider,
.theme-randomized hr {
    background-color: transparent !important;
    border-color: var(--border-color) !important;
}

/* List elements */
.theme-randomized ul,
.theme-randomized ol,
.theme-randomized li {
    background-color: transparent !important;
}

/* Paragraph and text elements */
.theme-randomized p,
.theme-randomized span,
.theme-randomized label,
.theme-randomized small {
    background-color: transparent !important;
    color: var(--text-primary) !important;
}

/* Heading elements */
.theme-randomized h1,
.theme-randomized h2,
.theme-randomized h3,
.theme-randomized h4,
.theme-randomized h5,
.theme-randomized h6 {
    background-color: transparent !important;
    color: var(--text-primary) !important;
}

/* Image and media containers */
.theme-randomized .img-container,
.theme-randomized .media-container,
.theme-randomized figure {
    background-color: transparent !important;
}

/* Form group and field containers */
.theme-randomized .form-group,
.theme-randomized .form-field,
.theme-randomized .input-group,
.theme-randomized .field-wrapper {
    background-color: transparent !important;
}

/* Button group containers */
.theme-randomized .btn-group,
.theme-randomized .btn-toolbar {
    background-color: transparent !important;
}

/* Navigation elements */
.theme-randomized .nav,
.theme-randomized .navbar-nav,
.theme-randomized .breadcrumb {
    background-color: transparent !important;
}

/* Progress and status elements */
.theme-randomized .progress,
.theme-randomized .progress-bar {
    background-color: var(--bg-elev-1) !important;
    border-color: var(--border-color) !important;
}

/* Accordion and collapse elements */
.theme-randomized .accordion,
.theme-randomized .accordion-item,
.theme-randomized .collapse {
    background-color: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}

/* Tab content areas */
.theme-randomized .tab-content,
.theme-randomized .tab-pane {
    background-color: var(--bg-card) !important;
}

/* Offcanvas elements */
.theme-randomized .offcanvas,
.theme-randomized .offcanvas-body {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

/* Carousel elements */
.theme-randomized .carousel,
.theme-randomized .carousel-inner,
.theme-randomized .carousel-item {
    background-color: transparent !important;
}

/* Nuclear option - catch absolutely everything */
.theme-randomized *:not(.btn):not([class*="btn-"]):not(.dropdown-menu):not(.modal):not(.toast):not(.alert):not(.popover):not(.tooltip) {
    border-color: var(--border-color) !important;
}

/* COMPREHENSIVE COVERAGE - Ensure consistent theme application across ALL pages */
/* Override Bootstrap CSS custom properties for complete coverage */
.theme-randomized {
    --bs-body-bg: var(--bg-primary) !important;
    --bs-body-color: var(--text-primary) !important;
    --bs-secondary-bg: var(--bg-elev-1) !important;
    --bs-tertiary-bg: var(--bg-elev-2) !important;
    --bs-border-color: var(--border-color) !important;
    --bs-table-bg: var(--bg-card) !important;
    --bs-table-color: var(--text-primary) !important;
    --bs-table-border-color: var(--border-color) !important;
}

/* Force override ALL Bootstrap utility classes */
.theme-randomized .bg-white,
.theme-randomized .bg-light,
.theme-randomized .bg-secondary,
.theme-randomized .bg-body,
.theme-randomized .bg-body-secondary,
.theme-randomized .bg-body-tertiary,
.theme-randomized .bg-transparent,
.theme-randomized .table-light,
.theme-randomized .table-secondary {
    background-color: var(--bg-card) !important;
    background: var(--bg-card) !important;
}

/* Comprehensive element targeting for ALL pages - FORCE APPLICATION */
body.theme-randomized .card,
body.theme-randomized .card-body,
body.theme-randomized .panel,
body.theme-randomized .box,
body.theme-randomized .table,
body.theme-randomized .table-responsive,
body.theme-randomized .workflows-table-wrap,
body.theme-randomized .prompt-templates-table-wrap,
body.theme-randomized .modal-content,
body.theme-randomized .dropdown-menu,
body.theme-randomized .toast,
body.theme-randomized .alert,
body.theme-randomized .list-group-item,
body.theme-randomized .accordion-item,
body.theme-randomized .tab-content,
body.theme-randomized .tab-pane,
body.theme-randomized .offcanvas,
body.theme-randomized .page-link {
    background-color: var(--bg-card) !important;
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

/* SUPER AGGRESSIVE TABLE CONTAINER TARGETING */
body.theme-randomized .card .card-body,
body.theme-randomized .card .table-responsive,
body.theme-randomized .card .workflows-table-wrap,
body.theme-randomized .card .prompt-templates-table-wrap,
body.theme-randomized .filters-card,
body.theme-randomized .filters-card .card-body {
    background-color: var(--bg-card) !important;
    background: var(--bg-card) !important;
}

.theme-randomized .card,
.theme-randomized .card-body,
.theme-randomized .panel,
.theme-randomized .box,
.theme-randomized .table,
.theme-randomized .modal-content,
.theme-randomized .dropdown-menu,
.theme-randomized .toast,
.theme-randomized .alert,
.theme-randomized .list-group-item,
.theme-randomized .accordion-item,
.theme-randomized .tab-content,
.theme-randomized .tab-pane,
.theme-randomized .offcanvas,
.theme-randomized .page-link {
    background-color: var(--bg-card) !important;
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

/* Headers, footers, and elevated surfaces */
.theme-randomized .card-header,
.theme-randomized .card-footer,
.theme-randomized .table thead th,
.theme-randomized .modal-header,
.theme-randomized .modal-footer,
.theme-randomized .top-header,
.theme-randomized .sidebar,
.theme-randomized nav.sidebar,
.theme-randomized input,
.theme-randomized textarea,
.theme-randomized select,
.theme-randomized .form-control,
.theme-randomized .form-select,
.theme-randomized .nav-tabs .nav-link,
.theme-randomized .progress,
.theme-randomized .progress-bar {
    background-color: var(--bg-elev-1) !important;
    background: var(--bg-elev-1) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

.theme-randomized .nav-tabs .nav-link.active {
    color: var(--accent-primary) !important;
    background: linear-gradient(135deg, var(--bg-card) 0%, color-mix(in oklab, var(--accent-primary) 12%, var(--bg-card)) 50%, color-mix(in oklab, var(--accent-primary) 6%, var(--bg-card)) 100%) !important;
    border-color: var(--accent-primary) var(--accent-primary) var(--bg-card) !important;
    border-width: 3px 3px 1px !important;
    font-weight: 600 !important;
    box-shadow: 0 -2px 8px color-mix(in oklab, var(--accent-primary) 20%, transparent) !important;
}

/* Fix dropdown chevrons visibility in randomized theme - Light mode base */
.theme-light.theme-randomized .form-select,
.theme-light.theme-randomized select.form-select,
.theme-light.theme-randomized select.form-select-sm {
    background-color: var(--bg-elev-1) !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23000000' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m1 6 7 7 7-7'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.75rem center !important;
    background-size: 16px 12px !important;
    padding-right: 2.25rem !important;
}

.theme-light.theme-randomized .dropdown-toggle::after {
    color: #000000 !important;
    border-top-color: #000000 !important;
}

.theme-light.theme-randomized select:not(.form-select) {
    background-color: var(--bg-elev-1) !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23000000' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m1 6 7 7 7-7'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.75rem center !important;
    background-size: 16px 12px !important;
    padding-right: 2.25rem !important;
}

/* Fix dropdown chevrons visibility in randomized theme - Dark mode base */
.theme-dark.theme-randomized .form-select,
.theme-dark.theme-randomized select.form-select,
.theme-dark.theme-randomized select.form-select-sm {
    background-color: var(--bg-elev-1) !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m1 6 7 7 7-7'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.75rem center !important;
    background-size: 16px 12px !important;
    padding-right: 2.25rem !important;
}

.theme-dark.theme-randomized .dropdown-toggle::after {
    color: #ffffff !important;
    border-top-color: #ffffff !important;
}

.theme-dark.theme-randomized select:not(.form-select) {
    background-color: var(--bg-elev-1) !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m1 6 7 7 7-7'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.75rem center !important;
    background-size: 16px 12px !important;
    padding-right: 2.25rem !important;
}

/* Ensure text colors are consistent */
.theme-randomized .text-dark {
    color: var(--text-primary) !important;
}

/* Preserve status colors in randomized theme */
.theme-randomized .status-select.status-active,
.theme-randomized .toggle-workflow-public-btn[data-is-public="true"],
.theme-randomized .toggle-template-public-btn[data-is-public="true"],
.theme-randomized .toggle-public-btn[data-is-public="true"] {
    background-color: #198754 !important;
    border-color: #198754 !important;
    color: white !important;
}

.theme-randomized .status-select.status-archived,
.theme-randomized .toggle-workflow-public-btn[data-is-public="false"],
.theme-randomized .toggle-template-public-btn[data-is-public="false"],
.theme-randomized .toggle-public-btn[data-is-public="false"] {
    background-color: #6c757d !important;
    border-color: #6c757d !important;
    color: white !important;
}

.theme-randomized .status-select.status-unset {
    background-color: var(--bg-elev-1) !important;
    color: #6c757d !important;
    border-color: var(--border-color) !important;
    font-weight: normal !important;
}

.theme-randomized .text-muted {
    color: var(--text-muted) !important;
}

.theme-randomized .text-secondary {
    color: var(--text-secondary) !important;
}

.theme-randomized .text-light {
    color: var(--text-secondary) !important;
}

/* Override any inline styles that might interfere */
.theme-randomized *[style*="background-color: white"],
.theme-randomized *[style*="background-color: #fff"],
.theme-randomized *[style*="background-color: #ffffff"],
.theme-randomized *[style*="background: white"],
.theme-randomized *[style*="background: #fff"],
.theme-randomized *[style*="background: #ffffff"] {
    background-color: var(--bg-card) !important;
    background: var(--bg-card) !important;
}
