/* ================================================================
   NormarTab — REFA Instrument design tokens
   Load BEFORE mma.css and sdd.css so they can consume these vars.
   ================================================================ */

/* ── IBM Plex — bundled locally (offline-first; no CDN) ─────────
   Complete builds: cover latin-ext (č š ž). URLs resolve relative
   to this file: _content/NormarCapture.UI/fonts/…                 */
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('fonts/IBMPlexSans-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('fonts/IBMPlexSans-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('fonts/IBMPlexSans-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('fonts/IBMPlexSans-Bold.woff2') format('woff2');
  font-weight: 700 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('fonts/IBMPlexMono-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('fonts/IBMPlexMono-Medium.woff2') format('woff2');
  font-weight: 500 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* ── Ink / text ─────────────────────────────────────────────── */
  --ink:       #0F1B2D;
  --ink-soft:  #475569;
  --ink-mut:   #7A8AA0;

  /* ── Chrome / dark nav surface ──────────────────────────────── */
  --chrome:      #122A42;
  --chrome-hi:   #1D4468;
  --chrome-line: #0B1E30;

  /* ── Page surfaces ───────────────────────────────────────────── */
  --surface: #F4F6F9;
  --card:    #FFFFFF;
  --line:    #E3E8EF;

  /* ── Brand colours ───────────────────────────────────────────── */
  --primary:    #1F6FEB;
  --primary-hi: #155ED0;
  --accent:     #E8622C;

  /* ── REFA category colours ───────────────────────────────────── */
  --c-main: #1E8E3E;   /* Glavno delo */
  --c-aux:  #1F6FEB;   /* Pomožno     */
  --c-dist: #D93025;   /* Motnje      */
  --c-pers: #F5A623;   /* Osebno      */

  /* ── Status ─────────────────────────────────────────────────── */
  --ok:   #1E8E3E;
  --warn: #F5A623;
  --bad:  #D93025;

  /* ── Shape ───────────────────────────────────────────────────── */
  --radius:    10px;
  --radius-sm: 6px;
  --shadow:    0 1px 2px rgba(15,27,45,.06), 0 2px 8px rgba(15,27,45,.06);

  /* ── Typography ─────────────────────────────────────────────── */
  --font-ui:   'IBM Plex Sans', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* ── Spacing scale ───────────────────────────────────────────── */
  --sp-1: .25rem;
  --sp-2: .5rem;
  --sp-3: .75rem;
  --sp-4: 1rem;
  --sp-6: 1.5rem;

  /* ── App chrome metrics ──────────────────────────────────────── */
  --nav-h: 54px;

  /* ── SyncButton legacy compat ────────────────────────────────── */
  --mma-text-secondary: var(--ink-mut);
}

/* ── Base ────────────────────────────────────────────────────────── */
body {
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--surface);
}

/* ── App shell layout ────────────────────────────────────────────── */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-main {
  flex: 1;
  min-height: 0;
}

/* ── Offset sticky per-study header below AppNav ─────────────────── */
/* MmaStudyView uses .mma-app-header { position:sticky; top:0 }.
   Now that a 54px nav sits above it, push the offset down. */
.mma-app-header {
  top: var(--nav-h);
}

/* ── AppNav — persistent instrument top bar ──────────────────────── */
.app-nav {
  position: sticky;
  top: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  height: var(--nav-h);
  padding: 0 var(--sp-4);
  background: var(--chrome);
  border-bottom: 1px solid var(--chrome-line);
  color: #fff;
  /* prevent any child from busting the line-height */
  font-size: 0;
}

/* Brand block */
.app-nav-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  flex-shrink: 0;
  text-decoration: none;
}

.app-nav-glyph {
  width: 22px;
  height: 22px;
  display: block;
  flex-shrink: 0;
  opacity: .92;
}

.app-nav-product {
  font-family: var(--font-ui);
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: -.01em;
  color: #fff;
  white-space: nowrap;
}

