/* ============================================================
   OPO v8.0 — Style Sheet
   ============================================================ */

/* ===== VARIABLES ===== */
:root {
  --primary:      #700910;
  --primary-dark: #4d0609;
  --green:        #3aab46;
  --green-bg:     #eef7ea;
  --green-dark:   #2d8a38;
  --danger:       #dc3545;
  --info:         #007bff;
  --success:      #28a745;
  --dark:         #2c3e50;
  --gray:         #6c757d;
  --light:        #f8f9fa;
  --border:       #e0e0e0;
  --shadow:       rgba(0,0,0,0.10);
  --radius:       12px;
  --transition:   all 0.3s ease;
}

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

/* ============================================================
   URGENCY BAR
   ============================================================ */
.op-urgency-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--primary), #c0392b);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius) var(--radius) 0 0;
  font-size: clamp(13px, 3.5vw, 15px);
  font-weight: 700;
  direction: rtl;
  animation: pulseBg 2s ease-in-out infinite;
}

.op-urgency-icon { font-size: 18px; }

.op-urgency-countdown {
  background: rgba(255,255,255,0.2);
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 16px;
  font-weight: 800;
  min-width: 55px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

@keyframes pulseBg {
  0%,100% { opacity: 1; }
  50%      { opacity: 0.85; }
}

/* ============================================================
   SOCIAL PROOF TICKER
   ============================================================ */
.op-social-proof {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff9e6;
  border: 1px solid #ffe082;
  border-radius: 8px;
  padding: 8px 14px;
  margin: 8px 0;
  font-size: clamp(12px, 3vw, 14px);
  color: var(--dark);
  direction: rtl;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  min-height: 38px;
}

.op-social-proof.op-sp-visible {
  opacity: 1;
  transform: translateY(0);
}

.op-sp-icon { font-size: 16px; flex-shrink: 0; }
.op-sp-text { font-weight: 600; }

/* ============================================================
   FORM CONTAINER
   ============================================================ */
.op-order-form-container {
  background: #ffffff;
  padding: 20px;
  margin: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  border: 1px solid var(--border);
  border-top: none;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  direction: rtl;
  box-shadow: 0 4px 16px var(--shadow);
  width: 100%;
}

/* Product info — hidden */
.op-product-info { display: none !important; }

/* ============================================================
   INPUT GROUPS
   ============================================================ */
.op-input-group {
  margin-bottom: clamp(14px, 3.5vw, 18px);
  width: 100%;
}

/* Progressive reveal animation */
.op-progressive {
  overflow: hidden;
}
.op-reveal {
  animation: slideDown 0.35s ease-out;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.op-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
  color: var(--dark);
  font-size: clamp(14px, 3.5vw, 15px);
  text-align: right;
}

.op-required { color: var(--danger); }

/* ===== INPUT WITH ICON ===== */
.op-input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
  background: #fff;
  border: 2px solid var(--border);
  border-radius: 10px;
  transition: var(--transition);
  direction: rtl;
  width: 100%;
  overflow: hidden;
}

.op-input-with-icon:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(58, 171, 70, 0.15);
}

.op-icon {
  padding: 0 clamp(10px, 3vw, 14px);
  font-size: clamp(16px, 4vw, 20px);
  min-width: clamp(40px, 10vw, 48px);
  text-align: center;
  flex-shrink: 0;
}

.op-input-with-icon input {
  flex: 1;
  border: none;
  outline: none;
  padding: clamp(12px, 3vw, 14px) clamp(10px, 3vw, 12px);
  font-size: clamp(14px, 3.5vw, 16px);
  background: transparent;
  color: var(--dark);
  text-align: right;
  min-width: 0;
}

.op-input-with-icon input::placeholder {
  color: #aaa;
  font-size: clamp(13px, 3vw, 14px);
}

/* Field validity check icon */
.op-field-check {
  padding: 0 10px;
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
  transition: var(--transition);
}
.op-check-valid   { color: var(--green); }
.op-check-invalid { color: var(--danger); }

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

