/* BOLDYO pay — tokens follow the Jade green palette in website/src/app/globals.css
   (Forest Ink, Jade, Sage, Mint White; tints come from opacity). */

@font-face {
  font-family: "Nexa";
  src: url("fonts/nexa-heavy.ttf") format("truetype");
  font-weight: 900;
  font-display: swap;
}
@font-face {
  font-family: "Poppins";
  src: url("fonts/poppins-regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Poppins";
  src: url("fonts/poppins-medium.ttf") format("truetype");
  font-weight: 500;
  font-display: swap;
}
/* Arabic letters: Poppins and Nexa have none, so the stack falls through to this. */
@font-face {
  font-family: "Alexandria";
  src: url("fonts/alexandria-arabic.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --ink: #0a2922;
  --jade: #4cdbab;
  --sage: #cddcd3;
  --paper: #f0f8f3;

  --bg: var(--ink);
  --card: rgb(240 248 243 / 0.05);
  --heading: var(--paper);
  --body: rgb(240 248 243 / 0.8);
  --muted: rgb(240 248 243 / 0.6);
  --hairline: rgb(240 248 243 / 0.12);
  --hairline-strong: rgb(240 248 243 / 0.24);
  --field: rgb(0 0 0 / 0.25);
  --field-focus: rgb(0 0 0 / 0.38);
  --error: #ff9a92; /* functional colour for declines and errors; the palette has no red */
  --warn: #f3d27a;
  --font-display: "Nexa", "Alexandria", "Arial Black", sans-serif;
  --font-body: "Poppins", "Alexandria", Arial, sans-serif;
  --radius: 4px;
  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--body);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

::selection {
  background: var(--jade);
  color: var(--ink);
}

.shell {
  width: 100%;
  max-width: 34rem;
  min-height: 100vh;
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.shell-wide {
  max-width: 76rem;
}

/* Header ------------------------------------------------------------ */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  padding: 0.25rem 0;
}

.logo {
  display: block;
  height: 1.5rem;
  width: auto;
}

.lang {
  font-size: 0.875rem;
  text-decoration: none;
  color: var(--body);
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--hairline-strong);
  border-radius: 999px;
  transition: border-color 0.15s, color 0.15s;
}

.lang:hover {
  color: var(--heading);
  border-color: var(--jade);
}

/* Card -------------------------------------------------------------- */

.main {
  flex: 1;
}

.card {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 1.75rem 1.25rem;
}

.card + .card {
  margin-top: 1.25rem;
}

.card-narrow {
  max-width: 28rem;
  margin-inline: auto;
}

@media (min-width: 30rem) {
  .card {
    padding: 2.25rem 2rem;
  }
}

h1,
h2 {
  margin: 0 0 0.5rem;
  color: var(--heading);
  font-family: var(--font-display);
  font-weight: 900;
  line-height: 1.5;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 1.75rem;
}

h2 {
  font-size: 1.25rem;
}

.lead {
  margin: 0 0 1.5rem;
}

.alert {
  margin: 0 0 1.25rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid rgb(255 154 146 / 0.45);
  background: rgb(255 154 146 / 0.08);
  color: #ffd1cc;
  font-size: 0.925rem;
}

.alert-ok {
  border-color: rgb(76 219 171 / 0.45);
  background: rgb(76 219 171 / 0.09);
  color: var(--paper);
}

.alert-warn {
  border-color: rgb(243 210 122 / 0.45);
  background: rgb(243 210 122 / 0.08);
  color: #f7e6b4;
}

/* Form -------------------------------------------------------------- */

.form {
  display: grid;
  gap: 1.1rem;
}

.field label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--heading);
  font-size: 0.925rem;
  font-weight: 500;
}

.opt {
  color: var(--muted);
  font-weight: 400;
}

input {
  width: 100%;
  padding: 0.8rem 0.95rem;
  border-radius: var(--radius);
  border: 1px solid var(--hairline-strong);
  background: var(--field);
  color: var(--heading);
  font: inherit;
  font-size: 1rem;
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}

