/* Skin for the awgp.js UI framework (UIObject / SC / UIDoc, loaded from yugrishi-erp): the CMS
   windows, forms and tables, plus the few dialogs visitors see (ads, comments).
   awgp.js writes inline styles, so some rules need !important. Structure it produces:
     .screenLockView > div > ( .row > .scFormDiv > .scForm | .scForm )
     .scForm > div(header: title + "X" button) + div(content) + div(tools: buttons)
     .uiDocForm .form-row > .form-label + .form-input      table.whightTable > tr.tableHeaderTR / tr.tableBodyTR */

/* ---- overlay */
.screenLockView {
  background: rgba(12, 10, 9, .55) !important; backdrop-filter: blur(2px);
  overflow-y: auto; overscroll-behavior: contain; animation: awgp-fade .2s ease;
}
@keyframes awgp-fade { from { opacity: 0; } to { opacity: 1; } }
.screenLockView > div { min-height: 100%; }

/* ---- window */
/* basic.css still offsets .scFormDiv (right/bottom, for a corner pop-up that was removed) below 992px,
   which pushed every dialog up and to the side */
.screenLockView .scFormDiv { inset: auto !important; }

.screenLockView { --awgp-gap: clamp(16px, 6vh, 72px); }
.scForm {
  margin: var(--awgp-gap) auto !important; overflow: hidden;
  display: flex; flex-direction: column; max-height: calc(100dvh - 2 * var(--awgp-gap));
  border-radius: var(--radius-lg) !important; border: 1px solid rgba(0, 0, 0, .06);
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .55) !important;
  font-family: var(--font-sans); color: var(--ink); text-align: left;
  animation: awgp-pop .25s var(--ease);
}
@keyframes awgp-pop { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }
.screenLockView > div > .scForm { margin: 0 !important; height: calc(100dvh - 20px) !important; max-height: none; }   /* SC.page */
.scForm > div:nth-child(2) { flex: 1 1 auto; min-height: 0; overflow: auto; }
.scForm > div:first-child, .scForm > div:last-child:not(:nth-child(2)) { flex-shrink: 0; }

/* header */
.scForm > div:first-child {
  display: flex; align-items: center; gap: var(--space-3); min-height: 60px;
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-5) !important;
  background: linear-gradient(180deg, var(--stone-50), var(--white)); border-bottom: var(--hairline);
  box-shadow: inset 0 3px 0 var(--saffron-500);
}
/* legacy code restyles the title (display:table; width:100%; height:40px) and puts floated, top-margined
   breadcrumbs in it, which pushed the close button out of the window: neutralise that */
.scForm > div:first-child > div:first-child {
  flex: 1 1 auto; min-width: 0; width: auto !important; height: auto !important; display: block !important;
  font-size: var(--text-lg) !important; font-weight: var(--weight-medium); color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.scForm > div:first-child > div:first-child div {
  display: inline !important; float: none !important; margin: 0 !important; padding: 0 !important;
}
.scForm > div:first-child > button {
  float: none !important; order: 9; flex: 0 0 38px; width: 38px; height: 38px; min-height: 0; margin-left: auto; padding: 0 !important;
  border: 0; border-radius: 50%; background: var(--stone-100); color: transparent; font-size: 0; position: relative;
  transition: background var(--duration);
}
.scForm > div:first-child > button::after { content: "\2715"; position: absolute; inset: 0; display: grid; place-items: center; font-size: .9rem; color: var(--ink); }
.scForm > div:first-child > button:hover { background: var(--stone-200); }

/* content */
.scForm > div:nth-child(2) { padding: var(--space-5) var(--space-5) !important; scrollbar-width: thin; }

/* tools (button bar) */
.scForm > div:last-child:not(:first-child):not(:nth-child(2)):not(:empty) {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2);
  padding: var(--space-3) var(--space-5) !important; background: var(--stone-50); border-top: var(--hairline);
}
.scForm > div:last-child:empty { display: none; }

