/* =========================================================================
   FOLO ordering form.

   Written against the theme's CSS variables with fallbacks, so it looks native
   in FOLO Store and still presentable under any other theme.
   ========================================================================= */

.folo-order {
  display: grid;
  gap: 16px;
  width: 100%;
  margin-block: 4px 20px;
  padding: 18px;
  background: var(--f-surface, #0d1426);
  border: 1px solid var(--f-line, rgba(255, 255, 255, .08));
  border-radius: var(--f-r, 12px);
}

.folo-order__row {
  display: grid;
  gap: 7px;
  margin: 0;
}

.folo-order__label {
  font-size: 14px;
  font-weight: 700;
  color: var(--f-text, #fff);
}

.folo-order__req {
  color: var(--f-accent-2, #ff3d5c);
  margin-inline-start: 2px;
}

.folo-order__input {
  width: 100%;
  padding: 11px 14px;
  background: var(--f-bg, #070c18);
  border: 1px solid var(--f-line, rgba(255, 255, 255, .12));
  border-radius: var(--f-r-sm, 8px);
  color: var(--f-text, #fff);
  font-size: 14.5px;
  font-family: inherit;
  transition: border-color 160ms ease;
}

.folo-order__input:focus {
  outline: none;
  border-color: var(--f-accent, #e8213e);
}

/* The theme's `.woocommerce input[…]:focus` out-ranks the rule above on
   product pages and left no visible focus at all, e.g. when an error sends
   the shopper back to the link field. */
.folo-order .folo-order__row .folo-order__input:focus,
.folo-trial .folo-trial__row .folo-order__input:focus {
  border-color: var(--f-accent, #e8213e);
  box-shadow: 0 0 0 3px rgba(var(--f-accent-rgb, 232, 33, 62), .14);
}

.folo-order__input::placeholder { color: var(--f-mute, rgba(255, 255, 255, .42)); }

.folo-order__input--area { resize: vertical; min-height: 76px; line-height: 1.6; }

.folo-order__hint {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--f-mute, rgba(255, 255, 255, .5));
}

.folo-order__opt {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--f-mute, rgba(255, 255, 255, .5));
}

/* The link/notes error, written by order.js under the field before anything
   is sent. Long example links must wrap, never widen a 360px screen. */
.folo-order__error {
  display: block;
  margin: 0;
  padding: 8px 10px;
  border-radius: var(--f-r-sm, 8px);
  background: rgba(var(--f-accent-rgb, 232, 33, 62), .07);
  border: 1px solid rgba(var(--f-accent-rgb, 232, 33, 62), .28);
  color: var(--f-accent-deep, #b30f26);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.folo-order__error[hidden] { display: none; }

/* Three classes: beats the theme's `.woocommerce input[…]` border. */
.folo-order .folo-order__row .folo-order__input.is-invalid {
  border-color: var(--f-accent-deep, #b30f26);
}

/* --- Amount stepper --- */

/* Minus on the left and plus on the right in any language, like a number
   line — the way MSH and the theme's cart stepper read. */
.folo-order__stepper {
  direction: ltr;
  display: inline-flex;
  align-items: stretch;
  width: fit-content;
  background: var(--f-bg, #070c18);
  border: 1px solid var(--f-line, rgba(255, 255, 255, .12));
  border-radius: var(--f-r-sm, 8px);
  overflow: hidden;
}

.folo-order__pm {
  width: 44px;
  flex: none;
  background: none;
  border: 0;
  color: var(--f-soft, rgba(255, 255, 255, .72));
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}

/* Hover only where there is a mouse: on a phone :hover sticks after a tap
   and left the button filled red. */
@media (hover: hover) {
  .folo-order__pm:hover {
    background: var(--f-accent, #e8213e);
    color: var(--f-strong, #fff);
  }
}

/* Tap feedback on touch screens only: with a mouse the press keeps the red
   hover fill above instead of flashing pale pink. */
@media (hover: none) {
  .folo-order__pm:active {
    background: rgba(var(--f-accent-rgb, 232, 33, 62), .12);
    color: var(--f-accent, #e8213e);
  }
}

.folo-order__amount {
  width: 118px;
  padding: 11px 6px;
  background: none;
  border: 0;
  border-inline: 1px solid var(--f-line, rgba(255, 255, 255, .12));
  color: var(--f-text, #fff);
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  font-family: inherit;
  -moz-appearance: textfield;
}

.folo-order__amount:focus { outline: none; }

.folo-order__amount::-webkit-outer-spin-button,
.folo-order__amount::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* --- Ready-made amounts (one tap sets the stepper) --- */

.folo-order__presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.folo-order__preset {
  min-width: 64px;
  /* A full tap target at every width (desktop included; SPEC §9 rule 6). */
  min-height: 44px;
  padding: 8px 12px;
  background: var(--f-surface, #0d1426);
  border: 1px solid var(--f-line-2, rgba(255, 255, 255, .14));
  border-radius: var(--f-r-pill, 999px);
  color: var(--f-text, #fff);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

/* Hover only where there is a mouse: on a phone :hover sticks after a tap. */
@media (hover: hover) {
  .folo-order__preset:hover {
    border-color: var(--f-accent, #e8213e);
    color: var(--f-accent, #e8213e);
  }
}

/* After the hover rule, so the chosen amount stays filled under the mouse. */
.folo-order__preset.is-on {
  background: var(--f-accent, #e8213e);
  border-color: var(--f-accent, #e8213e);
  color: #fff;
}

.folo-order__preset:focus-visible {
  outline: 2px solid var(--f-accent, #e8213e);
  outline-offset: 2px;
}

/* --- Total --- */

.folo-order__total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding-block-start: 14px;
  border-block-start: 1px solid var(--f-line, rgba(255, 255, 255, .08));
}

.folo-order__total-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--f-soft, rgba(255, 255, 255, .72));
}

.folo-order__total-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--f-accent-2, #ff3d5c);
  line-height: 1.2;
}

.folo-order__total-value .woocommerce-Price-amount { font-size: inherit; }

/* --- Minimum order hint (order.js; a hint, never an error) --- */

.folo-order__min {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid rgba(217, 119, 6, .35);
  border-radius: var(--f-r-sm, 8px);
  background: rgba(217, 119, 6, .07);
  color: var(--f-text, #141414);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.6;
}

.folo-order__min[hidden],
.folo-order__min-btn[hidden] { display: none; }

.folo-order__min-text { min-width: 0; overflow-wrap: anywhere; }

.folo-order__min-btn {
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--f-accent, #e8213e);
  border-radius: var(--f-r-pill, 999px);
  background: var(--f-surface, #fff);
  color: var(--f-accent, #e8213e);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
}

.folo-order__min-btn:focus-visible {
  outline: 2px solid var(--f-accent, #e8213e);
  outline-offset: 2px;
}

@media (hover: hover) {
  .folo-order__min-btn:hover { background: var(--f-accent, #e8213e); color: #fff; }
}

/* The form owns the full width of the summary column. */
.woocommerce div.product form.cart .folo-order { flex: 1 0 100%; }

/* "يبدأ من" prefix on catalogue prices. */
.folo-from {
  font-size: .72em;
  font-weight: 600;
  opacity: .7;
  margin-inline-end: 3px;
}

/* One-column product page (980px down, where the theme stacks it) and the
   quick-order sheet: the stepper spans the form like the link field above
   it, at thumb height. */
@media (max-width: 980px) {
  .folo-order__stepper { display: flex; width: 100%; }
  .folo-order__pm { width: 56px; min-height: 50px; font-size: 22px; }

  /* Out-ranks the theme's `.woocommerce input[type=…]` (0,2,1), which
     otherwise draws a second bordered box inside the stepper. The field is a
     text input now (so Arabic digits can be typed); number kept for safety. */
  .folo-order__stepper .folo-order__amount[type="text"],
  .folo-order__stepper .folo-order__amount[type="number"] {
    flex: 1;
    width: auto;
    min-width: 0;
    padding: 0;
    background: none;
    border: 0;
    border-inline: 1px solid var(--f-line, rgba(255, 255, 255, .12));
    border-radius: 0;
    font-size: 18px;
  }

  /* 16px or iOS Safari zooms the page in when the link field is tapped;
     three classes so it also beats the theme's `.woocommerce input[…]`. */
  .folo-order .folo-order__row .folo-order__input { font-size: 16px; }

  /* One even row as wide as the stepper above, at thumb height. */
  .folo-order__presets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(50px, 1fr));
    gap: 6px;
  }

  .folo-order__preset {
    min-width: 0;
    min-height: 44px;
    padding: 0 4px;
    border-radius: var(--f-r-sm, 8px);
  }
}

@media (max-width: 480px) {
  .folo-order { padding: 14px; }
  .folo-order__total-value { font-size: 21px; }
}

/* -------------------------------------------------------------------------
   Free trial box
   ---------------------------------------------------------------------- */

.folo-trial {
  display: grid;
  gap: 10px;
  width: 100%;
  margin-block: 4px 18px;
  padding: 16px 18px;
  background: rgba(var(--f-accent-rgb, 232, 33, 62), .06);
  border: 1px dashed rgba(var(--f-accent-rgb, 232, 33, 62), .55);
  border-radius: var(--f-r, 12px);
}

.folo-trial__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.folo-trial__badge {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--f-accent, #e8213e);
  color: #fff;
  font-size: 12.5px;
  font-weight: 800;
}

.folo-trial__title { font-size: 15px; color: var(--f-text, #fff); }

.folo-trial__text {
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
  color: var(--f-soft, rgba(255, 255, 255, .72));
}

.folo-trial__row { display: flex; gap: 8px; }
.folo-trial__input { flex: 1; min-width: 0; }

.folo-trial__btn {
  flex: none;
  padding: 11px 18px;
  border: 0;
  border-radius: var(--f-r-sm, 8px);
  background: var(--f-accent, #e8213e);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 160ms ease, opacity 160ms ease;
}

.folo-trial__btn:hover { background: var(--f-accent-2, #ff3d5c); }
.folo-trial__btn:disabled { opacity: .6; cursor: default; }
.folo-trial.is-busy .folo-trial__btn { cursor: progress; }
.folo-trial.is-done .folo-trial__row { display: none; }

.folo-trial__msg {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--f-r-sm, 8px);
  font-size: 13.5px;
  line-height: 1.7;
}

.folo-trial__msg.is-ok { background: rgba(22, 163, 74, .12); color: var(--f-ok, #16a34a); font-weight: 700; }
.folo-trial__msg.is-error { background: rgba(var(--f-accent-rgb, 232, 33, 62), .1); color: var(--f-accent, #e8213e); }
.folo-trial__msg { overflow-wrap: anywhere; }

/* "عرض طلباتي" after the success message: its own line, a full-size target. */
.folo-trial__msglink {
  display: flex;
  align-items: center;
  width: fit-content;
  min-height: 44px;
  color: inherit;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
}

/* "We send you a code — no password": under the button while signed out. */
.folo-trial__note {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--f-mute, rgba(255, 255, 255, .5));
}

/* "Add a WhatsApp number to your account": a link styled as the button. */
.folo-trial__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: start;
  min-height: 44px;
  text-decoration: none;
  text-align: center;
}

.folo-trial__link:hover,
.folo-trial__link:focus-visible { color: #fff; }

.folo-trial__more {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  justify-self: start;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--f-accent, #e8213e);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Already claimed, or staff: the box stays as information, quieter. */
.folo-trial[data-state="done"],
.folo-trial[data-state="staff"] {
  background: var(--f-surface, #fff);
  border-style: solid;
  border-color: var(--f-line, rgba(0, 0, 0, .1));
}

.folo-trial[data-state="done"] .folo-trial__badge,
.folo-trial[data-state="staff"] .folo-trial__badge { background: var(--f-mute, #888); }

/* Turnstile shows itself only when Cloudflare needs a click. */
.folo-trial__ts:empty { display: none; }

.folo-trial__btn { min-height: 44px; }

/* Phones. After the base message colours above so these win at the same
   specificity. */
@media (max-width: 980px) {
  /* Solid fills that stand off the dashed pink box, at 4.5:1 or better. */
  .folo-trial__msg.is-ok { background: #ecfdf3; border: 1px solid rgba(22, 163, 74, .35); color: #166534; }
  .folo-trial__msg.is-error { background: var(--f-surface, #fff); border: 1px solid rgba(var(--f-accent-rgb, 232, 33, 62), .35); color: var(--f-accent-deep, #b30f26); }

  /* Clear the pinned header above, and below both the tab bar and the
     WhatsApp button that floats over its corner. */
  .folo-trial__msg { scroll-margin-block: 110px 140px; }

  /* 16px or iOS zooms in on focus (tablets too); three classes beat the
     theme's `.woocommerce input[…]`. */
  .folo-trial .folo-trial__row .folo-trial__input { font-size: 16px; }
}

@media (max-width: 480px) {
  .folo-trial__row { flex-direction: column; }
  .folo-trial__link { justify-self: stretch; }
}

@media (prefers-reduced-motion: reduce) {
  .folo-trial__btn,
  .folo-order__preset { transition: none; }
}

/* A link inside Arabic text (cart lines, the checkout summary): read left to
   right, so a long link that wraps keeps its order. */
.folo-ltr {
  direction: ltr;
  unicode-bidi: isolate;
  overflow-wrap: anywhere;
}