.app-nav-tag {
  font-family: var(--font-mono);
  font-size: .6rem;
  font-weight: 500;
  letter-spacing: .08em;
  color: var(--accent);
  background: rgba(232,98,44,.18);
  border: 1px solid rgba(232,98,44,.4);
  border-radius: 3px;
  padding: 1px 5px;
  white-space: nowrap;
  text-transform: uppercase;
}

/* Segmented method switcher */
.app-nav-methods {
  display: inline-flex;
  align-items: center;
  background: var(--chrome-line);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
  flex-shrink: 0;
}

.app-nav-seg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  padding: 0 14px;
  border-radius: 4px;
  font-family: var(--font-ui);
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .02em;
  color: rgba(255,255,255,.6);
  text-decoration: none;
  white-space: nowrap;
  transition: background .12s, color .12s;
}

.app-nav-seg:hover { color: #fff; background: rgba(255,255,255,.1); }
.app-nav-seg.active { background: var(--chrome-hi); color: #fff; }

/* Right: actions */
.app-nav-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  flex-shrink: 0;
}

.app-nav-clock {
  font-size: .82rem;
  font-weight: 600;
  color: rgba(255,255,255,.85);
  letter-spacing: .02em;
  white-space: nowrap;
}

.app-nav-link {
  font-family: var(--font-ui);
  font-size: .82rem;
  font-weight: 500;
  color: rgba(255,255,255,.72);
  text-decoration: none;
  white-space: nowrap;
  transition: color .12s;
}

.app-nav-link:hover  { color: #fff; }
.app-nav-link.active { color: #fff; font-weight: 600; }

/* ── SyncButton chip — compact override inside AppNav ────────────── */
/* Scope: everything inside .app-sync-chip overrides the standalone card style */
.app-sync-chip {
  --mma-text-secondary: rgba(255,255,255,.5);
  display: inline-flex;
  align-items: center;
}

.app-sync-chip .mma-card {
  margin: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  border: none;
}

.app-sync-chip .mma-card > div {
  gap: var(--sp-2);
  flex-wrap: nowrap;
}

.app-sync-chip .mma-btn {
  height: 28px;
  padding: 0 10px;
  font-size: .75rem;
  border-radius: var(--radius-sm);
}

.app-sync-chip .mma-badge {
  height: 18px;
  font-size: .68rem;
  padding: 0 6px;
}

/* ── Reusable numeric readout helper ─────────────────────────────── */
.num-mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ── DevExpress (blazing-berry) recolor: berry purple #5f368d → app accent ───
   This file loads after the theme; the theme scopes its vars with :where()
   (zero specificity), so these plain-class rules win.                        */
:root {
  --bs-primary: #E8622C;
  --bs-primary-rgb: 232, 98, 44;
  --dxbl-client-component-palette-primary: #E8622C;
}
.dxbl-btn-primary {
  --dxbl-btn-bg: #E8622C;
  --dxbl-btn-border-color: #E8622C;
  --dxbl-btn-hover-bg: #D0551F;
  --dxbl-btn-hover-border-color: #D0551F;
  --dxbl-btn-active-bg: #B8481A;
  --dxbl-btn-active-border-color: #B8481A;
  --dxbl-btn-focus-outline-color: #E8622C;
}
.dxbl-btn {
  --dxbl-btn-focus-outline-color: #E8622C;
  --dxbl-btn-focus-shadow-color: rgba(232, 98, 44, 0.5);
}
/* focused text editors (DxTextBox / DxSpinEdit / DxComboBox): border + glow */
.dxbl-text-edit {
  --dxbl-text-edit-focus-border-color: #E8622C;
  --dxbl-text-edit-focus-shadow-color: rgba(232, 98, 44, 0.25);
  --dxbl-edit-dropdown-btn-focus-outline-color: #E8622C;
}
.dxbl-grid {
  --dxbl-grid-focus-frame-color: #E8622C;
  --dxbl-grid-column-chooser-focus-frame-color: #E8622C;
  --dxbl-pager-active-page-btn-bg: #E8622C;
  --dxbl-pager-page-btn-hover-bg: rgba(232, 98, 44, 0.12);
}
.dxbl-checkbox {
  --dxbl-checkbox-check-element-checked-bg: #E8622C;
  --dxbl-checkbox-radio-check-bg: #E8622C;
  --dxbl-checkbox-radio-checked-border-color: #E8622C;
  --dxbl-checkbox-switch-checked-bg: #E8622C;
  --dxbl-checkbox-checked-focus-shadow-color: rgba(232, 98, 44, 0.5);
  --dxbl-checkbox-unchecked-focus-shadow-color: rgba(232, 98, 44, 0.5);
}
.dxbl-tabs {
  --dxbl-tabs-tab-selected-color: #E8622C;
  --dxbl-tabs-tab-focus-outline-color: #E8622C;
}
.dxbl-list-box { --dxbl-list-box-focus-frame-color: #E8622C; }
.dxbl-menu, .dxbl-context-menu {
  --dxbl-menu-item-focus-outline-color: #E8622C;
  --dxbl-context-menu-item-focus-outline-color: #E8622C;
}

/* Uniform DxGrid data-row height everywhere (the Odseki command buttons make its
   rows taller than plain-text grids). `height` on a <td> acts as a min-height, so
   short rows grow to match while the button rows stay put. The Snemanje REFA form
   is a custom .z2-form table, not a DxGrid, so it is unaffected. */
.dxbl-grid-table > tbody > tr:not(.dxbl-grid-edit-row) > td { height: 38px; }

/* ── Print / Save-as-PDF: the REFA grid (Zeitaufnahmebogen), paginating both ways ──
   A dedicated .z2-print-sheet renders the grid as continuation page-sets (cycle
   columns split across pages) so it never clips; odseks that exceed page height
   flow to more pages (section blocks kept whole, header repeated). Hidden on
   screen; revealed only in print.                                               */
.z2-print-sheet { display: none; }
.z2-print-watermark { display: none; }

@media print {
  /* Demo stamp: position:fixed repeats the overlay on EVERY printed page. */
  .z2-print-watermark { display: flex !important; position: fixed; inset: 0; align-items: center;
                        justify-content: center; z-index: 2147483647; pointer-events: none; }
  .z2-print-watermark span { transform: rotate(-28deg); font-size: 7vw; font-weight: 800;
                             letter-spacing: .06em; white-space: nowrap; color: rgba(232, 98, 44, .18);
                             -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body * { visibility: hidden !important; }
  dx-license { display: none !important; }        /* DevExpress eval watermark lives outside <body> */
  .z2-print-sheet { display: block !important; position: absolute; left: 0; top: 0; width: 100%; }
  .z2-print-sheet, .z2-print-sheet * { visibility: visible !important; }
  /* cycle-column continuation: each page-set on its own page */
  .z2-print-page { padding: 8mm; box-sizing: border-box; page-break-after: always; break-after: page; }
  .z2-print-page:last-child { page-break-after: auto; break-after: auto; }
  /* vertical pagination for many odseks: keep each section's 4 rows together, repeat the header */
  .z2-print-sheet tbody.z2-seg { page-break-inside: avoid; break-inside: avoid; }
  .z2-print-sheet thead { display: table-header-group; }
  /* .z2-form-app draws only right/bottom cell borders (the wrapper supplies the outer
     left/top frame on screen); the print table has no wrapper, so add its left+top edges. */
  .z2-print-sheet table.z2-form-app { border-left: 1px solid var(--line, #e6e6e6); border-top: 1px solid var(--line, #e6e6e6); }
  /* fixed layout can clip; let identity text wrap so nothing is lost */
  .z2-print-sheet td.z2-fz-name, .z2-print-sheet th.z2-fz-name { white-space: normal; word-break: break-word; }
}

/* Top-level @page (print-only by nature): margin:0 removes the browser's auto header/
   footer (date, page title, URL); the real page margin is the .z2-print-page padding.
   NB: some browsers only honor this when the print dialog's Margins = "Default"; the
   "Headers and footers" dialog checkbox can still force them on — CSS can't override that. */
@page { size: A4 landscape; margin: 0; }

/* ── Language selector (AppNav + login) ─────────────────────────────────── */
.app-lang-select {
  background: rgba(255, 255, 255, 0.08); color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 6px;
  padding: 3px 6px; font-size: 0.85rem; cursor: pointer;
}
.app-lang-select option { color: #111; background: #fff; }
.auth-card .app-lang-select { background: transparent; color: inherit; border-color: var(--line, #ccc); margin-left: auto; }

/* ── User menu (top-right): language / categories / sync / logout in a DxDropDown ── */
.app-user-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255, 255, 255, 0.08); color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 999px;
  padding: 3px 10px 3px 4px; font-size: .82rem; cursor: pointer;
}
.app-user-btn:hover { background: rgba(255, 255, 255, 0.16); }
.app-user-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent, #e8622c); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .8rem;
}
.app-user-caret { font-size: .65rem; opacity: .75; }
.app-user-menu-body { display: flex; flex-direction: column; padding: 6px; min-width: 250px; font-size: .9rem; }
.app-user-menu-row {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: 8px 10px; border-radius: 6px; color: inherit; text-decoration: none;
  background: none; border: none; font: inherit; text-align: left; cursor: pointer;
}
.app-user-menu-link:hover, .app-user-menu-logout:hover { background: rgba(0, 0, 0, 0.06); }
.app-user-menu-logout { color: #b71c1c; font-weight: 600; }
/* the shared selector is styled for the dark bar — restyle for the light popup */
.app-user-menu .app-lang-select { background: #fff; color: #111; border-color: var(--line, #ccc); }
/* SyncButton ships as a card — flatten it inside the menu */
.app-user-menu-sync .mma-card { margin: 0 !important; padding: 4px 10px; border: none; box-shadow: none; background: transparent; }

/* ── Responsive nav: shed the widest non-essential items as the viewport narrows,
      so MMA/SDD/Z2, user/logout, Kategorije, language and sync always stay reachable. ── */
@media (max-width: 1100px) {
  .app-nav-clock { display: none; }
}
@media (max-width: 820px) {
  .app-nav-tag { display: none; }        /* REFA chip */
  .app-user-name { display: none; }      /* keep the logout button */
}
@media (max-width: 640px) {
  .app-nav-product { display: none; }    /* brand text; the glyph stays */
  .app-nav { gap: var(--sp-2); padding: 0 var(--sp-2); }
  .app-nav-actions { gap: var(--sp-2); }
  .app-nav-seg { padding: 0 10px; }
  .app-lang-select { width: 64px; }      /* truncated in the box; the dropdown shows full names */
}
@media (max-width: 480px) {
  /* Small phones: two rows (brand + methods / actions) instead of clipping or scrolling. */
  .app-nav { flex-wrap: wrap; height: auto; min-height: var(--nav-h); padding: 4px var(--sp-2); row-gap: 2px; }
  .app-nav-actions { margin-left: auto; }
}

/* ── Wait indicators ──────────────────────────────────────────────
   One canonical in-app indicator: while the BusyService is active,
   the nav "N" glyph is wrapped in a DxWaitIndicator (Flip animation,
   custom Template). NormarWait (inline flipping N) is only for
   screens without the nav bar (login).                             */
.app-nav-glyph-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex: none;
}
.app-nav-glyph-slot .app-nav-glyph { display: block; }
.app-nav-glyph-wait { display: inline-flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.normar-wait { display: inline-flex; vertical-align: -0.15em; margin-right: 0.45em; }
.normar-wait-glyph { width: 1.05em; height: 1.05em; }

/* Row checkbox for multi-select in the analysis/bin lists.
   NOTE: named .mma-check — .mma-select is taken by the <select> styling in mma.css. */
.mma-check { width: 1.15rem; height: 1.15rem; flex: none; accent-color: var(--clr-primary, #1f6feb); }

/* Demo ribbon in the nav bar: same chip as the REFA tag, accent colour, links to normar.si. */
.app-nav-demo { background: #16c2e6; color: #06121f; text-decoration: none; margin-left: 6px; }
.app-nav-demo:hover { background: #0e9fc0; color: #06121f; }