/* Keep the placeholder/value on the reading side for LTR inputs inside an RTL page. */
[dir="rtl"] input[dir="ltr"] {
  text-align: right;
}

input::placeholder {
  color: var(--muted);
}

input:focus {
  outline: none;
  border-color: var(--jade);
  background: var(--field-focus);
  box-shadow: 0 0 0 3px rgb(76 219 171 / 0.22);
}

input[readonly] {
  border-style: dashed;
  cursor: default;
}

.has-error input {
  border-color: var(--error);
}

.money {
  position: relative;
}

/* The input is dir="ltr" even on Arabic pages, so its logical sides don't follow the page —
   pad the side the currency label sits on explicitly. */
.money input {
  padding-right: 3.5rem;
  font-size: 1.35rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

[dir="rtl"] .money input {
  padding-right: 0.95rem;
  padding-left: 3.5rem;
}

.currency {
  position: absolute;
  inset-block: 0;
  inset-inline-end: 0.95rem;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-weight: 500;
  pointer-events: none;
}

/* Services: a grid of icon tiles over real checkboxes, set apart from the details above. */
.services {
  margin: 0.35rem 0 0;
  padding: 1.25rem 0 0;
  border: 0;
  border-top: 1px solid var(--hairline);
  min-width: 0;
}

.services legend {
  float: inline-start; /* keeps the legend inside the padding, under the divider */
  width: 100%;
  padding: 0;
  color: var(--heading);
  font-size: 0.925rem;
  font-weight: 500;
}

.services .hint {
  clear: both;
  margin: 0.1rem 0 0.85rem;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}

.tile {
  position: relative;
  display: block;
  cursor: pointer;
}

.tile input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}

.tile-box {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  height: 100%;
  min-height: 5.5rem;
  padding: 0.85rem 0.35rem 0.7rem;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius);
  background: var(--field);
  text-align: center;
  pointer-events: none;
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}

.tile-icon {
  width: 1.55rem;
  height: 1.55rem;
  color: var(--muted);
  transition: color 0.15s;
}

.tile-label {
  color: var(--body);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.35;
  transition: color 0.15s;
}

/* Tick badge in the top corner, filled in when the tile is chosen. */
.tile-check {
  position: absolute;
  top: 0.4rem;
  inset-inline-end: 0.4rem;
  width: 1rem;
  height: 1rem;
  border: 1.5px solid var(--hairline-strong);
  border-radius: 50%;
  transition: background-color 0.15s, border-color 0.15s;
}

.tile:hover .tile-box {
  border-color: rgb(76 219 171 / 0.55);
}

.tile:hover .tile-icon,
.tile:hover .tile-label {
  color: var(--heading);
}

.tile input:checked + .tile-box {
  border-color: var(--jade);
  background: rgb(76 219 171 / 0.1);
  box-shadow: inset 0 0 0 1px var(--jade);
}

.tile input:checked + .tile-box .tile-icon {
  color: var(--jade);
}

.tile input:checked + .tile-box .tile-label {
  color: var(--heading);
}

.tile input:checked + .tile-box .tile-check {
  border-color: var(--jade);
  background: var(--jade) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5 5.5-6' fill='none' stroke='%230a2922' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 75% no-repeat;
}

.tile input:focus-visible + .tile-box {
  outline: 2px solid var(--jade);
  outline-offset: 2px;
}

.hint,
.error {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
}

.hint {
  color: var(--muted);
}

.error {
  color: var(--error);
}

/* Honeypot: off-screen for people, still in the form for bots. */
.hp {
  position: absolute;
  inset-inline-start: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Buttons ----------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 3.25rem;
  padding: 0.8rem 1.25rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--jade);
  color: var(--ink);
  font: inherit;
  font-size: 1.02rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: filter 0.15s, transform 0.15s, opacity 0.15s;
}

