/* ============================================================
   Rosistem – Custom stylesheet
   Applied on top of the active Wisej.NET theme.
   ============================================================ */

/* Fonts named by the forms themselves ("Microsoft Sans Serif", "Segoe UI", "Tahoma", "Consolas") exist
   only on Windows. Elsewhere (macOS, Linux, tablets) the browser fell back to a serif face, so toolbars
   and buttons came out in a small Times-like font unlike the rest of the screen. Each name is mapped to
   itself first — where it is installed the regular text stays the same — and then to the closest
   common face. Only the regular faces are mapped: a bold text takes the regular face and the browser makes it
   bold. Mapping the bold faces too sent bold text ("Microsoft Sans Serif" has no bold on Windows) to a substitute
   that drew other glyphs, so window titles came out as garbled symbols. */
@font-face { font-family: "Microsoft Sans Serif"; font-weight: normal; src: local("Microsoft Sans Serif"), local("MicrosoftSansSerif"), local("Arial"), local("ArialMT"), local("Helvetica"), local("Helvetica Neue"), local("Liberation Sans"), local("DejaVu Sans"), local("Roboto"); }
@font-face { font-family: "Segoe UI"; font-weight: normal; src: local("Segoe UI"), local("SegoeUI"), local("Arial"), local("ArialMT"), local("Helvetica"), local("Helvetica Neue"), local("Liberation Sans"), local("DejaVu Sans"), local("Roboto"); }
@font-face { font-family: "Tahoma"; font-weight: normal; src: local("Tahoma"), local("Arial"), local("ArialMT"), local("Helvetica"), local("Helvetica Neue"), local("Liberation Sans"), local("DejaVu Sans"), local("Roboto"); }
@font-face { font-family: "Consolas"; font-weight: normal; src: local("Consolas"), local("Menlo"), local("DejaVu Sans Mono"), local("Liberation Mono"), local("Courier New"); }

/* ----------------------------------------------------------
   DataGridView column headers – tall mode (filter row visible)
   When ShowFilterRow=true the header height is 52px:
     - top 24px → column title text
     - bottom 28px → filter controls overlay (Panel)
   The theme sets alignY:"top" on the label widget, but some
   Wisej versions ignore that for table-header-cell.  These
   CSS rules act as a safety net.
   ---------------------------------------------------------- */

/* The CssClass "my-custom-header" is set on
   ColumnHeadersDefaultCellStyle in GridViewEx constructor. */

/* Header NORMAL (filter row hidden) – las tema sa faca layout-ul.
   Doar text negru bold ca sa fie vizibil pe orice tema. */

/* ----------------------------------------------------------
   DataGridView – fix row-header row number text colour.
   In some themes the row header text is invisible.
   ---------------------------------------------------------- */
.wisej-datagrid .qx-row-header {
    color: #333333 !important;
}

/* ----------------------------------------------------------
   Group-by panel chip labels
   ---------------------------------------------------------- */
.wms-groupby-chip {
    display: inline-flex;
    align-items: center;
    background: #d0e4f5;
    border: 1px solid #89b8d9;
    border-radius: 3px;
    padding: 2px 6px;
    margin: 2px 4px;
    font-size: 12px;
    cursor: default;
    user-select: none;
}

.wms-groupby-chip:hover {
    background: #b8d5ee;
}

/* ----------------------------------------------------------
   DataGridView column headers – when filter row is visible
   This class is used when ShowFilterRow=true.
   The header height is 56px total:
     - top 28px → column title text
     - bottom 28px → filter controls overlay (Panel)
   ---------------------------------------------------------- */

/* Header cu filter row vizibil – las tema sa faca layout-ul. */

/* FIX layout: anuleaza padding-top: 14px din tema qooxdoo care impingea textul
   in zona filter row. Plus reducem font-size la 12px (tema implicita 16px era prea mare). */
[class*="qx-table-header-cell-label"] {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    font-size: 12px !important;
}

