/* ── SDD (REFA continuous time-study) component styles ──────────────────── */
/* Tokens consumed from app-theme.css (must load first).                    */

/* Shell override — narrower max-width than the full-screen MMA view */
.sdd-shell {
    max-width: 1024px;
    margin: 0 auto;
    padding: 0.75rem 1rem 2rem;
}
/* SDD analysis view: full screen width (multi-station panes + wide event grid need the room). */
.sdd-shell-wide { max-width: none; }

/* ── Tab bar ─────────────────────────────────────────────────────────────── */
.sdd-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--line);
    margin-bottom: 0.75rem;   /* match SDD's DxTabs spacing (.sdd-dxtabs) for MMA + Z2 */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-shrink: 0;
}

.sdd-tab {
    flex: 0 0 auto;
    padding: 0.6rem 1.4rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--ink-mut);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    margin-bottom: -2px;
    white-space: nowrap;
}

.sdd-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.sdd-tab:hover:not(.active) {
    color: var(--primary-hi);
    border-bottom-color: var(--line);
}

/* ── Panels ──────────────────────────────────────────────────────────────── */
.sdd-panel {
    display: none;
}

.sdd-panel.active {
    display: block;
}

/* ── System selector ─────────────────────────────────────────────────────── */
.sdd-system-selector {
    margin-bottom: 0.75rem;
}


/* ── Rezultati controls ──────────────────────────────────────────────────── */
.sdd-rezultati-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.75rem;
}

.sdd-rezultati-controls label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.875rem;
    cursor: pointer;
}

/* ── Nastavitve section spacing ──────────────────────────────────────────── */
.sdd-nastavitve-section {
    margin-bottom: 1.5rem;
}

