/* rq.Window and rq.TabStrip — the shells that replace Kendo's Window and
 * TabStrip. Built on the rq-* tokens; the window shares its look with the
 * grid editor modal in rq-grid.css so every dialog in the app reads the same.
 */

/* --------------------------------------------------------------- window */

.rq-window {
    position: fixed;
    inset: 0;
    z-index: 10200;              /* above Kendo's Window while both coexist */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.rq-window[hidden] { display: none; }

.rq-window-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.55); }

.rq-window-dialog {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(700px, 100%);      /* overridden inline from the declaration */
    max-width: 100%;
    max-height: 100%;
    background: var(--rq-surface-raised);
    color: var(--rq-text);
    border: 1px solid var(--rq-border);
    border-radius: 12px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
    overflow: hidden;
}

/* A declared height is a maximum, not a demand: a 700px window on a 720px
   screen must still fit, and a short window must not stretch. */
.rq-window-dialog[style*="height"] { max-height: 100%; }

.rq-window-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--rq-border);
    flex: 0 0 auto;
}
.rq-window-title { margin: 0; font-size: 15px; font-weight: 600; }
.rq-window-actions { display: flex; gap: 4px; }
.rq-window-actions button {
    border: 0; background: none; color: var(--rq-sub);
    font-size: 20px; line-height: 1; padding: 2px 6px; cursor: pointer; border-radius: 6px;
}
.rq-window-actions button:hover { color: var(--rq-text); background: var(--rq-accent-soft); }
.rq-window-actions button:focus-visible { outline: 2px solid var(--rq-focus-ring); outline-offset: 2px; }
.rq-window-max i { font-size: 16px; }

.rq-window-body { flex: 1 1 auto; min-height: 0; overflow: auto; }

.rq-window.is-maximized { padding: 0; }
.rq-window.is-maximized .rq-window-dialog {
    width: 100% !important;
    height: 100% !important;
    max-width: none;
    border-radius: 0;
}

body.rq-window-open { overflow: hidden; }

/* ----------------------------------------------------------------- tabs */

.rq-tabs { display: flex; flex-direction: column; min-height: 0; }

.rq-tabs-list {
    display: flex;
    gap: 2px;
    margin: 0;
    padding: 0 8px;
    list-style: none;
    border-bottom: 1px solid var(--rq-border);
    overflow-x: auto;
    flex: 0 0 auto;
}

.rq-tabs-list > li {
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--rq-sub);
    white-space: nowrap;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    user-select: none;
}
.rq-tabs-list > li:hover { color: var(--rq-text); }
.rq-tabs-list > li.is-active { color: var(--rq-accent); border-bottom-color: var(--rq-accent); }
.rq-tabs-list > li:focus-visible { outline: 2px solid var(--rq-focus-ring); outline-offset: -2px; border-radius: 4px; }

.rq-tabs-panes { flex: 1 1 auto; min-height: 0; overflow: auto; }
.rq-tabs-pane { padding: 16px 0 0; }
.rq-tabs-pane[hidden] { display: none; }
.rq-tabs-pane.is-loading { opacity: 0.55; }
.rq-tabs-error { padding: 24px; text-align: center; color: var(--rq-danger-text); }

/* Inside a window the tabs own the window's scroll, so the pane list fills it. */
.rq-window-body > div > .rq-tabs,
.rq-window-body > .rq-tabs { height: 100%; }

/* ----------------------------------------------------------- check list */
/* rq.multiSelect on a div: the checkbox list that stands in for a
   MultiSelect dropdown. */
.rq-check-list { display: flex; flex-direction: column; gap: 2px; }
.rq-check-list > label {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 8px; margin: 0; border-radius: 6px;
    font-size: 13px; color: var(--rq-text); cursor: pointer; user-select: none;
}
.rq-check-list > label:hover { background: var(--rq-accent-soft); }
.rq-check-list input[type="checkbox"] { margin: 0; accent-color: var(--rq-accent); }

/* --------------------------------------------------------------- wizard */

.rq-wizard { display: flex; flex-direction: column; gap: 16px; min-height: 0; }