/* Teme "Text Mare" (RosistemLargeText / FluentDarkLargeText): header-ul de grid
   sta intr-o cutie fixa de 28px hardcodata in GridViewEx.cs (_normalHeaderHeight),
   care NU creste odata cu fontul temei — deci NU aplicam scalarea completa a
   fontului aici (ar taia textul), doar un bump modest fata de cei 12px globali.
   Clasa wms-large-text e pusa pe <body> de commonjs.js (patch 4), pe baza
   numelui temei active — Wisej nu expune numele temei ca si clasa CSS. */
body.wms-large-text [class*="qx-table-header-cell-label"] {
    font-size: 14px !important;
}

/* FILTER ROW textboxes — by default qx-textbox-borderSolid e transparent fara border vizibil.
   Adaugam border subtil ca utilizatorul sa vada zona de input. Background NU este fortat
   (lasam tema sa controleze - altfel apare alb pe Bootstrap Dark cf. cerere user 2026-05-19). */
.qx-textbox-borderSolid {
    border: 1px solid rgba(180, 180, 180, 0.6) !important;
    border-radius: 2px !important;
}
.qx-textbox-borderSolid:focus-within {
    border-color: rgba(80, 130, 200, 0.9) !important;
}

/* Sort icon: tema DEJA provide iconul ca background-image (18x18 white arrow) pe
   un al doilea div in interiorul cell-ului. Il pozitiona la centru-y (y=28 in
   cell de 56px) — deci jumatatea jos e acoperita de filter row si vezi doar
   varful sagetii.
   Fix: cand filter row e activ, mutam iconul sus (top:4px) ca sa stea
   complet in zona titlu (top 28px). */
[class*="-sorted-"]:not([class*="label"]) > div:not(.qx-table-header-cell-label),
[class$="-sorted"]:not([class*="label"]) > div:not(.qx-table-header-cell-label) {
    top: 4px !important;
}

/* ----------------------------------------------------------
   General improvements
   ---------------------------------------------------------- */

/* Ensure panels inside the UserControl fill properly */
.wisej-usercontrol {
    overflow: hidden;
}

/* Record navigator panel */
.wms-record-navigator {
    background: #f0f0f0;
    border-top: 1px solid #cccccc;
}

/* ----------------------------------------------------------
   DataGridView — icon-uri checkbox (true/false/indeterminate)
   Le facem aproape transparente, ca sa nu fure atentia.
   Tinta: backgroundul subtil ca al context menu-ului.
   ---------------------------------------------------------- */

/* qooxdoo checkbox in cell: clasele uzuale Wisej + qx pentru state-uri */
.qx-CheckBox,
[role="checkbox"],
.qx-data-grid-cell .qx-CheckBox,
.qx-data-grid-cell [role="checkbox"] {
    opacity: 0.35 !important;
}

/* Hover-ul aduce opacitatea ~normala ca utilizatorul sa vada clar valoarea */
.qx-data-grid-cell:hover .qx-CheckBox,
.qx-data-grid-cell:hover [role="checkbox"],
tr:hover .qx-CheckBox,
tr:hover [role="checkbox"] {
    opacity: 0.85 !important;
    transition: opacity 120ms ease-in-out;
}

/* Focusat / selectat: full opacity */
.qx-data-grid-cell-selected .qx-CheckBox,
.qx-data-grid-cell-focused .qx-CheckBox,
.qx-data-grid-row-selected .qx-CheckBox {
    opacity: 1 !important;
}

/* ----------------------------------------------------------
   Butoane filtre operator (=, ≈, >=, etc.) din header coloana
   Vrem fundal subtil, ca al context-menu, si transparent.
   Setat in cod: modeBtn.CssClass = "wms-filter-mode-btn"
   ---------------------------------------------------------- */