/* ---- buttons */
.scForm button:not(.auth-btn), .scForm input[type="button"], .scForm input[type="submit"],
.screenLockView button:not(.auth-btn) {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem; min-height: 38px; padding: .45rem 1rem;
  border: 1px solid var(--stone-300); border-radius: var(--radius-pill); background: var(--white); color: var(--ink);
  font: var(--weight-semibold) var(--text-sm)/1.2 var(--font-sans); cursor: pointer; float: none;
  transition: background var(--duration), border-color var(--duration), color var(--duration);
}
.scForm button:not(.auth-btn):hover, .scForm input[type="button"]:hover, .screenLockView button:not(.auth-btn):hover { border-color: var(--ink); }
/* first action in the bar is the primary one */
.scForm > div:last-child > button:first-child { background: var(--ink); border-color: var(--ink); color: var(--white); }
.scForm > div:last-child > button:first-child:hover { background: #000; }
.scForm > div:last-child > button:not(:first-child) { background: var(--white); }
.scForm button:disabled, .scForm input[type="button"]:disabled { opacity: .5; cursor: not-allowed; }
.awgp-button { border-radius: var(--radius-pill) !important; }

/* ---- forms (UIDoc mode "form") */
.uiDocForm .form-section-title, .uiDocBaseDiv .form-section-title {
  font-size: var(--text-lg); font-weight: var(--weight-semibold); margin: 0 0 var(--space-3); color: var(--ink);
}
.uiDocForm .form-section-description:empty, .uiDocBaseDiv .form-section-description:empty, .docHeaderView:empty, .docFooterView:empty { display: none; }
.uiDocForm .form-row { margin: 0 0 var(--space-4); }
.uiDocForm .form-label { margin-bottom: .35rem; font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--stone-700); }
.uiDocForm .form-label:empty { display: none; }
.uiDocForm .form-label.mendetry { color: var(--ink); }
.uiDocForm .form-input > input[type="text"], .uiDocForm .form-input > input[type="password"], .uiDocForm .form-input > input[type="number"],
.uiDocForm .form-input > input[type="email"], .uiDocForm .form-input > input[type="date"], .uiDocForm .form-input > input[type="datetime-local"],
.uiDocForm .form-input > input[type="time"], .uiDocForm .form-input > select, .uiDocForm .form-input > textarea,
.whightTable input[type="text"], .whightTable select, .whightTable textarea {
  width: 100%; min-height: 42px; padding: .5rem .8rem; border: 1px solid var(--stone-300); border-radius: 10px;
  background: var(--white); color: var(--ink); font: var(--text-sm)/1.4 var(--font-sans);
  transition: border-color var(--duration), box-shadow var(--duration);
}
.uiDocForm .form-input > textarea, .whightTable textarea { min-height: 96px; resize: vertical; }
.uiDocForm .form-input > select { appearance: auto; }
.uiDocForm .form-input > input:focus, .uiDocForm .form-input > select:focus, .uiDocForm .form-input > textarea:focus,
.whightTable input:focus, .whightTable select:focus, .whightTable textarea:focus { outline: 0; border-color: var(--saffron-500); box-shadow: var(--focus-ring); }
.uiDocForm .form-input > input[readonly], .uiDocForm .form-input > input:disabled { background: var(--stone-50); color: var(--stone-600); }
.uiDocForm .form-input > input[type="checkbox"], .whightTable input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--saffron-600); }
/* read-only values (type "Div") */
.uiDocForm .form-input > div[id]:not(.cke):not(:empty) {
  padding: .5rem .8rem; border-radius: 10px; background: var(--stone-50); border: 1px dashed var(--stone-200);
  font-size: var(--text-sm); color: var(--stone-700); word-break: break-word;
}
.uiDocForm .form-input > div:not([id]) { font-size: var(--text-xs) !important; color: var(--stone-500) !important; margin-top: .25rem; }
.uiDocForm .form-input > div:not([id]):empty { display: none; }
/* a form made only of buttons (settings menus) becomes a tile grid */
.uiDocForm .form-input > input[type="button"] { width: 100%; min-height: 48px; justify-content: flex-start; border-radius: 12px; text-align: left; }
.uiDocForm .form-row:has(> .form-label:empty) { margin-bottom: var(--space-2); }

/* ---- tables (UIDoc mode "table") */
.whightTable { border-collapse: separate !important; border-spacing: 0; width: 100%; font-size: var(--text-sm); }
.whightTable thead td, .whightTable thead th, .whightTable .tableHeaderTR > * {
  position: sticky; top: 0; z-index: 1; padding: .65rem .8rem; background: var(--stone-100); color: var(--stone-600);
  font-size: var(--text-xs); font-weight: var(--weight-semibold) !important; letter-spacing: .06em; text-transform: uppercase;
  border-bottom: 1px solid var(--stone-200); white-space: nowrap;
}
.whightTable thead tr > *:first-child { border-top-left-radius: 10px; }
.whightTable thead tr > *:last-child { border-top-right-radius: 10px; }
.whightTable thead .noPrint { opacity: .45; font-size: .7rem; }
.whightTable tbody td { padding: .6rem .8rem; border-bottom: 1px solid var(--stone-100); vertical-align: middle; }
.whightTable tbody tr { transition: background var(--duration); }
.whightTable tbody tr:hover { background: var(--saffron-50); }
.whightTable tbody tr.selectedRow, .whightTable .selectedRow { background: var(--saffron-100) !important; }
.whightTable tbody input[type="button"] { width: auto !important; min-height: 32px; padding: .3rem .8rem; font-size: var(--text-xs); }
.whightTable img { max-width: 120px; border-radius: 6px; }
.uiPagger { display: flex; flex-wrap: wrap; gap: 4px; margin-top: var(--space-3); }

