/* =========================================================
   GOparts.mn — Сэлбэг хайх popup + сагс (бүх хуудсанд)
   ========================================================= */
html.shop-lock { overflow: hidden; }

/* ---------- Popup ---------- */
.ps-modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 20px; }
.ps-modal[hidden], .cart[hidden] { display: none; }
.ps-backdrop, .cart-backdrop { position: absolute; inset: 0; background: rgba(23, 21, 15, .62); backdrop-filter: blur(3px); opacity: 0; transition: opacity .3s var(--ease); }
.ps-modal.is-open .ps-backdrop, .cart.is-open .cart-backdrop { opacity: 1; }
.ps-dialog {
  position: relative; width: min(600px, 100%); max-height: calc(100dvh - 40px); overflow-y: auto;
  padding: clamp(24px, 4vw, 36px); border-radius: var(--radius); background: var(--white);
  border-top: 5px solid var(--yellow); box-shadow: 0 30px 70px rgba(0, 0, 0, .35); outline: none;
  opacity: 0; transform: translateY(18px) scale(.97);
  transition: opacity .3s var(--ease), transform .35s cubic-bezier(.34, 1.4, .64, 1);
}
.ps-modal.is-open .ps-dialog { opacity: 1; transform: none; }
.ps-x {
  position: absolute; right: 12px; top: 12px; display: grid; place-items: center; width: 44px; height: 44px;
  border-radius: 50%; color: var(--gray-600); transition: background .2s var(--ease), color .2s var(--ease), transform .3s var(--ease);
}
.ps-x svg { width: 22px; height: 22px; }
.ps-x:hover { background: var(--gray-100); color: var(--black); transform: rotate(90deg); }
.ps-eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 2px; text-transform: uppercase; color: var(--gray-600); }
.ps-title { margin: 4px 0 22px; font-family: var(--font-display); font-weight: 800; font-size: clamp(30px, 4vw, 40px); text-transform: uppercase; line-height: 1; }

.ps-brands { border: 0; padding: 0; margin: 0 0 18px; }
.ps-brands legend, .ps-field label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 600; }
.ps-brand-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ps-brand { position: relative; cursor: pointer; }
.ps-brand input { position: absolute; opacity: 0; pointer-events: none; }
.ps-brand-box {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 84px; padding: 10px; border: 2px solid var(--gray-200); border-radius: var(--radius);
  font-size: 13px; font-weight: 600; color: var(--gray-700); text-align: center;
  transition: border-color .2s var(--ease), background .2s var(--ease), transform .2s var(--ease);
}
.ps-brand-box img { height: 30px; width: auto; max-width: 90%; object-fit: contain; filter: grayscale(1); opacity: .65; transition: filter .25s var(--ease), opacity .25s var(--ease); }
.ps-brand:hover .ps-brand-box { border-color: var(--gray-400); }
.ps-brand input:checked + .ps-brand-box { border-color: var(--yellow); background: var(--yellow-soft); color: var(--black); }
.ps-brand input:checked + .ps-brand-box img { filter: none; opacity: 1; }
.ps-brand input:focus-visible + .ps-brand-box { outline: 3px solid var(--yellow); outline-offset: 2px; }

.ps-input-row { display: flex; gap: 10px; }
.ps-input-row input {
  flex: 1; min-width: 0; min-height: 54px; padding: 12px 16px; border: 2px solid var(--gray-200); border-radius: var(--radius);
  font: inherit; font-size: 18px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; color: var(--black);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.ps-input-row input::placeholder { text-transform: none; font-weight: 400; letter-spacing: 0; color: var(--gray-400); }
.ps-input-row input:focus { outline: none; border-color: var(--black); box-shadow: 0 0 0 3px rgba(255, 194, 14, .5); }
.ps-submit { min-height: 54px; padding-inline: 22px; }
.ps-submit svg { width: 20px; height: 20px; }
.btn.ps-submit:hover svg { transform: none; }
.ps-submit.is-loading { opacity: .7; pointer-events: none; }
.ps-err { margin-top: 8px; font-size: 13px; font-weight: 600; color: #B3261E; }
.ps-err:empty { display: none; }

.ps-result:empty { display: none; }
.ps-result { margin-top: 22px; }
.ps-card { padding: 20px; border-radius: var(--radius); background: var(--gray-100); animation: psIn .4s var(--ease) both; }
@keyframes psIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.ps-loading { display: flex; align-items: center; gap: 12px; color: var(--gray-700); font-weight: 500; }
.ps-spin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--gray-200); border-top-color: var(--yellow-dark); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.ps-ok, .ps-added { background: #FFF8DD; box-shadow: inset 4px 0 0 var(--yellow); }
.ps-status { display: flex; gap: 14px; align-items: flex-start; }
.ps-icon { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--white); color: var(--gray-600); }
.ps-icon svg { width: 24px; height: 24px; }
.ps-icon--ok { background: var(--yellow); color: var(--black); animation: popIn .5s cubic-bezier(.34, 1.56, .64, 1) both; }
@keyframes popIn { from { transform: scale(0); } to { transform: none; } }
.ps-q { font-size: 17px; font-weight: 700; line-height: 1.35; }
.ps-stock { margin-top: 4px; font-size: 14px; color: var(--gray-700); line-height: 1.55; }
.ps-part { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 16px 0 0; padding: 12px 14px; border-radius: var(--radius); background: var(--white); }
.ps-part-brand { font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--gray-600); }
.ps-part-no { font-family: var(--font-display); font-weight: 800; font-size: 22px; letter-spacing: .5px; }
.ps-part-name { flex-basis: 100%; font-size: 14px; color: var(--gray-700); }
.ps-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; }
.ps-actions .btn svg { width: 18px; height: 18px; }