.wms-filter-mode-btn {
    background-color: rgba(245, 245, 245, 0.30) !important;
    background-image: url('/Resources/Filter.svg') !important;
    background-repeat: no-repeat !important;
    background-position: center center !important;
    background-size: 14px 14px !important;
    border: 1px solid rgba(180, 180, 180, 0.25) !important;
    box-shadow: none !important;
    opacity: 0.55;
    transition: opacity 120ms ease-in-out, background-color 120ms ease-in-out;
    min-width: 22px;
}
/* hover/focus = mai vizibil */
.wms-filter-mode-btn:hover {
    background-color: rgba(220, 220, 220, 0.85) !important;
    opacity: 1;
    border-color: rgba(120, 120, 120, 0.55) !important;
}

/* ----------------------------------------------------------
   MainPage Dashboard Buttons — layout corect imagine + text
   Red box (text label): jos, customizable color/size din settings
   Green box (image area): zona superioara, BackgroundImage zoom-uit aici
   ---------------------------------------------------------- */
.wms-dashboard-btn {
    /* Imaginea: pozitia top-center, zoom in zona de sus (rezervam ~36px jos pt text) */
    background-position: center 8px !important;
    background-repeat: no-repeat !important;
    /* width:auto, height: total - 40px (text reservation) */
    background-size: auto calc(100% - 40px) !important;
}

/* Cand butonul are containing image foreground (nu background), il pozitionam tot sus */
.wms-dashboard-btn > .qx-image,
.wms-dashboard-btn .qx-atom-image {
    margin-bottom: 4px;
}

/* 2026-05-23 (REGULA GLOBALA cerere user): header coloane grid afiseaza textul inline
   (single-line) by default — fara wrap pe 2 randuri. Cand textul nu incape vizual
   in coloana (utilizator a redimensionat sub width), se taie cu ellipsis. Aplicat
   pe ambele clase CSS folosite de GridViewEx: my-custom-header (mod normal) si
   my-custom-header-filter (mod filtru activ). */
