/* Shared portal/catalogue primitives. Do not load in Frappe Desk or login. */
.js-icon { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:root {
  --js-font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --js-primary: #2563eb;
  --js-primary-hover: #1d4ed8;
  --js-sidebar: #1e293b;
  --js-text: #1f2937;
  --js-muted: #64748b;
  --js-line: #dce2ea;
  --js-soft: #f1f5f9;
  --js-bg: #f6f8fb;
  --js-surface: #fff;
  --js-green: #166534;
  --js-red: #b91c1c;
  --js-amber: #92400e;
  --js-shadow: none;
  --js-radius: var(--js-radius-panel);
  --js-radius-small: 4px;
  --js-radius-control: 4px;
  --js-radius-panel: 6px;
  --js-radius-dialog: 8px;
  --js-radius-pill: 4px;
  --js-control-size: 44px;
  --js-ui-accent: var(--js-primary);
  --js-ui-ink: var(--js-text);
  --js-ui-line: var(--js-line);
  --js-ui-soft: var(--js-soft);
  --js-ui-surface: var(--js-surface);
  --js-scroll-thumb: #94a3b8;
  --js-scroll-track: #f1f5f9;
}

html:has(body:is(.jasultanija-app-page, .jasultanija-shop-page)),
body:is(.jasultanija-app-page, .jasultanija-shop-page),
body:is(.jasultanija-app-page, .jasultanija-shop-page) * {
  scrollbar-color: var(--js-scroll-thumb) var(--js-scroll-track);
  scrollbar-width: thin;
}

html:has(body:is(.jasultanija-app-page, .jasultanija-shop-page))::-webkit-scrollbar,
body:is(.jasultanija-app-page, .jasultanija-shop-page) ::-webkit-scrollbar { width: 10px; height: 10px; }
body:is(.jasultanija-app-page, .jasultanija-shop-page) ::-webkit-scrollbar-track { background: var(--js-scroll-track); }
body:is(.jasultanija-app-page, .jasultanija-shop-page) ::-webkit-scrollbar-thumb {
  background: var(--js-scroll-thumb);
  border: 2px solid var(--js-scroll-track);
  border-radius: var(--js-radius-small);
}
body:is(.jasultanija-app-page, .jasultanija-shop-page) ::-webkit-scrollbar-thumb:hover { background: var(--js-ui-accent); }

:where(body.jasultanija-app-page, body.jasultanija-shop-page) :is(button, input, select, textarea) { font: inherit; }
body:is(.jasultanija-app-page, .jasultanija-shop-page) { color-scheme: light; }
body:is(.jasultanija-app-page, .jasultanija-shop-page) select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
  padding-inline-end: 40px;
}
:where(body.jasultanija-app-page, body.jasultanija-shop-page) button {
  touch-action: manipulation;
  min-width: var(--js-control-size); min-height: var(--js-control-size);
}
body:is(.jasultanija-app-page, .jasultanija-shop-page) :is(button, a, input, select, textarea):focus-visible {
  outline: 2px solid var(--js-ui-accent);
  outline-offset: 3px;
}
body:is(.jasultanija-app-page, .jasultanija-shop-page) button:disabled { cursor: not-allowed; opacity: .55; }
body:is(.jasultanija-app-page, .jasultanija-shop-page) :is(input, select, textarea):disabled {
  color: var(--js-muted); background: var(--js-soft); cursor: not-allowed; opacity: 1;
}
/* Keep controls square; the containing label provides the 44px hit target. */
body:is(.jasultanija-app-page, .jasultanija-shop-page) :is(input[type=checkbox], input[type=radio]) {
  appearance: auto; accent-color: var(--js-ui-accent); box-sizing: border-box;
  width: 22px; height: 22px; min-width: 22px; min-height: 22px; max-width: 22px; max-height: 22px;
  flex: 0 0 22px; padding: 0; margin: 0; vertical-align: middle; align-self: center;
  cursor: pointer; border-radius: 4px;
}
body:is(.jasultanija-app-page, .jasultanija-shop-page) :is(.check-field, .studio-record-field.is-check) { min-height: 44px; align-items: center; }
body:is(.jasultanija-app-page, .jasultanija-shop-page) input::placeholder { color: var(--js-muted); opacity: 1; }

/* Progressive enhancement: keep native steppers if JS does not enhance a field. */
.js-number-control {
  display: grid; grid-template-columns: var(--js-control-size) minmax(0, 1fr) var(--js-control-size);
  align-items: stretch; width: 100%; min-width: 0;
}
body:is(.jasultanija-app-page, .jasultanija-shop-page) .js-number-control > input {
  width: 100%; min-width: 0; min-height: var(--js-control-size); padding: 8px 4px;
  border-radius: 0; text-align: center; font-size: 16px; appearance: textfield;
}
.js-number-control > input::-webkit-inner-spin-button,
.js-number-control > input::-webkit-outer-spin-button { appearance: none; margin: 0; }
body:is(.jasultanija-app-page, .jasultanija-shop-page) .js-number-button {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--js-control-size); min-height: var(--js-control-size); padding: 0;
  border: 1px solid var(--js-ui-line); color: var(--js-ui-accent); background: var(--js-ui-soft);
  font-size: 20px; font-weight: 700; line-height: 1; cursor: pointer;
}
.js-number-button:first-child { border-right: 0; border-radius: var(--js-radius-control) 0 0 var(--js-radius-control); }
.js-number-button:last-child { border-left: 0; border-radius: 0 var(--js-radius-control) var(--js-radius-control) 0; }
.js-number-button:hover:not(:disabled) { background: #e2e8f0; }
.js-number-control:focus-within { border-radius: var(--js-radius-control); outline: 2px solid var(--js-primary); outline-offset: 2px; }

/* Frappe's website connectivity alerts must not cover portal navigation. */
body:is(.jasultanija-app-page, .jasultanija-shop-page) #alert-container {
  right: 12px; bottom: 12px; max-width: calc(100vw - 24px);
  max-height: 35dvh; overflow-y: auto;
}
body:is(.jasultanija-app-page, .jasultanija-shop-page) #alert-container .desk-alert {
  width: min(400px, calc(100vw - 24px)); border-radius: var(--js-radius-panel);
}
body:is(.jasultanija-app-page, .jasultanija-shop-page) #alert-container .alert-message-container { padding-right: 56px; }
body:is(.jasultanija-app-page, .jasultanija-shop-page) #alert-container .close {
  top: 4px; right: 4px; width: 44px; height: 44px; display: grid; place-items: center;
}
@media (max-width: 720px) {
  body.jasultanija-app-page #alert-container { bottom: calc(88px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  body:is(.jasultanija-app-page, .jasultanija-shop-page) *,
  body:is(.jasultanija-app-page, .jasultanija-shop-page) *::before,
  body:is(.jasultanija-app-page, .jasultanija-shop-page) *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
}
@media (forced-colors: active) {
  .js-number-button { border: 1px solid ButtonText; }
  body:is(.jasultanija-app-page, .jasultanija-shop-page) * { scrollbar-color: auto; }
}

body:is(.jasultanija-app-page, .jasultanija-shop-page) input[type=file]::file-selector-button {
  min-height: 44px; margin-inline-end: 8px; padding: 8px 12px;
  border: 1px solid var(--js-line); border-radius: var(--js-radius-control);
  color: var(--js-text); background: var(--js-surface); font: inherit; cursor: pointer;
}
