:root {
    --page-bg: #ffffff;
    --card-bg: #f3f4f6;
    --text-color: #1f2937;
    --border-color: #e5e7eb;
}

body.dark-theme {
    --page-bg: #111827;
    --card-bg: #1f2937;
    --text-color: #f9fafb;
    --border-color: #374151;
}

body {
    background-color: var(--page-bg);
    color: var(--text-color);
}

.q-card {
    background-color: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

body.dark-theme .q-drawer,
body.dark-theme .q-drawer__content {
    background-color: var(--card-bg) !important;
    color: var(--text-color) !important;
}

body.dark-theme .q-drawer .q-btn,
body.dark-theme .q-drawer .q-icon {
    color: var(--text-color) !important;
}

body.dark-theme .q-drawer .q-label {
    color: var(--text-color) !important;
}


body.dark-theme .q-field__label,
body.dark-theme .q-field__native {
    color: var(--text-color) !important;
}

body.dark-theme .q-field__control {
    background-color: var(--card-bg) !important;
}

body.dark-theme {
    background-color: var(--page-bg) !important;
}

body.dark-theme .nicegui-content {
    background-color: var(--page-bg);
    color: var(--text-color);
}

body.dark-theme .card,
body.dark-theme .feature-card {
    background-color: var(--card-bg) !important;
    color: var(--text-color) !important;
    border-color: var(--border-color) !important;
}

body.dark-theme .feature-card:hover {
    border-color: #64748b !important;
}

body.dark-theme .font-display.text-4xl {
    color: var(--text-color) !important;
}

body.dark-theme .nicegui-content .text-base {
    color: #d1d5db !important;
}

body.dark-theme .nav-btn.active {
    background-color: #374151 !important;
    color: var(--text-color) !important;
}

body.dark-theme .nav-btn.active .q-icon {
    color: var(--text-color) !important;
}

body.dark-theme .cal-cell.outside {
    background-color: var(--card-bg) !important;
}

body.dark-theme .cal-cell.outside .cal-num {
    color: #9ca3af !important;
}

body.dark-theme .cal-num {
    color: #d1d5db !important;
}

body.dark-theme .cal-cell.outside .cal-num.today {
    color: var(--text-color) !important;
}

/* Chat dark mode */
body.dark-theme .composer-box {
    background-color: #374151 !important;
}

body.dark-theme .chat-composer {
    background-color: var(--card-bg) !important;
    border-color: var(--border-color) !important;
}

body.dark-theme .bubble-bot {
    background-color: #374151 !important;
    border-color: var(--border-color) !important;
    color: var(--text-color) !important;
}

body.dark-theme .bubble-bot .nicegui-markdown {
    color: var(--text-color) !important;
}

body.dark-theme .chat-heading {
    color: var(--text-color) !important;
}

body.dark-theme .chat-description {
    color: #d1d5db !important;
}

body.dark-theme .chat-input input {
    color: var(--text-color) !important;
}

body.dark-theme .chat-input input::placeholder {
    color: #9ca3af !important;
}

/* Home page pipeline dark mode */
body.dark-theme .pipeline-box {
    background-color: #374151 !important;
}

body.dark-theme .pipeline-box .text-sm {
    color: var(--text-color) !important;
}

body.dark-theme .pipeline-tag {
    background-color: #1f2937 !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-color) !important;
}

/* General dark mode text fixes */
body.dark-theme .nicegui-content {
    color: var(--text-color) !important;
}

body.dark-theme .nicegui-content .font-display,
body.dark-theme .nicegui-content .font-semibold,
body.dark-theme .nicegui-content .font-bold {
    color: var(--text-color) !important;
}

body.dark-theme .nicegui-content .text-sm,
body.dark-theme .nicegui-content .text-base {
    color: #d1d5db !important;
}

/* Override common inline dark text colors */
body.dark-theme .nicegui-content [style*="#00295F"],
body.dark-theme .nicegui-content [style*="#003976"],
body.dark-theme .nicegui-content [style*="#2A3550"],
body.dark-theme .nicegui-content [style*="#55607A"] {
    color: var(--text-color) !important;
}

body.dark-theme .about-text {
    color: var(--text-color) !important;
}

/* View Data team dropdown dark mode */
body.dark-theme .team-select .q-field__native,
body.dark-theme .team-select .q-field__input,
body.dark-theme .team-select .q-field__marginal {
    color: var(--text-color) !important;
}

body.dark-theme .team-select .q-field__label {
    color: #9ca3af !important;
}

/* XGBoost dark mode */
body.dark-theme .q-checkbox__inner {
    color: #9ca3af !important;
}

body.dark-theme .q-checkbox__inner--truthy {
    color: #f0b323 !important;
}

body.dark-theme .xgboost-select .q-field__control {
    background-color: var(--card-bg) !important;
}

body.dark-theme .xgboost-select .q-field__native,
body.dark-theme .xgboost-select .q-field__input,
body.dark-theme .xgboost-select .q-field__marginal {
    color: var(--text-color) !important;
}

body.dark-theme .xgboost-select .q-field__label {
    color: #9ca3af !important;
}

/* Dropdown menu */
body.dark-theme .q-menu {
    background-color: var(--card-bg) !important;
    color: var(--text-color) !important;
}

body.dark-theme .q-item {
    color: var(--text-color) !important;
}

/* Calendar game days dark mode */
body.dark-theme .cal-cell.has-game {
    background-color: #1f2937 !important;
    border-color: #374151 !important;
}

body.dark-theme .cal-cell.has-game:hover {
    background-color: #374151 !important;
}

body.dark-theme .cal-result,
body.dark-theme .cal-opponent,
body.dark-theme .cal-where {
    color: #d1d5db !important;
}

/* Native date input dark mode */
body.dark-theme input[type="date"] {
    color-scheme: dark;
    color: var(--text-color) !important;
}

/* View Data dark mode fixes */

/* Filters and Players headings */
body.dark-theme .vd-filters .vd-title,
body.dark-theme .vd-results .vd-title {
    color: var(--text-color) !important;
}

body.dark-theme .vd-filters .q-field__control {
    background-color: var(--card-bg) !important;
}

body.dark-theme .vd-filters .q-field__native,
body.dark-theme .vd-filters .q-field__input,
body.dark-theme .vd-filters .q-field__marginal {
    color: var(--text-color) !important;
}

body.dark-theme .vd-filters .q-field__label {
    color: #d1d5db !important;
}

body.dark-theme .vd-filters .q-field__control:before {
    border-color: #9ca3af !important;
}


/* Selected column chips */
body.dark-theme .vd-filters .q-chip {
    background-color: #374151 !important;
    color: #f9fafb !important;
}

body.dark-theme .vd-filters .q-chip .q-icon {
    color: #d1d5db !important;
}

/* Filter field borders */
body.dark-theme .vd-filters .q-field__control:before {
    border-color: #9ca3af !important;
}

/* View Data results table dark mode */
body.dark-theme .data-table .q-table__container,
body.dark-theme .data-table .q-table,
body.dark-theme .data-table thead,
body.dark-theme .data-table tbody,
body.dark-theme .data-table tr {
    background-color: var(--card-bg) !important;
    color: var(--text-color) !important;
}

body.dark-theme .data-table th,
body.dark-theme .data-table td {
    background-color: var(--card-bg) !important;
    color: var(--text-color) !important;
    border-color: var(--border-color) !important;
}

body.dark-theme .data-table .q-table__bottom {
    background-color: var(--card-bg) !important;
    color: var(--text-color) !important;
    border-color: var(--border-color) !important;
}

body.dark-theme .data-table .q-icon {
    color: var(--text-color) !important;
}

/* Weather input borders in dark mode */
body.dark-theme .nicegui-content input[type="text"],
body.dark-theme .nicegui-content input[type="date"] {
    border-color: #9ca3af !important;
}

body.dark-theme .nicegui-content .q-field__control:before {
    border-color: #9ca3af !important;
}

/* Prevent calendar game-day flash on initial load */
html[data-theme="dark"] .cal-cell.has-game {
    background-color: #1f2937 !important;
    border-color: #374151 !important;
}

html[data-theme="dark"] .cal-cell.has-game .cal-num,
html[data-theme="dark"] .cal-cell.has-game .cal-result,
html[data-theme="dark"] .cal-cell.has-game .cal-opponent,
html[data-theme="dark"] .cal-cell.has-game .cal-where {
    color: #d1d5db !important;
}