.my-custom-header,
.my-custom-header-filter,
.my-custom-header .qx-atom-label,
.my-custom-header-filter .qx-atom-label {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* 2026-06-01: personalizarea taskbar-ului de jos (icon-only / half-height) a fost ELIMINATA.
   Motiv tehnic (verificat live in DOM): taskbar-ul desktop randeaza item-uri ca
   `.qx-desktop-taskbar-item-horizontal` — patrate de 40px cu DOAR un <img>, pozitionate
   absolut prin layout-ul intern qooxdoo (stil inline JS-driven). Orice override CSS de
   box-model (height/width pe item) il face sa se prabuseasca la 0, iar pentru "icon+text"
   nu exista niciun element de text (label) in DOM pe care sa-l afisam. Singura cale
   corecta = tema UI custom. */

/* Shortcut tile — stil card cu border albastru si shadow subtil.
   2026-06-07 (#34 user v2): background semi-transparent alb peste fundalul desktop —
   pe tema Sky (albastru) apare card semi-vizibil; pe Dark ramane lizibil. Pe Light pur alb,
   contrastul border albastru e suficient. NU mai hardcodez 100% white care strica Dark. */
/* 2026-06-11: ListBox/CheckedListBox afisat pe 2 coloane (Optiuni → Setari grid).
   Wisej rendeaza items intr-un container .qx-listbox. column-count pe el produce
   layout multi-coloana automat, ignorat de Wisej (e doar CSS layout). */
.wms-multicol-list .qx-list-list,
.wms-multicol-list .qx-listbox-list,
.wms-multicol-list .qx-virtual-list {
    column-count: 2 !important;
    column-gap: 16px !important;
    column-fill: balance !important;
}
.wms-multicol-list .qx-listitem,
.wms-multicol-list .qx-virtual-listitem {
    break-inside: avoid !important;
    -webkit-column-break-inside: avoid !important;
}

.wms-shortcut-tile-v2 {
    border: 3px solid #4698C9 !important;
    border-radius: 12px !important;
    box-shadow: 2px 3px 6px rgba(70,152,201,0.25) !important;
    overflow: hidden !important;
}
/* The icon is NOT scaled here any more. It used to be enlarged with a CSS size on the <img> (45cqmin,
   32–96 px) while the client still placed the caption for the icon's natural size, so a caption on two
   or three lines ran over the icon. The icon is now the tile's background image, placed in its own band
   by DashTileLayout (inline style), and the caption keeps to the padding left over.
   The caption shows at most two lines, then an ellipsis; the full title is in the tooltip. */
/* The icon is the button's own image (the background placement did not render). Its size follows the tile and the
   display mode chosen in Edit item (wms-tile-icon-*); the position comes from Wisej's text/image relation. The
   caption is clamped to two lines below, so it no longer runs over a large icon. Default ("center"): */
.wms-shortcut-tile-v2 {
    container-type: size !important;
}
.wms-shortcut-tile-v2 img {
    width: 40cqmin !important;
    height: 40cqmin !important;
    min-width: 28px !important;
    min-height: 28px !important;
    max-width: 88px !important;
    max-height: 88px !important;
    object-fit: contain !important;
}
.wms-shortcut-tile-v2 .qx-label,
.wms-shortcut-tile-v2 [name="label"] {
    white-space: normal !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    line-height: 1.25 !important;
}
/* Caption over a background icon: a shadow keeps it readable on any image and theme. */
.wms-tile-caption-onimage .qx-label,
.wms-tile-caption-onimage [name="label"] {
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.75), 0 0 2px rgba(0, 0, 0, 0.6) !important;
}
/* Desktop tiles carry NO background rule at all: a tile without its own colour must be painted by
   the active theme's button appearance, exactly like every other button in the application.
   Two earlier attempts got this wrong and are kept here as a warning:
     - forcing white, with a dark grey only when the theme was tagged "dark", made the tiles white
       on every other theme (Sky, Bootstrap, Fluent…) whatever the user had chosen;
     - forcing "background: transparent !important" removed the theme's button face as well, so the
       tiles no longer looked like buttons.
   When the user picks a colour it arrives as an inline BackColor from Wisej, which nothing here
   overrides. Only geometry (border, radius, icon scaling, label case) belongs in this class. */
body[class*="dark"] .wms-shortcut-tile-v2,
html[data-theme="dark"] .wms-shortcut-tile-v2 {
    border-color: #5DADE2 !important;
}
.wms-shortcut-tile-v2 .qx-label {
    text-transform: uppercase !important;
}