.rq-wizard-steps {
    display: flex; gap: 4px; margin: 0; padding: 0 0 12px; list-style: none;
    border-bottom: 1px solid var(--rq-border); overflow-x: auto;
}
.rq-wizard-step {
    display: flex; align-items: center; gap: 8px; flex: 1 1 0;
    padding: 6px 10px; border-radius: 8px; font-size: 13px; font-weight: 600;
    color: var(--rq-sub); cursor: pointer; white-space: nowrap; user-select: none;
}
.rq-wizard-step:hover { background: var(--rq-accent-soft); }
.rq-wizard-step:focus-visible { outline: 2px solid var(--rq-focus-ring); outline-offset: 2px; }
.rq-wizard-step.is-disabled { pointer-events: none; opacity: 0.6; }
.rq-wizard-step-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 50%; font-size: 13px;
    border: 2px solid var(--rq-border); color: var(--rq-sub); background: var(--rq-surface-raised);
}
.rq-wizard-step.is-active { color: var(--rq-accent); }
.rq-wizard-step.is-active .rq-wizard-step-icon { border-color: var(--rq-accent); color: var(--rq-accent); }
.rq-wizard-step.is-done .rq-wizard-step-icon { border-color: var(--rq-accent); background: var(--rq-accent); color: var(--rq-on-accent); }

.rq-wizard-content { flex: 1 1 auto; min-height: 0; overflow: auto; }
.rq-wizard-pane[hidden] { display: none; }

.rq-wizard-buttons {
    display: flex; justify-content: flex-end; gap: 8px;
    padding-top: 12px; border-top: 1px solid var(--rq-border);
}

/* ------------------------------------------------------------- dropzone */
/* rq.upload's drop target; the hidden file input opens on click. */
.rq-dropzone {
    display: flex; align-items: center; justify-content: center; text-align: center;
    min-height: 96px; padding: 16px;
    border: 2px dashed var(--rq-border); border-radius: 10px;
    color: var(--rq-sub); background: var(--rq-surface);
    cursor: pointer; transition: border-color .15s, background .15s;
}
.rq-dropzone:hover, .rq-dropzone.is-over { border-color: var(--rq-accent); background: var(--rq-accent-soft); color: var(--rq-text); }
.rq-dropzone.is-busy { opacity: 0.6; pointer-events: none; }
.rq-dropzone-hint { font-size: 13px; }

/* ------------------------------------------------------------ date picker */
/* The browser's calendar trigger goes; ours opens on click. The field itself
   is untouched — typing still works, the form still posts the ISO value. */
input[type="date"][data-rq-date]::-webkit-calendar-picker-indicator { display: none; }
input[type="date"][data-rq-date] { cursor: pointer; }

.rq-cal {
    position: absolute;
    z-index: 10300;                 /* above windows (10200) and the editor modal */
    width: 296px;
    padding: 12px 12px 8px;
    background: var(--rq-surface-raised);
    color: var(--rq-text);
    border: 1px solid var(--rq-border);
    border-radius: 12px;
    box-shadow: 0 18px 44px -18px var(--rq-shadow-color);
    font-family: var(--rq-font-ui);
    user-select: none;
}
.rq-cal[hidden] { display: none; }

.rq-cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.rq-cal-title {
    font-family: var(--rq-font-display);
    font-variation-settings: "opsz" 144;
    font-weight: 600; font-size: 16px; letter-spacing: -.01em;
}
.rq-cal-nav {
    width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
    border: 0; border-radius: 8px; background: transparent; color: var(--rq-sub); cursor: pointer; font-size: 16px;
}
.rq-cal-nav:hover { background: var(--rq-accent-soft); color: var(--rq-text); }
.rq-cal-nav:focus-visible { outline: 2px solid var(--rq-focus-ring); outline-offset: 1px; }

.rq-cal-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.rq-cal-weekdays span {
    font-family: var(--rq-font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
    color: var(--rq-faint); text-align: center; padding: 4px 0 6px;
}
.rq-cal-day {
    height: 36px; border: 0; border-radius: 8px; background: transparent;
    font-family: var(--rq-font-mono); font-variant-numeric: tabular-nums; font-size: 13px;
    color: var(--rq-text); cursor: pointer;
}
.rq-cal-day:hover { background: var(--rq-accent-soft); }
.rq-cal-day:focus-visible { outline: 2px solid var(--rq-focus-ring); outline-offset: -2px; }
.rq-cal-day.is-other { color: var(--rq-faint); }
.rq-cal-day.is-today { box-shadow: inset 0 0 0 1.5px var(--rq-money); }
.rq-cal-day.is-selected, .rq-cal-day.is-selected:hover { background: var(--rq-accent); color: var(--rq-on-accent); }
.rq-cal-day:disabled { color: var(--rq-faint); opacity: .45; cursor: not-allowed; background: transparent; }

.rq-cal-foot { display: flex; justify-content: space-between; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--rq-border); }
.rq-cal-link { border: 0; background: transparent; color: var(--rq-accent); font-weight: 600; font-size: 12.5px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.rq-cal-link:hover { background: var(--rq-accent-soft); }
.rq-cal-link:focus-visible { outline: 2px solid var(--rq-focus-ring); outline-offset: 1px; }
