/* ============================================================
   OPO v9.5 — Style Sheet
   نموذج مباشر داخل صفحة المنتج: أزرق، بدون حدود، نصوص واضحة
   ============================================================ */

/* ===== VARIABLES ===== */
:root {
  --op-blue:       #0f766e;   /* الأزرق الرئيسي (الزر) */
  --op-blue-dark:  #0b5a53;
  --op-blue-soft:  #e3f3f0;   /* خلفية العرض المختار */
  --op-blue-ring:  rgba(15, 118, 110, 0.18);
  --op-green:      #1f9d55;   /* شارة الخصم */
  --op-red:        #0b5a53;   /* السعر الجديد */
  --op-danger:     #dc3545;
  --op-text:       #14313a;
  --op-muted:      #5b7178;
  --op-field:      #eef6f4;   /* خلفية الحقول */
  --op-card:       #f5faf9;   /* خلفية بطاقة العرض */
  --op-radius:     12px;
  --op-font:       'IBM Plex Sans Arabic', 'Readex Pro', 'Segoe UI', Tahoma, Arial, sans-serif;
  --op-transition: all 0.2s ease;
}

/* ===== RESET ===== */
.op-order-form-container,
.op-order-form-container * {
  box-sizing: border-box;
  max-width: 100%;
}

/* ============================================================
   FORM CONTAINER
   ============================================================ */
.op-order-form-container {
  width: 100%;
  margin: 14px 0;
  padding: 0;
  direction: rtl;
  font-family: var(--op-font);
  color: var(--op-text);
  background: transparent;
}
.op-sticky-bar,
.op-modal { font-family: var(--op-font); }

/* عناصر مخفية */
.op-product-info,
.op-page-qty,
.op-hidden-field { display: none !important; }

/* عناوين الأقسام (العروض / المعلومات الشخصية) */
.op-section-title {
  margin: 18px 0 10px;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.4;
  text-align: right;
  color: var(--op-text);
}
.op-offers-section .op-section-title { margin-top: 6px; }

/* ============================================================
   OFFERS — بدون حدود
   ============================================================ */
.op-offers-section { width: 100%; margin: 0 0 18px; }