/* Selectorii imbricati pentru contoare uzuale Wisej (button > inner div) */
.wms-filter-mode-btn > div,
.wms-filter-mode-btn .qx-button {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* Hover/focus: usor mai opaque ca utilizatorul sa stie ca e clickabil.
   IMPORTANT: folosim background-color (NU shorthand "background:"), altfel
   se reseteaza background-image si dispare iconul Filter.svg pe hover. */
.wms-filter-mode-btn:hover {
    background-color: rgba(245, 245, 245, 0.85) !important;
    /* background-image / background-repeat / background-position pastrate din regula default */
    opacity: 1;
    color: rgba(40, 40, 40, 1) !important;
    border-color: rgba(150, 150, 150, 0.55) !important;
}

/* 2026-06-12 (audit #6): clase grid theme-aware pentru status assignment (TMS, alerte etc.).
   Folosesc variabile CSS custom — pe tema dark e suficient sa redefinesti
   `--wms-success-bg/fg` si `--wms-warning-bg/fg` in tema.json. */
:root {
    --wms-success-bg: #dcffdc;
    --wms-success-fg: #006400;
    --wms-warning-bg: #ffffc8;
    --wms-warning-fg: #b8860b;
}
.wms-row-success { background-color: var(--wms-success-bg) !important; color: var(--wms-success-fg) !important; }
.wms-row-warning { background-color: var(--wms-warning-bg) !important; color: var(--wms-warning-fg) !important; }

/* SIMULATED / REAL band on every connector panel in Settings → Integrations. Same theme variables as
   the grid status rows; a theme redefines them, including the danger pair. */
:root {
    --wms-danger-bg: #ffe1e1;
    --wms-danger-fg: #a40000;
}
.wms-integration-band { border: 1px solid currentColor; border-radius: 4px; opacity: 0.95; }
.wms-integration-band-ok { background-color: var(--wms-success-bg) !important; color: var(--wms-success-fg) !important; }
.wms-integration-band-warning { background-color: var(--wms-warning-bg) !important; color: var(--wms-warning-fg) !important; }
.wms-integration-band-danger { background-color: var(--wms-danger-bg) !important; color: var(--wms-danger-fg) !important; }
.wms-row-danger { background-color: var(--wms-danger-bg) !important; color: var(--wms-danger-fg) !important; }

/* Module / integration cards in Advanced options → Integrations. No colour of their own: border and badge take
   the text colour of the theme at low opacity, so they read on light and dark themes alike. */
.wms-module-card { border: 1px solid rgba(128, 128, 128, 0.38); border-radius: 6px; }
.wms-module-card-badge { border: 1px solid currentColor; border-radius: 6px; font-weight: 600; opacity: 0.75; }
.wms-module-card-title { font-weight: 600; }
.wms-module-card-status { opacity: 0.8; }

/* Display modes. Wisej places the caption from the icon's natural size, so an icon made larger here must stay inside
   the area above the caption: every mode is bounded by the tile's smaller side. "fit": as large as allowed; "fill":
   fills its square, cropped; "stretch": fills its square, proportions ignored; "original": the icon's own size. */
.wms-shortcut-tile-v2.wms-tile-icon-fit img { width: 55cqmin !important; height: 55cqmin !important; max-width: 140px !important; max-height: 140px !important; object-fit: contain !important; }
.wms-shortcut-tile-v2.wms-tile-icon-fill img { width: 55cqmin !important; height: 55cqmin !important; max-width: 140px !important; max-height: 140px !important; object-fit: cover !important; }
.wms-shortcut-tile-v2.wms-tile-icon-stretch img { width: 60cqmin !important; height: 45cqmin !important; max-width: 160px !important; max-height: 120px !important; object-fit: fill !important; }
.wms-shortcut-tile-v2.wms-tile-icon-original img { width: auto !important; height: auto !important; min-width: 0 !important; min-height: 0 !important; max-width: 96px !important; max-height: 96px !important; }
/* Icon left of the caption: a fixed 40 px icon pinned left, and the caption starts after it. */
/* With the icon left or behind the caption the tile uses Wisej's Overlay layout, where the icon is drawn by the
   ::after pseudo-element of a wisej-background-* class (stretched over the whole tile, background-size: contain),
   not by the tile's own background nor an <img>: it is sized and placed here, on ::after. */
.wms-shortcut-tile-v2.wms-tile-pos-left::after { left: 8px !important; width: 44px !important; padding: 0 !important; background-size: 40px 40px !important; background-position: center center !important; background-repeat: no-repeat !important; }
.wms-shortcut-tile-v2.wms-tile-pos-background::after { background-position: center !important; background-repeat: no-repeat !important; }
.wms-shortcut-tile-v2.wms-tile-pos-background.wms-tile-icon-fill::after { background-size: cover !important; padding: 0 !important; }
.wms-shortcut-tile-v2.wms-tile-pos-background.wms-tile-icon-stretch::after { background-size: 100% 100% !important; padding: 0 !important; }
.wms-shortcut-tile-v2.wms-tile-pos-left .qx-label,
.wms-shortcut-tile-v2.wms-tile-pos-left [name="label"] { padding-left: 50px !important; box-sizing: border-box !important; text-align: left !important; }