/* Тоо ширхэг: − 1 + */
.qty { display: inline-flex; align-items: center; border: 1px solid var(--gray-200); border-radius: var(--radius); background: var(--white); }
.qty-btn { display: grid; place-items: center; width: 44px; height: 46px; font-size: 22px; font-weight: 500; line-height: 1; color: var(--black); transition: background .2s var(--ease); }
.qty-btn:hover:not(:disabled) { background: var(--yellow-soft); }
.qty-btn:disabled { color: var(--gray-200); cursor: not-allowed; }
.qty-in, .qty-val { width: 48px; text-align: center; font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; }
.qty-in { height: 46px; border: 0; border-inline: 1px solid var(--gray-200); font-family: inherit; -moz-appearance: textfield; }
.qty-in::-webkit-inner-spin-button, .qty-in::-webkit-outer-spin-button { -webkit-appearance: none; }
.qty-in:focus { outline: none; background: var(--yellow-soft); }
.qty--sm .qty-btn { width: 36px; height: 36px; font-size: 19px; }
.qty--sm .qty-val { width: 36px; }

/* ---------- Сагс (баруунаас гулсана) ---------- */
.cart { position: fixed; inset: 0; z-index: 210; }
.cart-panel {
  position: absolute; right: 0; top: 0; bottom: 0; width: min(420px, 100%);
  display: flex; flex-direction: column; background: var(--white); box-shadow: -20px 0 50px rgba(0, 0, 0, .25); outline: none;
  transform: translateX(100%); transition: transform .38s cubic-bezier(.22, .9, .3, 1);
}
.cart.is-open .cart-panel { transform: none; }
.cart-head { position: relative; display: flex; align-items: center; justify-content: space-between; padding: 20px 20px 16px 24px; border-bottom: 4px solid var(--yellow); }
.cart-title { font-family: var(--font-display); font-weight: 800; font-size: 28px; text-transform: uppercase; }
.cart-n { color: var(--gray-400); }
.cart-x { position: static; }
.cart-list { flex: 1; overflow-y: auto; padding: 8px 24px; }
.cart-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--line); animation: psIn .35s var(--ease) both; }
.ci-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ci-brand { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--gray-600); }
.ci-no { font-family: var(--font-display); font-weight: 800; font-size: 20px; letter-spacing: .3px; }
.ci-name { font-size: 13px; color: var(--gray-700); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ci-ctrl { display: flex; align-items: center; gap: 6px; flex: none; }
.ci-del { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: var(--gray-400); transition: color .2s var(--ease), background .2s var(--ease); }
.ci-del svg { width: 18px; height: 18px; }
.ci-del:hover { color: #B3261E; background: #FBEAEA; }
.cart-empty { display: none; flex: 1; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; color: var(--gray-600); }
.cart-empty svg { width: 48px; height: 48px; color: var(--gray-200); }
.cart.is-empty .cart-empty { display: flex; }
.cart.is-empty .cart-list, .cart.is-empty .cart-foot { display: none; }
.cart-foot { padding: 18px 24px 24px; border-top: 1px solid var(--line); background: var(--gray-100); }
.cart-sum { display: flex; justify-content: space-between; margin-bottom: 14px; font-size: 14px; color: var(--gray-700); }
.cart-sum strong { color: var(--black); }
.cart-order { width: 100%; }
.cart-note { margin-top: 10px; font-size: 12px; color: var(--gray-600); text-align: center; }

/* Header-ийн сагс нэмэгдэхэд "үсэрнэ" */
[data-cart-open].is-bump svg { animation: cartBump .6s cubic-bezier(.34, 1.56, .64, 1); }
[data-cart-open].is-bump .cart-badge { animation: popIn .45s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes cartBump { 30% { transform: translateY(-4px) rotate(-8deg); } 60% { transform: translateY(0) rotate(6deg); } }
.cart-badge[hidden] { display: none; }

@media (max-width: 600px) {
  .ps-modal { padding: 0; place-items: end stretch; }
  .ps-dialog { width: 100%; max-height: 92dvh; border-radius: 14px 14px 0 0; transform: translateY(40px); }
  .ps-input-row { flex-direction: column; }
  .ps-brand-box { min-height: 72px; }
  .ps-actions .btn { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) {
  .ps-dialog, .cart-panel, .ps-backdrop, .cart-backdrop { transition: none; }
  .ps-card, .cart-item, .ps-icon--ok { animation: none; }
}
/* John Deere лого (зөвхөн буга) жижиг харагддаг тул томруулна */
.ps-brand-box img[src*="john-deere"] { height: 52px; }
.ps-brand-box img[src*="komatsu"] { height: 22px; }
/* Логоны доорх нэргүй (№49): лого бага зэрэг томорсон */
.ps-brand-box { min-height: 78px; }
.ps-brand-box img { height: 36px; }

/* ---------- Хайлтын үр дүнгийн уриалга ---------- */
.ps-cta-msg { margin-top: 6px; padding: 8px 12px; border-radius: var(--radius); background: var(--white); font-size: 15px; line-height: 1.45; color: var(--black); box-shadow: inset 3px 0 0 var(--yellow); }
.ps-cta-msg b { letter-spacing: .3px; }
.ps-none .ps-cta-msg { box-shadow: inset 3px 0 0 var(--black); }

/* ---------- Сагс: checkbox ---------- */
.cart-all { display: flex; align-items: center; gap: 10px; padding: 12px 24px; border-bottom: 1px solid var(--line); font-size: 14px; font-weight: 600; cursor: pointer; }
.cart.is-empty .cart-all { display: none; }
.cart-all input, .ci-check input { width: 20px; height: 20px; accent-color: var(--yellow-dark); cursor: pointer; }
.ci-check { flex: none; position: relative; display: grid; place-items: center; width: 28px; height: 28px; cursor: pointer; }
.ci-check input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; }
.ci-check span { display: grid; place-items: center; width: 22px; height: 22px; border: 2px solid var(--gray-400); border-radius: 5px; background: var(--white); color: transparent; transition: background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease), transform .25s cubic-bezier(.34, 1.56, .64, 1); }
.ci-check span svg { width: 14px; height: 14px; }
.ci-check input:checked + span { background: var(--yellow); border-color: var(--yellow-dark); color: var(--black); transform: scale(1.05); }
.ci-check input:focus-visible + span { outline: 3px solid var(--yellow); outline-offset: 2px; }
.cart-item { gap: 10px; }
.cart-item .ci-info { flex: 1; }
.cart-item.is-off .ci-info, .cart-item.is-off .ci-ctrl { opacity: .45; }
.ci-tag { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 3px; background: #E6F4EA; color: #1E7A3D; font-style: normal; font-size: 10px; font-weight: 700; letter-spacing: .3px; text-transform: none; vertical-align: 1px; }
.ci-tag--order { background: var(--yellow-soft); color: #7A5A00; }
.cart-order:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

/* ---------- Үнийн санал авах popup ---------- */
.qm-dialog { width: min(640px, 100%); }
.qm .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.qm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.qm-full { grid-column: 1 / -1; }
.qm-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.qm-field label { font-size: 14px; font-weight: 600; }
.qm-field .req { color: var(--yellow-dark); }
.qm-field input, .qm-field textarea {
  width: 100%; min-height: 46px; padding: 11px 14px; border: 1px solid var(--gray-200); border-radius: var(--radius);
  font: inherit; font-size: 15px; color: var(--black); background: var(--white); transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.qm-field textarea { resize: vertical; min-height: 150px; line-height: 1.55; }
.qm-field input:focus, .qm-field textarea:focus { outline: none; border-color: var(--black); box-shadow: 0 0 0 3px rgba(255, 194, 14, .45); }
.qm-field.has-error input, .qm-field.has-error textarea { border-color: #B3261E; }
.qm-err, .qm-form-err { font-size: 13px; font-weight: 600; color: #B3261E; }
.qm-err:empty, .qm-form-err:empty { display: none; }
.qm-form-err { margin-top: 12px; }
.qm-send { margin-top: 18px; }
.qm-send.is-loading { opacity: .7; pointer-events: none; }
.qm-done { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; outline: none; animation: psIn .4s var(--ease) both; }
.qm-done[hidden], .qm-form[hidden] { display: none; }
.qm-done .done-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--yellow); animation: popIn .5s cubic-bezier(.34, 1.56, .64, 1) both; }
.qm-done .done-icon svg { width: 26px; height: 26px; }
.qm-done h3 { font-family: var(--font-display); font-weight: 800; font-size: 26px; text-transform: uppercase; }
.qm-done p { color: var(--gray-700); line-height: 1.6; }
.qm-done a { font-weight: 600; text-decoration: underline; text-decoration-color: var(--yellow); }
.qm-demo { font-size: 13px; padding: 8px 12px; border-left: 3px solid var(--yellow); background: var(--gray-100); }
@media (max-width: 600px) {
  .qm-grid { grid-template-columns: minmax(0, 1fr); }
}