.op-offers-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.op-offer-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 108px;
  padding: 22px 16px;
  background: var(--op-card);
  border: 0;
  border-radius: var(--op-radius);
  box-shadow: none;
  cursor: pointer;
  direction: rtl;
  outline: none;
  transition: var(--op-transition);
}
.op-offer-item:hover { background: #edf1f9; }
.op-offer-item:focus-visible { box-shadow: 0 0 0 3px var(--op-blue-ring); }
.op-offer-item.active { background: var(--op-blue-soft); }

/* مؤشر الاختيار (أقصى اليمين) */
.op-offer-item::before {
  content: "";
  order: 0;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 2px #c3cad8;
  transition: var(--op-transition);
}
.op-offer-item.active::before {
  background: var(--op-blue);
  box-shadow: inset 0 0 0 5px #fff, 0 0 0 2px var(--op-blue);
}

/* ترتيب العناصر: مؤشر | العنوان + الشارة | السعر | الصورة (أقصى اليسار) */
.op-offer-mid {
  order: 1;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
.op-offer-price { order: 2; }
.op-offer-media { order: 3; }

.op-offer-title {
  margin: 0;
  font-size: 16.5px;
  font-weight: 700;
  line-height: 1.6;
  color: #111827;
}

.op-discount-badge {
  display: inline-block;
  padding: 3px 10px;
  background: var(--op-green);
  color: #fff;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}

.op-offer-price {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  text-align: left;
}
.op-new-price {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.3;
  color: var(--op-red);
  white-space: nowrap;
}
.op-old-price {
  font-size: 13px;
  line-height: 1.3;
  color: var(--op-muted);
  text-decoration: line-through;
  white-space: nowrap;
}

.op-offer-media {
  flex-shrink: 0;
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: #fff;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.op-offer-img { width: 100%; height: 100%; object-fit: cover; }

/* ============================================================
   INPUTS — بدون حدود (خلفية ناعمة)
   ============================================================ */
.op-input-group { width: 100%; margin-bottom: 14px; }

.op-label {
  display: block;
  margin-bottom: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--op-text);
  text-align: right;
}
.op-required { color: var(--op-danger); margin-right: 3px; }

.op-input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  background: var(--op-field);
  border: 0;
  border-radius: var(--op-radius);
  direction: rtl;
  overflow: hidden;
  transition: var(--op-transition);
}
.op-input-with-icon:focus-within {
  background: var(--op-blue-soft);
  box-shadow: 0 0 0 3px var(--op-blue-ring);
}

.op-icon {
  flex-shrink: 0;
  min-width: 42px;
  padding: 0 10px;
  font-size: 17px;
  text-align: center;
}

.op-input-with-icon input,
.op-input-with-icon select {
  flex: 1;
  min-width: 0;
  height: auto;
  margin: 0;
  padding: 14px 12px;
  border: 0 !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
  color: var(--op-text);
  font-family: inherit;
  font-size: 16px;
  text-align: right;
}
.op-input-with-icon input::placeholder { color: #9aa3b2; font-size: 15px; }
.op-input-with-icon select {
  appearance: none;
  -webkit-appearance: none;
  direction: rtl;
  cursor: pointer;
  padding-left: 38px;
  /* سهم القائمة */
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%237a828e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat left 14px center / 14px 9px !important;
}

.op-field-check {
  flex-shrink: 0;
  padding: 0 12px;
  font-size: 18px;
  font-weight: 700;
}
.op-check-valid   { color: var(--op-green); }
.op-check-invalid { color: var(--op-danger); }

.op-field-hint { margin-top: 5px; padding: 0 4px; font-size: 12.5px; text-align: right; }
.op-hint-error   { color: var(--op-danger); }
.op-hint-success { color: var(--op-green); }

/* ============================================================
   PRICE SUMMARY — بدون حدود
   ============================================================ */
.op-price-summary {
  margin: 8px 0 16px;
  padding: 0;
  background: transparent;
  border: 0;
}
.op-price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border: 0;
  font-size: 16px;
  color: var(--op-text);
}
.op-total {
  padding-top: 12px;
  font-size: 19px;
  font-weight: 800;
}
.op-discount-value { color: var(--op-green); font-weight: 700; }

/* ============================================================
   SUBMIT BUTTON — أزرق، النص في الوسط، بدون سعر
   ============================================================ */
.op-order-form-container .op-submit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 4px 0 0;
  padding: 15px 20px;
  background: var(--op-blue);
  color: #fff;
  border: 0;
  border-radius: 10px;
  box-shadow: none;
  font-family: inherit;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  letter-spacing: 0;
  cursor: pointer;
  transition: var(--op-transition);
  touch-action: manipulation;
}
.op-order-form-container .op-submit-btn:hover:not(:disabled) { background: var(--op-blue-dark); }
.op-order-form-container .op-submit-btn:active:not(:disabled) { filter: brightness(0.95); }
.op-order-form-container .op-submit-btn:disabled { opacity: 0.7; cursor: not-allowed; }
.op-btn-text { display: inline-block; text-align: center; }

/* ============================================================
   STATUS MESSAGE
   ============================================================ */
.op-status-msg {
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  text-align: center;
  direction: rtl;
}

/* ============================================================
   STICKY BAR (موبايل) — ينقل الزبون إلى النموذج
   ============================================================ */
.op-sticky-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: #fff;
  border: 0;
  box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.12);
  direction: rtl;
}
.op-sticky-price { flex-shrink: 0; font-size: 15px; font-weight: 700; color: var(--op-text); }
.op-sticky-submit {
  flex: 1;
  max-width: 220px;
  padding: 13px 16px;
  background: var(--op-blue);
  color: #fff;
  border: 0;
  border-radius: 10px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  touch-action: manipulation;
}
.op-sticky-submit:hover { background: var(--op-blue-dark); }
.op-sticky-submit:disabled { background: #999; cursor: not-allowed; }

/* ============================================================
   SUCCESS MODAL (تأكيد نجاح الطلب)
   ============================================================ */
.op-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.70);
  backdrop-filter: blur(6px);
}
.op-modal-content {
  width: 100%;
  max-width: 400px;
  padding: clamp(24px, 5vw, 36px);
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  text-align: center;
  animation: opScaleIn 0.4s ease-out;
}
@keyframes opScaleIn {
  from { opacity: 0; transform: scale(0.85) translateY(-20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.op-modal-icon { margin-bottom: 16px; font-size: 52px; animation: opBounceIn 0.6s ease-out; }
@keyframes opBounceIn {
  0%   { transform: scale(0); opacity: 0; }
  60%  { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}
.op-modal-content p {
  margin-bottom: 20px;
  font-size: clamp(14px, 3.5vw, 16px);
  line-height: 1.6;
  color: var(--op-text);
  direction: rtl;
}
.op-modal-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 24px;
  background: var(--op-blue);
  color: #fff;
  border: 0;
  border-radius: 10px;
  font-family: inherit;
  font-size: clamp(14px, 3.5vw, 16px);
  font-weight: 700;
  cursor: pointer;
  direction: rtl;
  transition: var(--op-transition);
}
.op-modal-btn:hover { background: var(--op-blue-dark); }

/* ============================================================
   SPINNER
   ============================================================ */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  margin-left: 8px;
  border: 3px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  vertical-align: middle;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   MOBILE
   ============================================================ */
@media (max-width: 600px) {
  .op-section-title { font-size: 16px; }
  .op-offer-item { padding: 20px 14px; gap: 12px; min-height: 104px; }
  .op-offer-media { width: 60px; height: 60px; }
  .op-new-price { font-size: 18px; }
}
@media (max-width: 360px) {
  .op-offer-title { font-size: 14px; }
  .op-new-price { font-size: 16px; }
}
@media (hover: none) and (pointer: coarse) {
  .op-order-form-container .op-submit-btn,
  .op-sticky-submit { min-height: 52px; }
  .op-input-with-icon input,
  .op-input-with-icon select { font-size: 16px; } /* منع تكبير iOS */
}
@media (prefers-reduced-motion: reduce) {
  .spinner, .op-modal-content, .op-modal-icon, .op-offer-item { animation: none !important; transition: none !important; }
}

/* ===== Biodite Inspire Single: حقول إضافية (textarea / select) ===== */
.op-input-with-icon textarea {
  flex: 1; min-width: 0; margin: 0; padding: 14px 12px;
  border: 0 !important; outline: none !important; box-shadow: none !important;
  background: transparent !important; color: var(--op-text);
  font-family: inherit; font-size: 16px; text-align: right; resize: vertical;
}
.op-input-with-icon textarea::placeholder { color: #9aa3b2; font-size: 15px; }
.op-input-with-icon.op-is-area { align-items: flex-start; }
.op-input-with-icon.op-is-area .op-icon { padding-top: 14px; }
.op-input-with-icon input[type="number"] { -moz-appearance: textfield; }