.btn:hover {
  filter: brightness(1.07);
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible,
.brand:focus-visible,
.lang:focus-visible,
.chip:focus-visible,
.tab:focus-visible,
.pay-row:focus-visible {
  outline: 2px solid var(--jade);
  outline-offset: 3px;
}

.btn[disabled] {
  opacity: 0.7;
  cursor: progress;
}

.btn-ghost {
  background: transparent;
  color: var(--heading);
  border: 1px solid var(--hairline-strong);
}

.btn-ghost:hover {
  border-color: var(--jade);
  filter: none;
}

.btn-danger {
  background: transparent;
  color: #ffd1cc;
  border: 1px solid rgb(255 154 146 / 0.6);
}

.btn-danger:hover {
  background: rgb(255 154 146 / 0.1);
  filter: none;
}

/* Dashboard buttons size to their label instead of filling the row. */
.btn-small {
  width: auto;
  min-height: 2.4rem;
  padding: 0.4rem 0.95rem;
  font-size: 0.875rem;
}

.btn-fit {
  width: auto;
  min-width: 12rem;
}

.note {
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

/* Status ------------------------------------------------------------ */

.status {
  text-align: center;
}

.badge {
  width: 3.5rem;
  height: 3.5rem;
  margin: 0 auto 1rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  font-weight: 500;
  line-height: 1;
}

.status-ok .badge {
  background: rgb(76 219 171 / 0.12);
  color: var(--jade);
  border: 1px solid rgb(76 219 171 / 0.45);
}

.status-wait .badge {
  background: rgb(205 220 211 / 0.1);
  color: var(--sage);
  border: 1px solid rgb(205 220 211 / 0.4);
}

.status-bad .badge {
  background: rgb(255 154 146 / 0.1);
  color: var(--error);
  border: 1px solid rgb(255 154 146 / 0.4);
}

.summary {
  margin: 0 0 1.5rem;
  padding: 0.25rem 1rem;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: rgb(0 0 0 / 0.18);
  text-align: start;
}

.summary div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0;
}

.summary div + div {
  border-top: 1px solid var(--hairline);
}

.summary dt {
  flex: none;
  color: var(--muted);
}

.summary dd {
  margin: 0;
  text-align: end;
  color: var(--heading);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

/* The decline reason is a sentence, so let it wrap under its label on a narrow screen. */
.summary .reason {
  flex-wrap: wrap;
}

.summary .reason dd {
  flex: 1 1 14rem;
  color: #ffd1cc;
}

.actions {
  display: grid;
  gap: 0.75rem;
}

/* Footer ------------------------------------------------------------ */

.foot {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
}

.foot p {
  margin: 0.25rem 0;
}

.methods {
  color: var(--body);
  letter-spacing: 0.02em;
}

.legal {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
}

.legal a {
  text-underline-offset: 3px;
}

/* Dashboard --------------------------------------------------------- */

.dash-title {
  font-size: 1.5rem;
}

.tabs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0 0 1.25rem;
  border-bottom: 1px solid var(--hairline);
}

.tab {
  padding: 0.7rem 1.1rem;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--body);
  text-decoration: none;
  font-weight: 500;
}

.tab:hover {
  color: var(--heading);
}

.tab[aria-current="page"] {
  color: var(--jade);
  border-bottom-color: var(--jade);
}

.tab-end {
  margin-inline-start: auto;
  padding-bottom: 0.4rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 0 0 1.25rem;
}

@media (min-width: 48rem) {
  .stats {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--card);
}

