/* ===================================================================
   operations.css — Unified mobile-first design for in/out/transfer
   =================================================================== */

.op-page{
  position: relative;
  z-index: 2;
  max-width: 720px;
  margin: 0 auto;
  padding: 96px 14px 110px; /* مساحة للـ topbar + sticky bottom */
  min-height: 100vh;
}

/* ====================================================
   HERO — مدمج وبسيط
==================================================== */
.op-hero{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.op-hero__type{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
}
.op-hero__type.in{ background: rgba(16,185,129,0.18); color: var(--au-ok); }
.op-hero__type.out{ background: rgba(239,68,68,0.18); color: var(--au-bad); }
.op-hero__type.transfer{ background: rgba(6,182,212,0.18); color: var(--au-accent); }

.op-hero__title{
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--au-text-1);
}

.op-hero__user{
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--au-accent), var(--au-accent-2));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 11px;
  cursor: default;
}

/* ====================================================
   WAREHOUSE picker — كبير، واضح
==================================================== */
.op-wh-bar{
  background: var(--au-surface-strong);
  border: 1px solid var(--au-border);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 12px;
  backdrop-filter: blur(var(--au-blur));
  -webkit-backdrop-filter: blur(var(--au-blur));
}
.op-wh-bar__row{
  display: flex;
  gap: 10px;
  align-items: center;
}
.op-wh-bar__row + .op-wh-bar__row{ margin-top: 8px; }
.op-wh-bar__label{
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--au-text-3);
  white-space: nowrap;
  min-width: 60px;
}
.op-wh-bar__select{
  flex: 1;
  height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--au-border);
  background: var(--au-surface);
  color: var(--au-text-1);
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
  padding-inline-start: 36px;
}
.op-wh-bar__select:focus{
  border-color: var(--au-accent);
  box-shadow: 0 0 0 3px rgba(6,182,212,0.18);
}

/* Transfer-specific: arrow between from/to */
.op-wh-arrow{
  display: flex; align-items: center; justify-content: center;
  color: var(--au-text-3);
  font-size: 18px;
  padding: 0 4px;
}

/* ====================================================
   SEARCH bar — كبير وواضح
==================================================== */
.op-search{
  position: relative;
  margin-bottom: 12px;
}
.op-search__input{
  width: 100%;
  height: 54px;
  padding: 0 56px 0 56px;
  border-radius: 14px;
  border: 1px solid var(--au-border-2);
  background: var(--au-surface-strong);
  color: var(--au-text-1);
  font-size: 16px;
  font-family: inherit;
  outline: none;
  backdrop-filter: blur(var(--au-blur));
  -webkit-backdrop-filter: blur(var(--au-blur));
  transition: border-color .15s, box-shadow .15s;
}
.op-search__input::placeholder{ color: var(--au-text-3); font-size: 14px; }
.op-search__input:focus{
  border-color: var(--au-accent);
  box-shadow: 0 0 0 4px rgba(6,182,212,0.18);
}
.op-search__icon{
  position: absolute;
  top: 50%; inset-inline-start: 18px;
  transform: translateY(-50%);
  color: var(--au-text-3);
  pointer-events: none;
}
.op-search__barcode{
  position: absolute;
  top: 50%; inset-inline-end: 8px;
  transform: translateY(-50%);
  width: 40px; height: 40px;
  border-radius: 10px;
  border: 1px solid var(--au-border);
  background: var(--au-surface);
  color: var(--au-text-1);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, transform .15s;
}
.op-search__barcode:hover{
  background: linear-gradient(135deg, var(--au-accent), var(--au-accent-2));
  color: #fff;
  border-color: transparent;
}
.op-search__barcode:active{ transform: translateY(-50%) scale(0.95); }

