/* ==========================================
   قالب كود الخصم
   ========================================== */

.coupon-widget {
  /* الألوان والعرض: عدّلها من هنا فقط */
  --cw-color: #8b6035;        /* اللون الأساسي (الزر والنسبة) */
  --cw-color-hover: #432914;  /* لون الزر عند المرور بالماوس */
  --cw-dash: #8c5f35;         /* لون الإطار المتقطع */
  --cw-border: #6b7280;       /* إطار حقل الكود */
  --cw-text: #231f1e;         /* لون النصوص الداكنة */
  --cw-muted: #6b7280;        /* لون الجملة الصغيرة */
  --cw-success: #16a34a;      /* لون الزر بعد النسخ */
  --cw-max-width: 100%;       /* مثال لتحديد العرض: 480px */

  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: var(--cw-max-width);
  margin: 20px auto;
  padding: 16px 25px 20px;
  background: #fff;
  border: 2px dashed var(--cw-dash);
  border-radius: 8px;
}

.coupon-widget,
.coupon-widget * {
  box-sizing: border-box;
}

/* العنوان + الجملة الصغيرة + النسبة */
.coupon-widget .coupon-widget__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.coupon-widget .coupon-widget__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.coupon-widget .coupon-widget__title {
  color: var(--cw-text);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.5;
}

.coupon-widget .coupon-widget__subtitle {
  color: var(--cw-muted);
  font-size: 14px;
  line-height: 1.6;
  text-wrap: balance; /* توزيع متوازن للسطرين على الشاشات الضيقة */
}

.coupon-widget .coupon-widget__discount {
  flex-shrink: 0;
  color: var(--cw-color);
  font-size: 24px;
  font-weight: 700;
  line-height: 32px;
}

/* الحقل والزر: نفس القياسات */
.coupon-widget .coupon-widget__code,
.coupon-widget .coupon-widget__btn {
  display: block;
  width: 100%;
  height: 50px;
  margin: 0;
  padding: 0 16px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 18px;
  font-weight: 400;
  line-height: normal;
  letter-spacing: normal;
  -webkit-appearance: none;
  appearance: none;
}

/* حقل الكود */
.coupon-widget .coupon-widget__code {
  color: var(--cw-text);
  background: #fff;
  border: 1px solid var(--cw-border);
  box-shadow: none;
  outline: 0;
  text-align: start;
  -webkit-user-select: all;
  user-select: all;
  transition: border-color 0.2s;
}

.coupon-widget .coupon-widget__code:focus {
  border-color: var(--cw-color);
  box-shadow: none;
  outline: 0;
}

/* زر النسخ */
.coupon-widget .coupon-widget__btn {
  color: #fff;
  background: var(--cw-color);
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.2s, transform 0.1s;
}

@media (hover: hover) {
  .coupon-widget .coupon-widget__btn:hover {
    background: var(--cw-color-hover);
  }
}

.coupon-widget .coupon-widget__btn:active {
  transform: scale(0.98);
}

.coupon-widget .coupon-widget__btn:focus-visible {
  outline: 2px solid var(--cw-color);
  outline-offset: 2px;
}

/* حالة "تم النسخ" */
.coupon-widget .coupon-widget__btn.is-copied {
  background: var(--cw-success);
}

/* الجوال (16px في الحقل يمنع تكبير الشاشة تلقائياً في الآيفون) */
@media (max-width: 575px) {
  .coupon-widget {
    padding: 14px 16px 16px;
  }

  .coupon-widget .coupon-widget__title {
    font-size: 17px;
  }

  .coupon-widget .coupon-widget__discount {
    font-size: 22px;
  }

  .coupon-widget .coupon-widget__code,
  .coupon-widget .coupon-widget__btn {
    height: 46px;
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .coupon-widget .coupon-widget__code,
  .coupon-widget .coupon-widget__btn {
    transition: none;
  }

  .coupon-widget .coupon-widget__btn:active {
    transform: none;
  }
}