/* Django Unfold Admin Theming Overrides - STATIC CSS (Targeted Approach) */

/* Hide breadcrumbs */
ul.flex li {
    visibility: hidden !important;
}

/* Hide Django Unfold breadcrumb navigation h1 */
h1.overflow-hidden.leading-5.text-ellipsis,
h1[class*="text-font-important-light"],
h1[class*="whitespace-nowrap"] {
    display: none !important;
}

/* More specific: Hide h1 that contains navigation links with chevron icons */
h1.overflow-hidden:has(a) {
    display: none !important;
}

/* Fallback for browsers without :has() support */
h1.overflow-hidden.leading-5 {
    display: none !important;
}

/* TARGETED FONT OVERRIDE - Only text elements, not icons */
body,
html,
.font-inter,
input, textarea, select, button,
h1, h2, h3, h4, h5, h6,
p, span:not([class*="material-"]):not([class*="icon"]),
div:not([class*="icon"]),
a:not([class*="icon"]),
li:not([class*="icon"]),
td, th,
label,
.form-control,
.sidebar a,
.nav-link,
.breadcrumb {
    font-family: 'Courier New', monospace !important;
}

/* TEXT COLOR - Use primary text color for all text */
body,
html,
h1, h2, h3, h4, h5, h6,
p, span:not([class*="material-"]):not([class*="icon"]),
div:not([class*="icon"]),
a:not([class*="icon"]),
li:not([class*="icon"]),
td, th,
label,
.form-control,
.sidebar a,
.nav-link,
.breadcrumb,
.text-gray-900,
.text-gray-800,
.text-gray-700,
.text-gray-600,
.text-gray-500 {
    color: var(--theme-primary-text) !important;
}

/* Static fallback theme colors */
:root {
    --theme-primary: #ffed00;
    --theme-primary-hover: #edda02;
    --theme-primary-text: #000000;
    --theme-button-text: #000000;
    --theme-primary-error: #ef4444;
    --theme-primary-success: #10b981;
    --theme-primary-field: #ffed00;
}

/* PRIMARY COLOR BUTTONS */
.bg-primary-600,
.bg-primary-500,
.bg-primary-700,
button[type="submit"],
.btn-primary,
input[type="submit"],
.button,
.submit-row input,
[class*="bg-primary-"] {
    background-color: var(--theme-primary) !important;
    border-color: var(--theme-primary) !important;
}

/* HOVER STATES */
.bg-primary-600:hover,
.bg-primary-500:hover,
.bg-primary-700:hover,
button[type="submit"]:hover,
.btn-primary:hover,
input[type="submit"]:hover,
.button:hover,
[class*="bg-primary-"]:hover,
nav a:hover,
nav button:hover,
.sidebar a:hover,
.sidebar button:hover,
.nav-link:hover,
.menu-item:hover {
    background-color: var(--theme-primary-hover) !important;
    color: var(--theme-primary-text) !important;
}

/* ACTIVE/CLICKED STATES - Target containers, not child elements */
.active,
.selected,
.current,
[aria-selected="true"],
[aria-current="page"],
.bg-primary-100,
.bg-primary-50,
.bg-gray-100,
nav .active,
.sidebar .active,
.nav-item.active,
.nav-link.active,
.tab.active,
.menu-item.active,
li.active,
tr.selected,
.row-selected,
button:active,
.btn:active {
    background-color: var(--theme-primary) !important;
}

/* Active state text color - target text elements within active containers */
.active span:not([class*="material-"]):not([class*="icon"]),
.selected span:not([class*="material-"]):not([class*="icon"]),
.current span:not([class*="material-"]):not([class*="icon"]),
[aria-selected="true"] span:not([class*="material-"]):not([class*="icon"]),
[aria-current="page"] span:not([class*="material-"]):not([class*="icon"]),
.bg-gray-100 span:not([class*="material-"]):not([class*="icon"]),
nav .active span:not([class*="material-"]):not([class*="icon"]),
.sidebar .active span:not([class*="material-"]):not([class*="icon"]),
.nav-item.active span:not([class*="material-"]):not([class*="icon"]),
.nav-link.active span:not([class*="material-"]):not([class*="icon"]),
.tab.active span:not([class*="material-"]):not([class*="icon"]),
.menu-item.active span:not([class*="material-"]):not([class*="icon"]),
li.active span:not([class*="material-"]):not([class*="icon"]),
button:active span:not([class*="material-"]):not([class*="icon"]),
.btn:active span:not([class*="material-"]):not([class*="icon"]) {
    color: var(--theme-primary-text) !important;
}