/* ✅ زر المسح السريع — برتقالي مميّز */
.op-search__fast{
  inset-inline-end: 56px; /* جنب زر الباركود العادي */
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  border: none;
  color: #fff;
  box-shadow: 0 4px 14px rgba(245,158,11,0.35);
}
.op-search__fast:hover{
  background: linear-gradient(135deg, #f59e0b, #dc2626);
  color: #fff;
}
/* ✅ لو في زرّين (سريع + عادي): زوّد padding للمدخل */
.op-search:has(.op-search__fast) .op-search__input{ padding-inline-end: 108px; }

/* ====================================================
   RESULTS overlay — fullscreen on mobile
==================================================== */
.op-results{
  position: fixed;
  inset: 0;
  background: rgba(5,6,20,0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 1500;
  display: none;
  flex-direction: column;
  animation: op-fade .15s ease-out;
}
.op-results.is-open{ display: flex; }
@keyframes op-fade{ from{ opacity: 0; } }

.op-results__head{
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid var(--au-border);
  background: var(--au-surface-strong);
}
.op-results__input{
  flex: 1;
  height: 46px;
  padding: 0 14px;
  border-radius: 11px;
  border: 1px solid var(--au-border-2);
  background: var(--au-surface);
  color: var(--au-text-1);
  font-size: 16px;
  font-family: inherit;
  outline: none;
}
.op-results__input:focus{
  border-color: var(--au-accent);
  box-shadow: 0 0 0 3px rgba(6,182,212,0.18);
}
.op-results__close{
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--au-surface-2);
  border: 1px solid var(--au-border);
  color: var(--au-text-1);
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.op-results__list{
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.op-result{
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 6px;
  background: var(--au-surface);
  border: 1px solid var(--au-border);
  cursor: pointer;
  transition: border-color .12s, background .12s, transform .08s;
}
.op-result__body{ min-width: 0; }
.op-result:hover{
  border-color: var(--au-accent);
  background: var(--au-surface-2);
}
.op-result:active{ transform: scale(0.98); }
.op-result__title{
  font-weight: 800;
  font-size: 14px;
  color: var(--au-text-1);
  line-height: 1.3;
}
.op-result__meta{
  font-size: 12px;
  color: var(--au-text-3);
  margin-top: 4px;
}
.op-result__qty{
  text-align: end;
  font-size: 11px;
  color: var(--au-text-3);
}
.op-result__qty b{
  display: block;
  font-size: 18px;
  font-weight: 800;
  color: var(--au-accent);
  font-variant-numeric: tabular-nums;
}
.op-result__qty.zero b{ color: var(--au-bad); }

.op-result__empty{
  padding: 60px 20px;
  text-align: center;
  color: var(--au-text-3);
  font-size: 14px;
}
.op-result__loading{
  padding: 30px;
  text-align: center;
  color: var(--au-text-3);
  font-size: 13px;
}

/* ====================================================
   CART — قائمة الأصناف المختارة
==================================================== */
.op-stats{
  display: flex;
  gap: 14px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--au-surface);
  border: 1px solid var(--au-border);
  margin-bottom: 10px;
  font-size: 12.5px;
  color: var(--au-text-3);
  font-variant-numeric: tabular-nums;
}
.op-stats b{ color: var(--au-text-1); font-weight: 800; }
.op-stats__spacer{ flex: 1; }

.op-cart{
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.op-item{
  position: relative;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--au-surface-strong);
  border: 1px solid var(--au-border);
  backdrop-filter: blur(var(--au-blur));
  -webkit-backdrop-filter: blur(var(--au-blur));
  animation: op-slide-in .25s cubic-bezier(.2,.8,.2,1);
}
@keyframes op-slide-in{ from{ opacity: 0; transform: translateY(-8px); } }

.op-item__top{
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}
.op-item__info{ min-width: 0; flex: 1; }
.op-item__title{
  font-weight: 800;
  font-size: 14.5px;
  color: var(--au-text-1);
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
}
.op-item__meta{
  font-size: 11.5px;
  color: var(--au-text-3);
  margin-top: 3px;
}
.op-item__delete{
  width: 32px; height: 32px;
  flex-shrink: 0;
  border-radius: 9px;
  background: var(--au-surface-2);
  border: 1px solid var(--au-border);
  color: var(--au-text-3);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.op-item__delete:hover{
  background: rgba(239,68,68,0.18);
  color: var(--au-bad);
  border-color: rgba(239,68,68,0.4);
}

/* Quantity stepper — كبير لزراع الموبايل */
.op-qty{
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  gap: 6px;
  align-items: stretch;
  height: 44px;
}
.op-qty__btn{
  border-radius: 10px;
  border: 1px solid var(--au-border);
  background: var(--au-surface);
  color: var(--au-text-1);
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
  transition: all .12s;
  -webkit-tap-highlight-color: transparent;
}
.op-qty__btn:hover{ background: var(--au-surface-2); border-color: var(--au-border-2); }
.op-qty__btn:active{ transform: scale(0.94); }
.op-qty__btn.minus:hover{
  background: rgba(239,68,68,0.18);
  color: var(--au-bad);
  border-color: rgba(239,68,68,0.4);
}
.op-qty__btn.plus:hover{
  background: rgba(16,185,129,0.18);
  color: var(--au-ok);
  border-color: rgba(16,185,129,0.4);
}
.op-qty__input{
  height: 100%;
  width: 100%;
  text-align: center;
  border-radius: 10px;
  border: 1px solid var(--au-border);
  background: var(--au-surface);
  color: var(--au-text-1);
  font-size: 18px;
  font-weight: 800;
  font-family: ui-monospace, Menlo, monospace;
  font-variant-numeric: tabular-nums;
  outline: none;
}
.op-qty__input:focus{
  border-color: var(--au-accent);
  box-shadow: 0 0 0 3px rgba(6,182,212,0.18);
}

/* available quantity warning */
.op-item__avail{
  font-size: 11px;
  font-weight: 700;
  margin-top: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  display: inline-block;
}
.op-item__avail.ok{ background: rgba(16,185,129,0.14); color: var(--au-ok); }
.op-item__avail.warn{ background: rgba(245,158,11,0.16); color: var(--au-warn); }
.op-item__avail.bad{ background: rgba(239,68,68,0.16); color: var(--au-bad); }

/* Empty cart */
.op-empty{
  padding: 50px 20px;
  text-align: center;
  color: var(--au-text-3);
  font-size: 13.5px;
  background: var(--au-surface);
  border: 1px dashed var(--au-border-2);
  border-radius: 14px;
}
.op-empty__icon{
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.4;
}

/* ====================================================
   STICKY bottom bar — السمت الأهم
==================================================== */
.op-submit-bar{
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 1200;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  background: var(--au-surface-strong);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--au-border-2);
  box-shadow: 0 -8px 24px rgba(0,0,0,0.2);
}
.op-submit-bar__inner{
  display: flex;
  gap: 8px;
  max-width: 720px;
  margin: 0 auto;
}
.op-submit-bar__stats{
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  font-size: 11.5px;
  color: var(--au-text-3);
  line-height: 1.3;
}
.op-submit-bar__stats b{
  color: var(--au-text-1);
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.op-btn{
  flex: 2;
  height: 50px;
  padding: 0 18px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, var(--au-accent), var(--au-accent-2));
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 8px 24px rgba(6,182,212,0.3);
  transition: transform .12s, box-shadow .2s, opacity .15s;
}
.op-btn:hover{ box-shadow: 0 12px 32px rgba(6,182,212,0.45); }
.op-btn:active{ transform: scale(0.97); }
.op-btn:disabled{ opacity: 0.5; cursor: not-allowed; }
.op-btn.in{ background: linear-gradient(135deg, var(--au-ok), #059669); box-shadow: 0 8px 24px rgba(16,185,129,0.3); }
.op-btn.out{ background: linear-gradient(135deg, var(--au-bad), #dc2626); box-shadow: 0 8px 24px rgba(239,68,68,0.3); }
.op-btn.transfer{ background: linear-gradient(135deg, var(--au-accent), var(--au-accent-2)); }

.op-btn--ghost{
  flex: 0 0 auto;
  background: var(--au-surface);
  color: var(--au-text-2);
  border: 1px solid var(--au-border);
  box-shadow: none;
}
.op-btn--ghost:hover{ background: var(--au-surface-2); color: var(--au-text-1); }

/* ====================================================
   NOTE field (collapsed by default — tap to expand)
==================================================== */
.op-note-toggle{
  width: 100%;
  text-align: start;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px dashed var(--au-border);
  background: transparent;
  color: var(--au-text-3);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.op-note-toggle:hover{ border-color: var(--au-border-2); color: var(--au-text-2); }
.op-note-toggle.has-note{
  border-style: solid;
  border-color: var(--au-accent);
  background: rgba(6,182,212,0.06);
  color: var(--au-text-1);
}
.op-note-field{
  display: none;
  margin-top: 8px;
}
.op-note-field.is-open{ display: block; }
.op-note-field textarea{
  width: 100%;
  min-height: 70px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--au-border);
  background: var(--au-surface);
  color: var(--au-text-1);
  font-family: inherit;
  font-size: 13.5px;
  outline: none;
  resize: vertical;
}
.op-note-field textarea:focus{
  border-color: var(--au-accent);
  box-shadow: 0 0 0 3px rgba(6,182,212,0.18);
}

/* hidden compat fields */
.op-legacy{ display: none !important; }

/* ====================================================
   Toast confirmation overlay
==================================================== */
.op-confirm{
  position: fixed; inset: 0; z-index: 1700;
  background: rgba(5,6,20,0.7);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.op-confirm.is-open{ display: flex; }
.op-confirm__panel{
  width: 100%;
  max-width: 380px;
  padding: 22px;
  border-radius: 18px;
  background: var(--au-surface-strong);
  border: 1px solid var(--au-border-2);
  text-align: center;
  animation: op-slide-in .2s;
}
.op-confirm__icon{
  font-size: 40px;
  margin-bottom: 12px;
}
.op-confirm__title{
  font-size: 17px;
  font-weight: 800;
  color: var(--au-text-1);
  margin-bottom: 6px;
}
.op-confirm__sub{
  font-size: 13px;
  color: var(--au-text-3);
  margin-bottom: 18px;
  line-height: 1.6;
}
.op-confirm__actions{
  display: flex; gap: 8px;
}
.op-confirm__actions .op-btn,
.op-confirm__actions .op-btn--ghost{ flex: 1; }

/* ====================================================
   Responsive — already mobile-first; just tune desktop
==================================================== */
@media (min-width: 700px){
  .op-page{ padding: 100px 20px 100px; }
}
