/* Date picker for dashboard date boxes — static/js/dashboard/date_picker.js.
   Dark rules by hand at the end (not in the dark generator). */

.tdp-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    clip-path: inset(50%) !important;
}

/* The box: looks like the field it replaces (it takes that field's classes);
   these are only fallbacks, at zero weight. */
:where(.tdp-field) {
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    background: #fff;
    color: #1f2937;
    font: inherit;
    font-size: 14px;
}
.tdp-field {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    text-align: left;
    cursor: pointer;
    min-width: 11.5em;
}
.tdp-field.form-control, .tdp-field[class*="input"], .tdp-field[class*="field"] { width: 100%; }
.tdp-field__text { flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tdp-field.is-empty .tdp-field__text { color: #6b7280; }
.tdp-field__ico { flex: none; color: #6b7280; }
.tdp-field:disabled { cursor: not-allowed; opacity: .6; }
.tdp-field:focus-visible { outline: 2px solid var(--brand, #2b5cff); outline-offset: 2px; }
.tdp-field.is-invalid { border-color: #b91c1c !important; box-shadow: 0 0 0 3px rgba(185, 28, 28, .14); }
.tdp-field[hidden] { display: none; }

/* The pop-up */
.tdp-pop {
    position: fixed;
    z-index: 3000;
    width: 296px;
    padding: 12px;
    border: 1px solid #e4e7ec;
    border-radius: 14px;
    background: #fff;
    color: #1f2937;
    box-shadow: 0 16px 40px rgba(16, 24, 40, .16), 0 2px 6px rgba(16, 24, 40, .06);
    font-size: 14px;
}
.tdp-pop[hidden] { display: none; }
.tdp-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.tdp-head select {
    flex: 1 1 auto;
    min-width: 0;
    height: 34px;
    padding: 0 6px;
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    background: #fff;
    color: inherit;
    font: inherit;
    font-weight: 600;
}
.tdp-head .tdp-year { flex: 0 0 76px; }
.tdp-nav {
    flex: none;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: inherit;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
.tdp-nav:hover { background: #f2f4f7; }
.tdp-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.tdp-dow span { padding: 4px 0 6px; text-align: center; color: #667085; font-size: 12px; font-weight: 600; }
.tdp-row > span { display: flex; justify-content: center; }
.tdp-day {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
}
.tdp-day.is-weekend { color: #475467; }
.tdp-day:hover:not(:disabled) { background: #eef2ff; }
.tdp-day.is-today { box-shadow: inset 0 0 0 1.5px var(--brand, #2b5cff); font-weight: 600; }
.tdp-day.is-picked { background: var(--brand, #2b5cff); color: #fff; font-weight: 600; }
.tdp-day:disabled { color: #c0c5ce; cursor: default; text-decoration: line-through; }
.tdp-day:focus-visible, .tdp-nav:focus-visible, .tdp-link:focus-visible, .tdp-head select:focus-visible {
    outline: 2px solid var(--brand, #2b5cff);
    outline-offset: 1px;
}
.tdp-foot { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 8px; border-top: 1px solid #eaecf0; }
.tdp-link {
    padding: 6px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--brand-ink, #1d4ed8);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.tdp-link:hover { background: #f2f4f7; }
.tdp-link[hidden] { display: none; }

html[data-theme="dark"] :where(.tdp-field) { background: #1b2130; border-color: #3a4256; color: #e6e9ef; }
html[data-theme="dark"] .tdp-field.is-empty .tdp-field__text,
html[data-theme="dark"] .tdp-field__ico { color: #9aa3b5; }
html[data-theme="dark"] .tdp-pop { background: #1b2130; border-color: #3a4256; color: #e6e9ef; box-shadow: 0 16px 40px rgba(0, 0, 0, .5); }
html[data-theme="dark"] .tdp-head select { background: #232a3b; border-color: #3a4256; }
html[data-theme="dark"] .tdp-nav:hover, html[data-theme="dark"] .tdp-link:hover { background: #2a3245; }
html[data-theme="dark"] .tdp-dow span, html[data-theme="dark"] .tdp-day.is-weekend { color: #aab2c3; }
html[data-theme="dark"] .tdp-day:hover:not(:disabled) { background: #2a3550; }
html[data-theme="dark"] .tdp-day:disabled { color: #5b6377; }
html[data-theme="dark"] .tdp-day.is-today { box-shadow: inset 0 0 0 1.5px #8fa8ff; }
html[data-theme="dark"] .tdp-day.is-picked { background: #8fa8ff; color: #0f1420; }
html[data-theme="dark"] .tdp-link { color: #a9bdff; }
html[data-theme="dark"] .tdp-foot { border-top-color: #3a4256; }