.stat-n {
  color: var(--heading);
  font-family: var(--font-display);
  font-size: 1.35rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.stat-bad .stat-n {
  color: var(--error);
}

.stat-l {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin: 0 0 1rem;
}

.bar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip {
  padding: 0.3rem 0.85rem;
  border: 1px solid var(--hairline-strong);
  border-radius: 999px;
  color: var(--body);
  font-size: 0.85rem;
  text-decoration: none;
  white-space: nowrap;
}

.chip:hover {
  border-color: var(--jade);
  color: var(--heading);
}

.chip[aria-current="true"] {
  background: var(--jade);
  border-color: var(--jade);
  color: var(--ink);
  font-weight: 500;
}

.search {
  display: flex;
  gap: 0.5rem;
}

.search input {
  width: 17rem;
  max-width: 100%;
  padding: 0.5rem 0.8rem;
  font-size: 0.9rem;
}

.muted {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.empty {
  margin: 1.5rem 0;
  text-align: center;
  color: var(--muted);
}

.pill {
  display: inline-block;
  padding: 0.05rem 0.7rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
}

.pill-approved {
  background: rgb(76 219 171 / 0.12);
  color: var(--jade);
  border-color: rgb(76 219 171 / 0.45);
}

.pill-declined,
.pill-error {
  background: rgb(255 154 146 / 0.1);
  color: var(--error);
  border-color: rgb(255 154 146 / 0.45);
}

.pill-error {
  border-style: dashed;
}

.pill-pending {
  background: rgb(243 210 122 / 0.09);
  color: var(--warn);
  border-color: rgb(243 210 122 / 0.4);
}

.pill-cancelled,
.pill-refunded {
  background: rgb(205 220 211 / 0.08);
  color: var(--sage);
  border-color: rgb(205 220 211 / 0.35);
}

/* Payment list: a grid on wide screens, stacked on phones. */
.pay-head,
.pay-row {
  display: grid;
  gap: 0.25rem 1rem;
  align-items: center;
}

.pay-head {
  display: none;
  padding: 0 1rem 0.5rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pay-row {
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "cust amt"
    "ref status"
    "date date"
    "note note";
  padding: 0.85rem 1rem;
  cursor: pointer;
  list-style: none;
}

.pay-row::-webkit-details-marker {
  display: none;
}

.c-cust { grid-area: cust; }
.c-amt { grid-area: amt; text-align: end; }
.c-ref { grid-area: ref; }
.c-status { grid-area: status; text-align: end; }
.c-date { grid-area: date; }
.c-note { grid-area: note; }

@media (min-width: 62rem) {
  .pay-head {
    display: grid;
  }

  .pay-head,
  .pay-row {
    grid-template-columns: 8.5rem 10.5rem minmax(10rem, 1.3fr) 8rem 6.5rem minmax(12rem, 2fr);
    grid-template-areas: none;
  }

  .pay-row {
    grid-template-areas: "date ref cust amt status note";
  }

  .c-amt,
  .c-status {
    text-align: start;
  }
}

.pay {
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: rgb(0 0 0 / 0.14);
}

.pay + .pay {
  margin-top: 0.5rem;
}

.pay:hover,
.pay[open] {
  border-color: var(--hairline-strong);
}

.pay-declined,
.pay-error {
  border-inline-start: 3px solid var(--error);
}

.pay-approved {
  border-inline-start: 3px solid var(--jade);
}

.c-date,
.c-ref {
  color: var(--muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.c-cust {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.4;
}

.c-cust strong {
  color: var(--heading);
  font-weight: 500;
  overflow-wrap: anywhere;
}

.c-cust small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.c-amt {
  color: var(--heading);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.c-note {
  color: var(--body);
  font-size: 0.875rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.pay-declined .c-note,
.pay-error .c-note {
  color: #ffd1cc;
}

.pay-detail {
  padding: 0.25rem 1rem 1rem;
  border-top: 1px solid var(--hairline);
}

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 0.75rem 1.5rem;
  margin: 1rem 0;
}

.facts dt {
  color: var(--muted);
  font-size: 0.78rem;
}

.facts dd {
  margin: 0;
  color: var(--heading);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.25rem;
}

.form-row {
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  align-items: end;
}

.limits {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  gap: 1.25rem 1.5rem;
}

.actions-row {
  display: flex;
  gap: 0.75rem;
}

.reset {
  margin-top: 1rem;
}

.log {
  margin-top: 1rem;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: rgb(0 0 0 / 0.18);
  font-size: 0.85rem;
}

.log-row {
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1fr);
  gap: 0.15rem 1rem;
  padding: 0.55rem 0.9rem;
}

.log-row + .log-row {
  border-top: 1px solid var(--hairline);
}

.log-row time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.log-bad .log-msg {
  color: #ffd1cc;
}

.log-detail {
  grid-column: 2;
  color: var(--muted);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

code {
  font-family: ui-monospace, Consolas, monospace;
}

@media (max-width: 36rem) {
  .log-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .log-detail {
    grid-column: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
