/* Nagham "My Orders" portal. Scoped to .nmo; inherits the theme's fonts and text color.
   Text sizes use em (relative to the theme's body text), not rem: themes such as this one
   set the root size to 10px, which would shrink rem-based text. */

.nmo {
  --nmo-accent: #111111;
  --nmo-text: currentColor;
  --nmo-muted: color-mix(in srgb, currentColor 62%, transparent);
  --nmo-border: color-mix(in srgb, currentColor 14%, transparent);
  --nmo-surface: color-mix(in srgb, currentColor 4%, transparent);
  --nmo-radius: 12px;
  --nmo-success: #13795b;
  --nmo-warning: #a15c07;
  --nmo-danger: #b42318;
  --nmo-info: #175cd3;

  box-sizing: border-box;
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 56px;
  font: inherit;
  color: inherit;
  line-height: 1.55;
}

@supports not (color: color-mix(in srgb, red 50%, transparent)) {
  .nmo {
    --nmo-muted: rgba(0, 0, 0, 0.62);
    --nmo-border: rgba(0, 0, 0, 0.14);
    --nmo-surface: rgba(0, 0, 0, 0.04);
  }
}

.nmo *,
.nmo *::before,
.nmo *::after {
  box-sizing: border-box;
}

.nmo__title {
  margin: 0 0 8px;
  font-size: clamp(1.75em, 5vw, 2.3em);
  line-height: 1.25;
}

/* Titles get focus programmatically (tabindex="-1") so screen readers announce each new view.
   They aren't controls, so hide the theme's focus ring and shadow on them. */
.nmo .nmo__title:focus,
.nmo .nmo__title:focus-visible,
.nmo [tabindex="-1"]:focus,
.nmo [tabindex="-1"]:focus-visible {
  outline: none;
  box-shadow: none;
}

.nmo__lead {
  margin: 0 0 20px;
  font-size: 1.05em;
}

.nmo__muted {
  margin: 0;
  color: var(--nmo-muted);
  font-size: 0.92em;
}

/* Forms */

.nmo__form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.nmo__label {
  font-weight: 600;
}

.nmo__input {
  min-height: 48px;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--nmo-border);
  border-radius: var(--nmo-radius);
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 16px; /* prevents iOS zoom on focus */
}

.nmo__input:focus-visible,
.nmo__button:focus-visible,
.nmo__link:focus-visible,
.nmo__card-link:focus-visible {
  outline: 2px solid var(--nmo-accent);
  outline-offset: 2px;
}

.nmo__input[aria-invalid="true"] {
  border-color: var(--nmo-danger);
}

.nmo__code {
  font-size: 1.6em;
  letter-spacing: 0.5em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.nmo__button {
  position: relative;
  min-height: 48px;
  padding: 12px 20px;
  border: 1px solid var(--nmo-accent);
  border-radius: var(--nmo-radius);
  background: var(--nmo-accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.nmo__button--secondary {
  background: transparent;
  color: inherit;
  border-color: var(--nmo-border);
}

.nmo__button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.nmo__button.is-loading {
  color: transparent;
}

.nmo__button.is-loading::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid #fff;
  border-right-color: transparent;
  border-radius: 50%;
  animation: nmo-spin 0.7s linear infinite;
}

.nmo__button--secondary.is-loading::after {
  border-color: currentColor;
  border-right-color: transparent;
}

.nmo__link {
  padding: 4px 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  align-self: flex-start;
}

.nmo__back {
  display: inline-block;
  margin-bottom: 16px;
}

/* Messages */

.nmo__msg:empty {
  display: none;
}

.nmo__alert {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: var(--nmo-radius);
  border: 1px solid;
  font-size: 0.95em;
}

.nmo__alert--error {
  border-color: color-mix(in srgb, var(--nmo-danger) 40%, transparent);
  background: color-mix(in srgb, var(--nmo-danger) 8%, transparent);
}

.nmo__alert--info {
  border-color: color-mix(in srgb, var(--nmo-info) 35%, transparent);
  background: color-mix(in srgb, var(--nmo-info) 7%, transparent);
}

.nmo__loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 32px 0;
  color: var(--nmo-muted);
}

.nmo__spinner {
  width: 20px;
  height: 20px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: nmo-spin 0.7s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .nmo__spinner,
  .nmo__button.is-loading::after {
    animation-duration: 2s;
  }
}

/* Orders */

.nmo__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.nmo__list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
}

.nmo__card {
  border: 1px solid var(--nmo-border);
  border-radius: var(--nmo-radius);
  padding: 16px;
}

.nmo__card-link {
  display: block;
  color: inherit;
  text-decoration: none;
  border-radius: 8px;
}

.nmo__card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.nmo__card-title {
  margin: 0;
  font-size: 1.5em;
  line-height: 1.3;
}

.nmo .nmo__date {
  font-size: 1.1em;
}

.nmo__more {
  display: inline-block;
  margin-top: 8px;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 600;
}

.nmo__badge {
  flex: 0 0 auto;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.85em;
  font-weight: 600;
  white-space: nowrap;
  background: var(--nmo-surface);
  border: 1px solid var(--nmo-border);
}

.nmo__badge--delivered,
.nmo__badge--picked_up,
.nmo__badge--completed {
  color: var(--nmo-success);
  border-color: color-mix(in srgb, var(--nmo-success) 35%, transparent);
  background: color-mix(in srgb, var(--nmo-success) 8%, transparent);
}

.nmo__badge--shipped,
.nmo__badge--partially_shipped,
.nmo__badge--out_for_delivery,
.nmo__badge--ready_for_pickup {
  color: var(--nmo-info);
  border-color: color-mix(in srgb, var(--nmo-info) 35%, transparent);
  background: color-mix(in srgb, var(--nmo-info) 7%, transparent);
}

.nmo__badge--delivery_attempted,
.nmo__badge--delivery_issue,
.nmo__badge--returned {
  color: var(--nmo-warning);
  border-color: color-mix(in srgb, var(--nmo-warning) 40%, transparent);
  background: color-mix(in srgb, var(--nmo-warning) 8%, transparent);
}

.nmo__badge--cancelled {
  color: var(--nmo-danger);
  border-color: color-mix(in srgb, var(--nmo-danger) 35%, transparent);
  background: color-mix(in srgb, var(--nmo-danger) 7%, transparent);
}

.nmo__items {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.nmo__item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nmo__item-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 auto;
  overflow-wrap: anywhere;
}

.nmo__item-price {
  flex: 0 0 auto;
}

.nmo__thumb {
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--nmo-surface);
  border: 1px solid var(--nmo-border);
}

.nmo__row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0;
}

.nmo__tracking {
  margin: 8px 0 0;
  overflow-wrap: anywhere;
}

.nmo__tracking a {
  color: inherit;
  text-underline-offset: 3px;
}

.nmo__empty {
  padding: 32px 0;
  text-align: center;
}

/* Detail */

.nmo__section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--nmo-border);
}

.nmo__section-title {
  margin: 0 0 12px;
  font-size: 1.1em;
}

.nmo__shipment + .nmo__shipment {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--nmo-border);
}

.nmo__address {
  display: flex;
  flex-direction: column;
  font-style: normal;
}

@media (min-width: 750px) {
  .nmo {
    padding-top: 40px;
  }
  .nmo__form {
    max-width: 420px;
  }
}

/* Mixed Arabic/English text (product names, order numbers) keeps the page's alignment. */
.nmo__bidi {
  unicode-bidi: isolate;
}