/* ── Tap-to-log recorder ─────────────────────────────────────────────────── */
.sdd-recorder { margin: 0.75rem 0; }
.sdd-start-btn { font-size: 1.05rem; padding: 0.6rem 1.4rem; }
/* Activity palette: exactly 2 rows tall, buttons flow into columns and scroll left-right */
.sdd-palette {
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: repeat(2, auto);
    grid-auto-columns: max-content;
    gap: 0.4rem;
    margin: 0.4rem 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 0.3rem;   /* room for the horizontal scrollbar */
}
.sdd-palette-btn { font-size: 1rem; padding: 0.5rem 1rem; min-width: 96px; white-space: nowrap; }
.sdd-palette-btn:hover { border-color: var(--accent, #2962ff); }
.sdd-recorder-meta { font-size: 0.8rem; color: var(--ink-mut, #555); }

.sdd-neworder { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.sdd-neworder-label { font-size: 0.8rem; color: var(--ink-mut, #555); }
.sdd-neworder .mma-btn { font-size: 0.85rem; padding: 0.3rem 0.7rem; }
.sdd-check { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; cursor: pointer; }
.sdd-check input { width: 18px; height: 18px; }
.sdd-depth-seg { display: inline-flex; gap: 0.35rem; }
.sdd-depth-btn { min-width: 44px; min-height: 44px; padding: 0.4rem 0.6rem; font-size: 1rem; }

/* Delete-confirmation modal (mirrors the Z2 modal) */
.sdd-modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.sdd-modal { background: var(--surface, #fff); border-radius: 10px; padding: 1.25rem; min-width: 340px; max-width: 90vw; box-shadow: 0 8px 30px rgba(0,0,0,0.25); }
.sdd-modal-title { font-weight: 600; margin-bottom: 0.75rem; }
.sdd-modal-text { margin: 0 0 0.5rem; color: var(--ink-mut, #666); }
.sdd-modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1rem; }
.sdd-duration-row { display: flex; align-items: center; gap: 0.6rem; margin: 0.75rem 0; }
.sdd-recycle { min-width: min(460px, 90vw); }   /* 460px would overflow a phone; .sdd-modal caps at 90vw */
.sdd-recycle-list { max-height: 50vh; overflow-y: auto; display: flex; flex-direction: column; margin: 0.5rem 0; }
.sdd-recycle-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.35rem 0; border-bottom: 1px solid var(--line, #eee); font-size: 0.9rem; }
.sdd-recycle-act { flex: 1 1 auto; }
.sdd-modal-actions .sdd-clear-btn { margin-right: auto; color: #b71c1c; border-color: #ef9a9a; }
.sdd-clear-confirm { margin-right: auto; align-self: center; color: #b71c1c; font-size: 0.9rem; }
.sdd-time-edit { width: 92px; padding: 2px 6px; text-align: center; }
/* Live wall-clock in the recording bar: display only — not focusable, not selectable. */
.sdd-time-live { display: inline-block; user-select: none; cursor: default; }

/* ── Recording bar (dedicated keyboard-first input above the grid) ─────────── */
.sdd-record-bar {
    display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;   /* portrait phone: wrap, don't overflow */
    margin: 0.6rem 0; padding: 0.5rem 0.6rem;   /* symmetric so the gap to the grid is equal above/below */
    background: var(--surface-2, #f3f6ff); border: 1px solid var(--accent, #2962ff);
    border-radius: 8px;
}
.sdd-record-bar .sdd-time-edit { font-size: 1.1rem; font-weight: 600; }
.sdd-record-activity { flex: 1 1 auto; min-width: 160px; font-size: 1.05rem; }

.sdd-time-error {
    margin: 0 0 0.5rem; padding: 0.4rem 0.7rem; border-radius: 6px;
    background: #ffebee; color: #b71c1c; border: 1px solid #ef9a9a; font-size: 0.85rem;
}
/* Persistent invalid-time marker in the Datum/Čas display cells (mirrors the native editor icon
   that unmounts on blur). A small red "!" badge. */
.sdd-invalid-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 15px; height: 15px; margin-left: 5px; vertical-align: middle;
    background: #d50000; color: #fff; border-radius: 50%;
    font-weight: 700; font-size: 0.7rem; line-height: 1;
}

/* Column-chooser trigger, right-aligned in the tab bar (Snemanje only) */
.sdd-tab-action {
    margin-left: auto; align-self: center;
    background: none; border: 1px solid var(--line); border-radius: 6px;
    padding: 0.3rem 0.7rem; font-size: 0.8rem; color: var(--ink-mut);
    cursor: pointer; white-space: nowrap;
}
.sdd-tab-action:hover { border-color: var(--accent, #2962ff); color: var(--accent, #2962ff); }
/* Stolpci / Koš actions overlaid at the right end of the DxTabs strip */
.sdd-tabs-wrap { position: relative; }
.sdd-tab-actions { position: absolute; top: 4px; right: 8px; display: flex; gap: 0.4rem; z-index: 3; }
/* The DevExpress column-chooser popup opens below-left-aligned to this invisible anchor. */
.sdd-colchooser-anchor { position: absolute; top: 100%; right: 230px; width: 0; height: 0; }

/* Multi-view column menu (Stolpci in "Vsi sistemi") — anchored under the tab-action buttons.
   z-index above DevExpress popups (~1000), so a leftover chooser can never cover it. */
.sdd-panecols-menu {
    position: absolute; top: calc(100% + 6px); right: 0;
    display: flex; flex-direction: column; gap: 0.35rem;
    background: var(--surface, #fff); border: 1px solid var(--line, #ddd); border-radius: 8px;
    padding: 0.55rem 0.8rem; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15); z-index: 12000;
}
.sdd-panecol { display: flex; align-items: center; gap: 0.45rem; font-size: 0.9rem; white-space: nowrap; cursor: pointer; }
.sdd-panecol input { width: 16px; height: 16px; }

/* Reserve the overlay buttons' width at the strip's right end, so Stolpci/Koš stay IN the
   tab row at every window size — the tab list scrolls within the remaining width instead of
   sliding under the buttons (which also made the buttons steal the tabs' taps). NOTE: the
   rendered strip element is dxbl-tabs-tablist (there is no .dxbl-tabs-container in the DOM);
   margin (not padding) so the scroll viewer itself gets narrower. */
.sdd-dxtabs > .dxbl-tabs-tablist { margin-right: 215px; }
/* Very narrow screens: icon-only action buttons → smaller reservation. */
@media (max-width: 480px) {
    .sdd-dxtabs > .dxbl-tabs-tablist { margin-right: 100px; }
    .sdd-tab-action-text { display: none; }
}
/* DxTabs renders content flush under the strip (0 padding); add the 0.75rem gap that the
   custom .sdd-tabs bar gets via margin-bottom, so every tab's content sits 0.75rem below. */
.sdd-dxtabs .dxbl-tabs-content-panel { padding-top: 0.75rem; }

/* Newest row's Čas is clickable to re-stamp the time to now — looks like the value, hints on hover. */
.sdd-restamp-btn {
    background: none; border: none; padding: 0; margin: 0; cursor: pointer; color: inherit;
    font: inherit; text-decoration: underline dotted; text-underline-offset: 2px;
}
.sdd-restamp-btn:hover { color: var(--accent, #2962ff); }

/* Header cells of the centered columns (class set via the grid's CustomizeElement).
   DevExpress lays the header caption out in a flex wrapper, so center both text flow
   and any flex children rather than relying on the internal wrapper's class name. */
.sdd-th-center { text-align: center; }
.sdd-th-center div { justify-content: center; }

/* Combo editors of the centered columns (L + classification): center the input text and the
   dropdown items (the dropdown renders in a body-level portal, hence its own class). */
.sdd-edit-center input { text-align: center; }
.sdd-drop-center .dxbl-listbox-item,
.sdd-drop-center li { justify-content: center; text-align: center; }

/* ── Multi-station view ("Vse postaje" tab): one splitter pane per station ── */
/* Below ~300px per station the panes stop being usable — keep that minimum and let the
   whole splitter slide horizontally instead (--stations = pane count, set inline).
   max-width + the content panel's min-width:0 stop the splitter's min-width from leaking
   through the flex chain and pushing the tabs strip (and its overlay buttons) past the
   viewport's right edge. */
.sdd-stations-scroll { overflow-x: auto; padding-bottom: 0.3rem; max-width: 100%; }
.sdd-dxtabs .dxbl-tabs-content-panel { min-width: 0; }
.sdd-stations { height: 65vh; margin-top: 0.5rem; min-width: calc(var(--stations, 1) * 300px); }
/* Per-station palette: compact buttons; the pane is narrow, so the 2-row grid slides L-R.
   flex:none — the pane is a flex column and the grid would otherwise crush the palette
   to a scrollbar sliver once a station has many events. */
.sdd-station-palette { margin: 0; flex: none; }
.sdd-station-palette .sdd-palette-btn { font-size: 0.9rem; padding: 0.35rem 0.7rem; min-width: 72px; }
.sdd-station {
    height: 100%; display: flex; flex-direction: column; gap: 0.4rem;
    padding: 0.45rem 0.5rem; border: 2px solid transparent; border-radius: 8px;
}
.sdd-station-focused { border-color: var(--accent, #2962ff); background: var(--surface-2, #f7f9ff); }
.sdd-station-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.sdd-station-name { font-weight: 600; }
.sdd-station-count { font-size: 0.75rem; color: var(--ink-mut, #777); white-space: nowrap; }
.sdd-station-input { width: 100%; font-size: 1rem; }
.sdd-station-grid { flex: 1 1 auto; min-height: 0; overflow-y: auto; }

/* Rezultati copyable chart (layout mirrors Z2's .z2-rez-chart) */
.sdd-rez-chart { margin-top: 1.25rem; }
.sdd-rez-chart-head { display: flex; align-items: center; gap: 0.5rem 0.75rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.sdd-rez-chart-head > .mma-chip-row { margin-bottom: 0; }
.sdd-rez-chart-head > .mma-eyebrow { margin-bottom: 0; }
.sdd-copy-btn { margin-left: auto; }

/* transient toast (auto-dismiss) */
.sdd-toast {
    position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
    background: rgba(28, 28, 30, 0.92); color: #fff;
    padding: 0.55rem 1.1rem; border-radius: 8px; font-size: 0.9rem;
    z-index: 2000; box-shadow: 0 4px 18px rgba(0, 0, 0, 0.28);
    animation: sdd-toast-in 0.18s ease-out;
}
@keyframes sdd-toast-in { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* Per-event "Izključno" flag checkbox (ReadOnly cell, applies immediately). */
.sdd-excl-check { width: 16px; height: 16px; cursor: pointer; }

/* Delete = just the bin icon, no button chrome, compact */
.sdd-del-btn {
    padding: 0 4px; min-height: 0; height: auto; font-size: 1rem; line-height: 1;
    background: none; border: none; cursor: pointer; color: inherit;
}
.sdd-del-btn:hover { color: #b71c1c; }

/* The grid wrapper is programmatically focused (tabindex=-1) to route Up/Down keys — no focus ring. */
.sdd-grid-wrap:focus, .sdd-grid-wrap:focus-visible { outline: none; }

/* Selection checkbox in DATA rows is pointer-events:none so the click falls through to the row and
   OnRowClick is the sole selection driver (enables Shift+click range). The checkbox still renders its
   checked state from SelectedDataItems. The header "Select All" (thead) keeps native behaviour. */
.sdd-grid-wrap tbody .dxbl-grid-selection-cell .dxbl-checkbox { pointer-events: none; }

/* Uniform row height: pin every data cell so the compact edit rendering can't shrink the
   row (display cells are ~38px; edit cells would otherwise collapse to ~31px). height on a
   table cell acts as a minimum, so display stays 38px and edit grows back up to 38px. */
.sdd-grid-wrap tbody td { height: 38px !important; }
/* Icon-only undo/redo buttons in the recording bar — kept compact */
.sdd-icon-btn { min-width: 40px; padding: 0.45rem 0.5rem; font-size: 1.15rem; line-height: 1; }
/* Undo/redo split button + history dropdown (pick how many steps) */
.sdd-histgroup { position: relative; display: inline-flex; }
.sdd-caret-btn { min-width: 20px; padding: 0.45rem 0.15rem; font-size: 0.7rem; line-height: 1; margin-left: -1px; }
.sdd-hist-menu {
    position: absolute; top: 100%; left: 0; z-index: 30; margin-top: 2px;
    background: var(--surface, #fff); border: 1px solid var(--line, #ccc); border-radius: 6px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.25); max-height: 45vh; overflow-y: auto; min-width: 170px;
}
.sdd-hist-item {
    display: block; width: 100%; text-align: left; padding: 0.35rem 0.7rem;
    background: none; border: none; cursor: pointer; font-size: 0.85rem; white-space: nowrap; color: inherit;
}
.sdd-hist-item:hover { background: var(--surface-2, #eef3ff); }

/* Focused/selected row: DevExpress tints it purple via a td::before overlay — make it the
   header's dark navy blue (rgb(18,42,66)) instead. */
.sdd-grid-wrap .dxbl-grid-focused-row td::before {
    background-color: #122a42 !important;
}

/* ── Clock ──────────────────────────────────────────────────────────────────── */
.sdd-clock { font-size: 1.4rem; font-weight: 600; color: var(--accent, #2962ff); margin-bottom: 0.4rem; }