/* Override Tailwind text-primary-* classes */
.text-primary-600,
.text-primary-500,
.text-primary-700 {
    color: var(--theme-primary-text) !important;
}

/* PRIMARY TEXT COLORS */
.text-primary-600,
.text-primary-500,
.text-primary-700,
a.text-primary-600,
[class*="text-primary-"] {
    color: var(--theme-primary-text) !important;
}

/* BORDER COLORS */
.border-primary-600,
.border-primary-500,
.border-primary-700,
[class*="border-primary-"] {
    border-color: var(--theme-primary) !important;
}

/* FOCUS STATES */
input:focus,
textarea:focus,
select:focus,
.focus\:ring-primary-500:focus,
.focus\:ring-primary-600:focus,
.focus\:border-primary-500:focus,
.focus\:border-primary-600:focus {
    border-color: var(--theme-primary) !important;
    box-shadow: 0 0 0 2px var(--theme-primary) !important;
}

/* FORM ELEMENTS */
input[type="checkbox"]:checked,
input[type="radio"]:checked {
    background-color: var(--theme-primary) !important;
    border-color: var(--theme-primary) !important;
}

/* TABLE ROW HOVER */
tr:hover,
.table-row:hover,
.list-row:hover {
    background-color: rgba(255, 237, 0, 0.1) !important;
}

/* COMPREHENSIVE TEXT COLOR OVERRIDES */
/* Override any remaining yellow/primary colors that show as yellow */
[class*="text-yellow"],
.text-yellow-400,
.text-yellow-500,
.text-yellow-600,
[class*="text-amber"],
.text-amber-400,
.text-amber-500,
.text-amber-600,
/* Admin list items and links */
.admin-list li a,
.changelist-results tr a,
.field-box a,
.module a,
.dashboard-module a,
/* Form field labels and content */
.form-row label,
.field label,
.inline-group .tabular td,
.inline-group .tabular th,
/* Navigation and sidebar */
.breadcrumbs a,
.module h2 a,
.section h2 a,
/* Any remaining primary-colored text */
[style*="color: rgb(255, 237, 0)"] {
    color: var(--theme-primary-text) !important;
}

/* Override button text colors to ensure proper contrast */
.bg-primary-600 span,
.bg-primary-500 span,
.bg-primary-700 span,
button[type="submit"] span,
.btn-primary span,
input[type="submit"] span,
.button span,
.submit-row input span,
[class*="bg-primary-"] span {
    color: var(--theme-button-text) !important;
}

/* AGGRESSIVE UNFOLD ADMIN OVERRIDES */
/* Target ALL Unfold admin text elements */
/* Forms and inputs */
.form-row,
.form-group,
.field-box,
.inline-group,
.module,
.dashboard-module,
/* Tables and lists */
.results,
.changelist,
.changelist-results,
.changelist-results tbody tr,
.changelist-results tbody td,
.changelist-results tbody th,
.changelist-results thead th,
.action-checkbox-column,
/* Form fields */
.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="tel"],
input[type="search"],
textarea,
select,
/* Labels and help text */
.control-label,
.form-label,
.help-block,
.help-text,
.form-help,
/* Navigation */
.nav-sidebar,
.nav-sidebar a,
.nav-sidebar li,
.sidebar-nav,
.sidebar-nav a,
.sidebar-nav li,
/* Content areas */
.content,
.main-content,
.content-wrapper,
.admin-content,
/* Remove universal selector - too aggressive */

/* UNFOLD SPECIFIC CLASS OVERRIDES */
/* Override Unfold's text color utilities */
.text-slate-500,
.text-slate-600,
.text-slate-700,
.text-slate-800,
.text-slate-900,
.text-gray-500,
.text-gray-600,
.text-gray-700,
.text-gray-800,
.text-gray-900,
.text-zinc-500,
.text-zinc-600,
.text-zinc-700,
.text-zinc-800,
.text-zinc-900,
.text-neutral-500,
.text-neutral-600,
.text-neutral-700,
.text-neutral-800,
.text-neutral-900,
.text-stone-500,
.text-stone-600,
.text-stone-700,
.text-stone-800,
.text-stone-900,
/* Unfold primary colors that might appear yellow */
.text-primary,
.text-primary-500,
.text-primary-600,
.text-primary-700,
.text-primary-800,
.text-primary-900,
/* Any remaining primary text classes */
[class*="text-primary"],
[class*="text-gray"],
[class*="text-slate"],
[class*="text-zinc"],
[class*="text-neutral"],
[class*="text-stone"] {
    color: var(--theme-primary-text) !important;
}

