/* The SCRAP theme switch: one control, the same in every app (assets/scrap_theme.js).
   The app-specific theme controls that came before it are hidden, so there is exactly
   one place to switch. Palette follows the suite variables where they exist. */

/* native widgets (scrollbars, pickers) follow the theme as well */
html[data-scrap-theme="dark"] { color-scheme: dark; }
html[data-scrap-theme="light"] { color-scheme: light; }

.scrap-theme-switch {
    font: 600 12px/1 Inter, "Segoe UI", system-ui, sans-serif;
    position: fixed;
    right: 14px;
    top: 10px;
    z-index: 2147482000;
}

.scrap-theme-switch.scrap-theme-inline {
    position: relative;
    right: auto;
    top: auto;
}

.scrap-theme-btn {
    align-items: center;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid #d8e5eb;
    border-radius: 999px;
    box-shadow: 0 4px 14px rgba(16, 35, 46, 0.12);
    color: #24405a;
    cursor: pointer;
    display: inline-flex;
    gap: 7px;
    padding: 7px 12px;
}

.scrap-theme-btn:hover {
    border-color: #2369b1;
}

.scrap-theme-caret {
    font-size: 10px;
    opacity: 0.7;
}

.scrap-theme-menu {
    background: #fff;
    border: 1px solid #d8e5eb;
    border-radius: 10px;
    box-shadow: 0 14px 30px rgba(16, 35, 46, 0.18);
    display: none;
    min-width: 136px;
    padding: 5px;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
}

.scrap-theme-switch[data-open="true"] .scrap-theme-menu {
    display: block;
}

.scrap-theme-menu button {
    background: transparent;
    border: 0;
    border-radius: 7px;
    color: #24405a;
    cursor: pointer;
    display: block;
    font: inherit;
    padding: 7px 10px;
    text-align: left;
    width: 100%;
}

.scrap-theme-menu button:hover {
    background: rgba(35, 105, 177, 0.12);
}

.scrap-theme-menu button[aria-checked="true"] {
    color: #2369b1;
    font-weight: 700;
}

[data-scrap-theme="dark"] .scrap-theme-btn {
    background: rgba(23, 46, 56, 0.96);
    border-color: #304a57;
    color: #e0edf3;
}

[data-scrap-theme="dark"] .scrap-theme-btn:hover {
    border-color: #85bddf;
}

[data-scrap-theme="dark"] .scrap-theme-menu {
    background: #172e38;
    border-color: #304a57;
}

[data-scrap-theme="dark"] .scrap-theme-menu button {
    color: #e0edf3;
}

[data-scrap-theme="dark"] .scrap-theme-menu button:hover {
    background: rgba(133, 189, 223, 0.16);
}

[data-scrap-theme="dark"] .scrap-theme-menu button[aria-checked="true"] {
    color: #85bddf;
}

/* Dash 3's own component markup (sliders, inputs, checklists) in dark mode - the same
   in every app, so it lives here rather than in each app's palette. */
html[data-scrap-theme="dark"] .dash-slider-track {
    background: #3a5a68;
}

html[data-scrap-theme="dark"] .dash-slider-range {
    background: #85bddf;
}

html[data-scrap-theme="dark"] .dash-slider-mark,
html[data-scrap-theme="dark"] .dash-slider-mark-outside-selection {
    color: #b4c7d1;
}

html[data-scrap-theme="dark"] .dash-slider-tooltip {
    background: #24434f;
    border-color: #3a5a68;
    color: #ffffff;
}

html[data-scrap-theme="dark"] .dash-slider-thumb {
    border-color: #e0edf3;
}

html[data-scrap-theme="dark"] .dash-input,
html[data-scrap-theme="dark"] input.dash-input {
    background: #1b3440;
    border-color: #3a5a68;
    color: #ffffff;
}

html[data-scrap-theme="dark"] .dash-options-list-option label,
html[data-scrap-theme="dark"] .dash-checklist label,
html[data-scrap-theme="dark"] .dash-radioitems label {
    color: #e0edf3;
}

html[data-scrap-theme="dark"] .dash-datepicker input,
html[data-scrap-theme="dark"] .SingleDatePickerInput,
html[data-scrap-theme="dark"] .DateInput_input {
    background: #1b3440;
    color: #ffffff;
}

/* the controls this one replaces */
#app-root .theme-switcher,
#app-body .theme-toggle-wrapper {
    display: none !important;
}

html.scrap-mini .scrap-theme-switch {
    display: none;
}

@media print {
    .scrap-theme-switch { display: none; }
}
