/* assets/css/pages/calc.css */
/* Scope: calc.php page-only refinements (no globals) */

#result {
  scroll-margin-top: var(--space-4);
}

/* spacing helpers for this page only */
.calc-mt-12 { margin-top: 12px; }
.calc-mt-10 { margin-top: 10px; }

/* note under the card header */
.calc-note { margin-bottom: 12px; }

/* Selected list spacing */
.calc-selected{
  gap: 12px;

  /* فاصله از سرچ بالا و کارت خروجی پایین */
  margin-top: 12px;
  margin-bottom: 12px;
}
.calc-empty-hint{
  padding: 8px 6px;
  opacity: 0.75;
  font-size: var(--fs-1);
  line-height: 1.7;
  text-align: center;
   margin-top: 12px;
  margin-bottom: 14px;
  opacity: 0.65;
}
/* Yield block */
.calc-yield { padding: 12px; }
.calc-yield-title { font-size: 14px; }

/* Make nested cards feel lighter */
.card .card {
  background: var(--surface-2);
  box-shadow: none;
  border: 1px solid var(--border-soft);
}

/* Slightly tighter topbar on calc page */
.topbar .row .btn {
  height: 40px;
  padding: 0 12px;
}

/* Inputs block feels organized */
#selectedList .card {
  border: 1px solid var(--border-soft);
}

/* Search row layout (replaces inline styles) */
.calc-search-row {
  gap: 10px;
  align-items: flex-end;
}

.calc-search-col {
  flex: 1;
  min-width: 240px;
  position: relative;
}

.calc-suggest-wrap {
  position: relative;
}

.calc-suggest {
  position: absolute;
  inset-inline: 0;
  top: 8px;
  z-index: 50;
  padding: 10px;

  box-shadow: var(--shadow-2);
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.98);

  max-height: 60vh;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.calc-suggest-hint {
  margin-top: 8px;
  font-size: var(--fs-1);
  opacity: 0.9;
}

/* Suggest list buttons: make them consistent even if JS adds inline styles */
#mSuggestList .btn {
  width: 100% !important;
  justify-content: space-between !important;
  align-items: center !important;
  text-align: right;

  border-radius: 12px !important;
  border: 1px solid var(--border-soft) !important;
  background: rgba(17, 17, 17, 0.03) !important;

  padding: 10px 12px !important;

  /* reduce accidental tap while scrolling */
  touch-action: pan-y;
}

#mSuggestList .btn:hover {
  background: rgba(226, 180, 0, 0.10) !important;
}

/* highlight span produced by JS */
#mSuggestList span[style*="text-decoration:underline"] {
  text-decoration: none !important;
  box-shadow: inset 0 -2px 0 rgba(226, 180, 0, 0.35);
}

/* Form actions row (replaces style* selector) */
.calc-actions {
  justify-content: flex-end;
  margin-top: 12px;
}

/* Result list spacing */
.calc-result-list { margin-top: 12px; }

/* Mobile */
@media (max-width: 640px) {
  .topbar .row { width: 100%; }
  .topbar .row .btn { flex: 1; }

  .calc-actions {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-2);
  }

  .calc-actions .btn {
    width: 100%;
  }
}
/* --- Calc: compact qty row in selected material cards --- */
.calc-qty-row{
  margin-top: 10px;
  align-items: center;
  gap: 10px;
}

.calc-qty-label{
  white-space: nowrap;
  opacity: .85;
}

.calc-qty-input{
  width: 110px;          /* عدد کوتاه و خوش‌دست */
  text-align: center;
  padding-inline: 10px;
}

.calc-qty-unit .input{
  min-width: 110px;
}

/* Mobile: even tighter */
@media (max-width: 640px){
  .calc-qty-input{ width: 96px; }
  .calc-qty-unit .input{ min-width: 96px; }
}
/* این تغییر بین این دو خط اعمال شده */
.calc-remove-row{
  margin-top: 8px;
  display: flex;
  justify-content: center;   /* وسط */
}

.calc-remove-btn{
  width: 100%;
  max-width: 220px;          /* که خیلی غول نشه */
  height: 36px;
  padding: 0 12px;
  font-size: var(--fs-1);
}
/* این تغییر بین این دو خط اعمال شده */
/* --- Yield compact rows --- */
.calc-yield-row,
.calc-yield-waste{
  margin-top: 10px;
  align-items: center;
  gap: 10px;
}

.calc-yield-label{
  white-space: nowrap;
  opacity: .85;
}

.calc-yield-input{
  width: 120px;
  text-align: center;
  padding-inline: 10px;
}

.calc-yield-unit .input{
  min-width: 110px;
}

.calc-yield-waste-input{
  width: 90px;
  text-align: center;
}

.calc-yield-suffix{
  white-space: nowrap;
  opacity: .75;
}

@media (max-width: 640px){
  .calc-yield-input{ width: 104px; }
  .calc-yield-unit .input{ min-width: 96px; }
  .calc-yield-waste-input{ width: 84px; }
}
/* --- Result cards: compact & aligned (title|price then qty|pct) --- */

/* top row: title (right) | price pill (left) */
#result .calc-res-top{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

#result .calc-res-top .h2{
  flex: 1;
  min-width: 0;
}

#result .calc-res-top .pill{
  width: auto !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  padding-inline: 12px;
  margin-inline-start: auto; /* بچسب به چپ */
  min-width: 92px;          /* ستون قیمت ثابت‌تر برای هم‌ترازی */
}

/* meta row: qty under title (right) | pct under price (left) */
#result .calc-res-meta{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

#result .calc-res-meta > :first-child{
  text-align: right;
  white-space: nowrap;
}

#result .calc-res-pct{
  min-width: 92px;          /* دقیقاً هم‌عرض با pill */
  display: inline-flex;
  justify-content: center;  /* وسط ستون قیمت */
  text-align: left;
  white-space: nowrap;
}