/* ============================================================
   OFFERS
   ============================================================ */
.op-offers-section {
  margin: 8px 0 18px;
  width: 100%;
}

.op-offers-title {
  text-align: right;
  font-size: 15px;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 12px;
}

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

.op-offer-item {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  transition: var(--transition);
  direction: rtl;
  outline: none;
}

.op-offer-item:hover,
.op-offer-item:focus {
  border-color: var(--green);
  box-shadow: 0 2px 10px rgba(58,171,70,0.12);
}

.op-offer-item.active {
  background: var(--green-bg);
  border-color: var(--green);
  box-shadow: 0 2px 12px rgba(58,171,70,0.2);
}

.op-discount-badge {
  position: absolute;
  left: 14px;
  top: -11px;
  background: var(--green);
  color: #fff;
  border-radius: 20px;
  padding: 3px 12px;
  font-size: 12px;
  font-weight: 700;
  direction: ltr;
  unicode-bidi: bidi-override;
}

.op-offer-right { text-align: right; }

.op-offer-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--dark);
}

.op-delivery {
  color: var(--gray);
  font-size: 13px;
  display: block;
}

.op-offer-left { text-align: left; flex-shrink: 0; }

.op-new-price {
  font-size: 17px;
  font-weight: 800;
  color: var(--dark);
  white-space: nowrap;
}

.op-old-price {
  text-decoration: line-through;
  color: #aaa;
  font-size: 13px;
  white-space: nowrap;
}

/* Checkmark overlay */
.op-offer-checkmark {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.6);
  transition: var(--transition);
}

.op-offer-item.active .op-offer-checkmark {
  opacity: 1;
  transform: scale(1);
}

/* ============================================================
   PRICE SUMMARY
   ============================================================ */
.op-price-summary {
  background: var(--light);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 12px 0 18px;
  border: 1px solid var(--border);
}

.op-price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
  font-size: clamp(13px, 3.2vw, 14px);
  color: var(--dark);
}

.op-price-row:last-child { border-bottom: none; }

.op-total {
  font-size: clamp(15px, 4vw, 17px) !important;
  font-weight: 800;
  color: var(--primary) !important;
  padding-top: 10px !important;
  border-top: 2px solid var(--border) !important;
}

/* ============================================================
   ACTION ROW — QUANTITY + SUBMIT
   ============================================================ */
.op-action-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

/* Quantity */
.op-quantity-container {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.op-qty-btn {
  width: 42px;
  height: 42px;
  border: 2px solid var(--border);
  background: #fff;
  border-radius: 10px;
  font-size: 20px;
  font-weight: 700;
  color: var(--dark);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  touch-action: manipulation;
  user-select: none;
}

.op-qty-btn:hover  { background: var(--light); border-color: var(--green); }
.op-qty-btn:active { transform: scale(0.93); }

.op-quantity-container input#op-quantity {
  width: 36px;
  text-align: center;
  border: none;
  background: transparent;
  font-size: 18px;
  font-weight: 800;
  color: var(--dark);
  padding: 0;
  -moz-appearance: textfield;
}
.op-quantity-container input#op-quantity::-webkit-outer-spin-button,
.op-quantity-container input#op-quantity::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Submit Button */
.op-submit-btn {
  flex: 1;
  min-width: 160px;
  padding: clamp(14px, 3.5vw, 17px) 20px;
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: clamp(15px, 4vw, 17px);
  font-weight: 800;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 14px rgba(58,171,70,0.30);
  animation: pulseButton 2.5s ease-in-out infinite;
  touch-action: manipulation;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: 0.3px;
}

.op-submit-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--green-dark), var(--green));
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(58,171,70,0.40);
}

.op-submit-btn:active:not(:disabled) { transform: translateY(0); }