/* FORM SPECIFIC OVERRIDES */
/* Target form labels, inputs, and help text */
.form-row label,
.form-group label,
.field label,
.control-label,
.form-label,
.fieldBox label,
.form-field label,
.inline-related label,
.inline-group label,
/* Input fields */
.form-control,
.form-input,
.admin-input,
.vTextField,
.vLargeTextField,
.vDateField,
.vTimeField,
.vURLField,
/* Select dropdowns */
select.form-control,
select.admin-select,
.select2-container,
.select2-selection,
/* Help and error text */
.help-text,
.form-text,
.error-text,
.field-help,
.help-block,
.form-help {
    color: var(--theme-primary-text) !important;
}

/* TABLE SPECIFIC OVERRIDES */
/* Target all table content */
table,
table tr,
table td,
table th,
.changelist-results,
.changelist-results tr,
.changelist-results td,
.changelist-results th,
.results table,
.results tr,
.results td,
.results th,
/* Table links */
table a,
.changelist-results a,
.results a,
td a,
th a {
    color: var(--theme-primary-text) !important;
}

/* NAVIGATION OVERRIDES */
/* Sidebar and navigation */
.nav,
.nav a,
.nav li,
.sidebar,
.sidebar a,
.sidebar li,
.nav-sidebar,
.nav-sidebar a,
.nav-sidebar li,
.menu,
.menu a,
.menu li,
/* Breadcrumbs */
.breadcrumb,
.breadcrumb a,
.breadcrumb li,
.breadcrumbs,
.breadcrumbs a,
.breadcrumbs li {
    color: var(--theme-primary-text) !important;
}

/* RESTORE PROPER BUTTON COLORS */
/* Error/Delete buttons - should be white text on red background */
.btn-danger,
.btn-delete,
.delete-button,
.error-button,
[class*="bg-red"],
[class*="bg-danger"],
[class*="bg-error"],
.bg-primary-error-color,
button[class*="error"],
button[class*="delete"],
button[class*="danger"] {
    color: white !important;
    background-color: var(--theme-primary-error) !important;
}

/* Success buttons - should be white text on green background */
.btn-success,
.success-button,
[class*="bg-green"],
[class*="bg-success"],
.bg-primary-success-color,
button[class*="success"] {
    color: white !important;
    background-color: var(--theme-primary-success) !important;
}

/* Primary buttons - should use button-text-color on primary background */
.btn-primary,
.button.default,
.submit-row input,
button[type="submit"],
input[type="submit"],
[class*="bg-primary-field"],
.bg-primary-600,
.bg-primary-500,
.bg-primary-700 {
    color: var(--theme-button-text) !important;
    background-color: var(--theme-primary-field) !important;
}

/* Override yellow text only for specific elements, not buttons */
[style*="color: rgb(255, 237, 0)"],
[style*="color: #fbbf24"],
[style*="color: #f59e0b"],
[style*="color: #d97706"],
[style*="color: #b45309"] {
    color: var(--theme-primary-text) !important;
}

/* Only override yellow/amber classes for non-button elements */
:not(button):not(.btn):not(.button):not(input[type="submit"]) {
    color: var(--theme-primary-text) !important;
}

:not(button):not(.btn):not(.button):not(input[type="submit"])[class*="yellow"],
:not(button):not(.btn):not(.button):not(input[type="submit"])[class*="amber"] {
    color: var(--theme-primary-text) !important;
}

/* ENSURE BUTTONS USE PRIMARY TEXT COLOR, NOT HINT COLOR */
/* Override any buttons that might be using hint/gray colors */
button.text-text-hint-color,
button[class*="text-gray"],
button[class*="text-slate"],
.btn.text-text-hint-color,
.btn[class*="text-gray"],
.btn[class*="text-slate"],
/* Close buttons and modal buttons specifically */
button[onclick*="close"],
button[onclick*="Close"],
button[@click*="close"],
button[@click*="Close"],
.close-button,
.modal-close,
/* Any button with hint color class */
button:not([class*="bg-red"]):not([class*="bg-green"]):not([class*="bg-primary-field"]):not([class*="bg-success"]):not([class*="bg-error"]):not([class*="bg-danger"]) {
    color: var(--theme-primary-text) !important;
}

/* OVERRIDE COMPILED CSS CLASSES */
/* Override text-white to use theme button text color for buttons - with higher specificity */
button.bg-primary-600.text-white,
button.bg-primary-500.text-white,
button.bg-primary-700.text-white,
.bg-primary-600.text-white,
.bg-primary-500.text-white,
.bg-primary-700.text-white,
button.text-white,
.btn.text-white,
input[type="submit"].text-white,
.button.text-white,
button[type="submit"].text-white {
    color: var(--theme-button-text) !important;
}