/* ---- vertical tabs / accordion / list of values */
.awgpVerTab .nav-link { border-radius: 10px; color: var(--stone-700); font-size: var(--text-sm); text-align: left; }
.awgpVerTab .nav-link.active { background: var(--ink) !important; color: var(--white) !important; }
.awgpUIAccordianTitle { padding: .7rem 1rem; border: var(--hairline); border-radius: 10px; background: var(--stone-50); font-weight: var(--weight-medium); cursor: pointer; margin-top: var(--space-2); }
.awgpUIAccordianContent { padding: var(--space-3) var(--space-2); }
.uiListOfValue, .listOpen { border-radius: 10px; box-shadow: var(--shadow-lg); border: var(--hairline); background: var(--white); }

/* ---- CKEditor (moono-lisa skin, restyled; setup in frontend/scripts/components/ckeditor-setup.js) */
.cke.cke_chrome {
  box-sizing: border-box; max-width: 100%; border: 1px solid var(--stone-300); border-radius: 12px; overflow: hidden; box-shadow: none; padding: 0;
  background: var(--white); transition: border-color var(--duration), box-shadow var(--duration);
}
.cke.cke_chrome:focus-within, .cke.cke_chrome.is-focused { border-color: var(--saffron-500); box-shadow: var(--focus-ring); }
.cke.cke_maximized { border-radius: 0; }
.cke_chrome .cke_top {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 2px;
  padding: 6px 8px; background: var(--stone-50); border-bottom: 1px solid var(--stone-200); box-shadow: none;
}
.cke_chrome .cke_top .cke_toolbox { display: contents; }
.cke_chrome .cke_toolbar { float: none; display: inline-flex; align-items: center; margin: 0 10px 0 0; }
.cke_chrome .cke_toolbar_start, .cke_chrome .cke_toolbar_end { display: none; }
.cke_chrome .cke_toolgroup { float: none; display: inline-flex; margin: 0; padding: 0; border: 0; background: none; }
.cke_chrome .cke_toolgroup a.cke_button:last-child::after { content: none; border: 0; }   /* the skin's group divider: groups are spaced instead */
.cke_chrome .cke_toolbar_separator { float: none; display: inline-block; height: 18px; margin: 0 4px; background: var(--stone-200); }
.cke_chrome a.cke_button { float: none; display: inline-flex; align-items: center; height: 30px; padding: 0 6px; border: 0; border-radius: 7px; }
.cke_chrome a.cke_button_off:hover, .cke_chrome a.cke_button_off:focus, .cke_chrome a.cke_button_off:active { background: var(--stone-200); border: 0; padding: 0 6px; }
.cke_chrome a.cke_button_on, .cke_chrome a.cke_button_on:hover, .cke_chrome a.cke_button_on:focus {
  background: var(--saffron-100); border: 0; padding: 0 6px;
}
.cke_chrome a.cke_button_disabled .cke_button_icon, .cke_chrome a.cke_button_disabled .cke_button_arrow { opacity: .35; }
.cke_chrome a.cke_button__source { padding: 0 8px; }
.cke_chrome .cke_button_label { font: 500 13px/30px var(--font-sans); color: var(--ink); }
.cke_chrome .cke_combo { float: none; display: inline-flex; margin: 0 2px 0 0; padding: 0; }
.cke_chrome .cke_combo::after { display: none; }
.cke_chrome a.cke_combo_button {
  float: none; display: inline-flex; align-items: center; height: 30px; margin: 0; padding: 0 4px 0 2px;
  border: 1px solid var(--stone-300); border-radius: 7px; background: var(--white);
}
.cke_chrome a.cke_combo_button:hover, .cke_chrome a.cke_combo_button:focus, .cke_chrome .cke_combo_on a.cke_combo_button {
  border-color: var(--stone-400); background: var(--white); box-shadow: none; padding: 0 4px 0 2px;
}
.cke_chrome .cke_combo_text { width: 74px; padding-left: 6px; font: 13px/28px var(--font-sans); color: var(--ink); }
.cke_chrome .cke_combo__font .cke_combo_text { width: 92px; }
.cke_chrome .cke_combo__fontsize .cke_combo_text { width: 44px; }
.cke_chrome .cke_combo_open { margin: 0 2px 0 4px; }
.cke_chrome .cke_bottom { padding: 0 8px; height: 18px; background: var(--white); border-top: 1px solid var(--stone-200); }
.cke_chrome .cke_resizer { margin-top: 6px; border-color: transparent var(--stone-400) transparent transparent; }
.cke_chrome .cke_contents { background: var(--white); }
/* drop-down lists, dialogs (link, image, table) */
.cke_panel.cke_combopanel, .cke_panel { border: 1px solid var(--stone-200); border-radius: 10px; box-shadow: var(--shadow-lg); overflow: hidden; }
.cke_dialog.cke_dialog_body, .cke_dialog .cke_dialog_body { border: 0; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-lg); }
.cke_dialog .cke_dialog_title { padding: 14px 18px; background: var(--white); border-bottom: 1px solid var(--stone-200); font: 600 15px var(--font-sans); color: var(--ink); }
.cke_dialog .cke_dialog_footer { background: var(--stone-50); border-top: 1px solid var(--stone-200); }
.cke_dialog a.cke_dialog_ui_button { border-radius: 8px; padding: 6px 14px; }
.cke_dialog a.cke_dialog_ui_button_ok { background: var(--ink); border-color: var(--ink); }
.cke_dialog a.cke_dialog_ui_button_ok:hover, .cke_dialog a.cke_dialog_ui_button_ok:focus { background: #000; border-color: #000; }
.cke_dialog input.cke_dialog_ui_input_text, .cke_dialog select.cke_dialog_ui_input_select, .cke_dialog textarea.cke_dialog_ui_input_textarea { border-radius: 7px; }
.cke_dialog .cke_dialog_ui_input_text:focus, .cke_dialog .cke_dialog_ui_input_select:focus, .cke_dialog .cke_dialog_ui_input_textarea:focus { border-color: var(--saffron-500); outline: 0; box-shadow: var(--focus-ring); }
/* phones: bigger touch targets */
@media (max-width: 640px) {
  .cke_chrome a.cke_button, .cke_chrome a.cke_combo_button { height: 36px; }
}

/* ---- editors: windows open as right-side panels (frontend/scripts/components/awgp-panels.js) */
.screenLockView.awgp-panel { overflow: hidden; text-align: left; }
.screenLockView.awgp-panel > div {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(680px, 100vw); height: 100% !important;
  max-width: none !important; min-height: 0; margin: 0 !important; padding: 0 !important;
}
.screenLockView.awgp-panel--wide > div { width: min(1200px, calc(100vw - 56px)); }
.awgp-panel .row { height: 100%; margin: 0 !important; --bs-gutter-x: 0; --bs-gutter-y: 0; }
.awgp-panel .row > .col-md-2 { display: none; }
.awgp-panel .scFormDiv { flex: 0 0 100%; width: 100% !important; max-width: 100%; height: 100%; padding: 0 !important; margin: 0 !important; }
.awgp-panel .scForm, .screenLockView.awgp-panel > div > .scForm {
  width: 100% !important; height: 100% !important; max-height: none; margin: 0 !important;
  border: 0; border-radius: 0 !important; box-shadow: -30px 0 60px -30px rgba(0, 0, 0, .5) !important;
  animation: awgp-slide .35s var(--ease);
}
@keyframes awgp-slide { from { transform: translateX(100%); } to { transform: none; } }
/* a panel opened from a panel: lighter shade so the screen doesn't go black */
.screenLockView.awgp-panel ~ .screenLockView.awgp-panel { background: rgba(12, 10, 9, .25) !important; backdrop-filter: none; }
@media (prefers-reduced-motion: reduce) { .awgp-panel .scForm { animation: none; } }

@media (max-width: 767.98px) {
  .screenLockView { --awgp-gap: 0px; }
  .scForm, .screenLockView > div > .scForm { margin: 0 !important; height: 100dvh !important; max-height: 100dvh; border-radius: 0 !important; border: 0; }
  .screenLockView > div { padding: 0 !important; margin: 0 !important; max-width: none !important; width: 100% !important; }
  .screenLockView .row { margin: 0 !important; --bs-gutter-x: 0; --bs-gutter-y: 0; }
  .scFormDiv { padding: 0 !important; width: 100% !important; }
  .screenLockView .row > .col-md-2 { display: none; }
  .scForm > div:first-child { padding-left: var(--space-4) !important; }
  .scForm > div:nth-child(2) { padding: var(--space-4) !important; }
  .screenLockView.awgp-panel > div, .screenLockView.awgp-panel--wide > div { width: 100vw; }
}