.op-submit-btn:disabled {
  background: linear-gradient(135deg, #aaa, #999);
  box-shadow: none;
  animation: none;
  cursor: not-allowed;
  opacity: 0.7;
}

@keyframes pulseButton {
  0%,100% { box-shadow: 0 4px 14px rgba(58,171,70,0.30); }
  50%      { box-shadow: 0 6px 24px rgba(58,171,70,0.55); }
}

/* ============================================================
   TRUST BADGES
   ============================================================ */
.op-trust-badges {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(10px, 3vw, 20px);
  flex-wrap: wrap;
  padding: 10px 0 4px;
  font-size: clamp(11px, 2.8vw, 13px);
  color: var(--gray);
  border-top: 1px dashed var(--border);
  margin-top: 4px;
}

.op-trust-badges span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ============================================================
   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;
  background: #fff;
  box-shadow: 0 -3px 16px rgba(0,0,0,0.15);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  direction: rtl;
  border-top: 2px solid var(--green);
}

.op-sticky-price {
  font-size: 14px;
  color: var(--dark);
  font-weight: 700;
  flex-shrink: 0;
}

.op-sticky-submit {
  flex: 1;
  max-width: 220px;
  padding: 13px 16px;
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  animation: pulseButton 2.5s infinite;
  touch-action: manipulation;
}

.op-sticky-submit:disabled {
  background: #999;
  animation: none;
  cursor: not-allowed;
}

/* ============================================================
   SUCCESS MODAL
   ============================================================ */
.op-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.70);
  backdrop-filter: blur(6px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.op-modal-content {
  background: #fff;
  border-radius: 20px;
  padding: clamp(24px, 5vw, 36px);
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  animation: scaleIn 0.4s ease-out;
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.85) translateY(-20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.op-modal-icon {
  font-size: 52px;
  margin-bottom: 16px;
  animation: bounceIn 0.6s ease-out;
}

@keyframes bounceIn {
  0%  { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.2); }
  100%{ transform: scale(1); opacity: 1; }
}

.op-modal-content p {
  font-size: clamp(14px, 3.5vw, 16px);
  color: var(--dark);
  margin-bottom: 20px;
  line-height: 1.6;
  direction: rtl;
}

.op-modal-btn {
  background: linear-gradient(135deg, var(--success), #20c997);
  color: #fff;
  border: none;
  padding: 14px 24px;
  border-radius: 10px;
  cursor: pointer;
  font-size: clamp(14px, 3.5vw, 16px);
  font-weight: 700;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  direction: rtl;
}

.op-modal-btn:hover {
  background: linear-gradient(135deg, #20c997, var(--success));
  transform: translateY(-2px);
}

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

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   MOBILE RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .op-order-form-container { padding: 16px; }
  .op-action-row { gap: 8px; }
}

@media (max-width: 480px) {
  .op-order-form-container {
    padding: 14px;
    border-radius: 0 0 10px 10px;
  }
  .op-urgency-bar { border-radius: 10px 10px 0 0; }
  .op-offer-item  { padding: 12px; }
  .op-new-price   { font-size: 15px; }
  .op-offer-title { font-size: 14px; }
  .op-qty-btn     { width: 40px; height: 40px; }
  .op-trust-badges { gap: 8px; font-size: 11px; }
  /* Add bottom padding to avoid sticky bar overlap */
  .op-order-form-container { padding-bottom: 80px; }
}

@media (max-width: 320px) {
  .op-order-form-container { padding: 10px; }
  .op-qty-btn     { width: 36px; height: 36px; font-size: 16px; }
}

/* Touch devices */
@media (hover: none) and (pointer: coarse) {
  .op-submit-btn,
  .op-sticky-submit {
    min-height: 52px;
    font-size: 17px;
  }
  .op-input-with-icon input { font-size: 16px; } /* prevent iOS zoom */
  .op-qty-btn { min-width: 44px; min-height: 44px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .op-submit-btn,
  .op-sticky-submit,
  .op-urgency-bar,
  .spinner,
  .op-social-proof,
  .op-modal-content,
  .op-offer-item { animation: none !important; transition: none !important; }
}
