
:root {
  --void:    #0D0303;
  --deep:    #1E0808;
  --panel:   #230A0A;
  --gold:    #F7AA4F;
  --gold-lt: #F9BD73;
  --gold-dk: #C4862A;
  --cream:   #FFEFD9;
  --muted:   rgba(255,239,217,.52);
  --border:  rgba(247,170,79,.14);
  --border2: rgba(247,170,79,.08);
  --red:     #E87070;
  --red-bg:  rgba(80,20,20,.28);
  --green:   #7BC67E;
  --green-bg:rgba(20,60,20,.28);
}

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

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: 'Montserrat', sans-serif;
  background: var(--void);
  color: var(--cream);
  min-height: 100vh;
  padding: 0 0 80px;
}

a { color: inherit; text-decoration: none; }

button { cursor: pointer; border: none; background: none; font-family: inherit; }

/* ───────── topbar ───────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13,3,3,.88);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  transition: color .2s;
}

.back-link svg { flex-shrink: 0; }

.back-link:hover { color: var(--gold); }

.topbar-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--cream);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  min-width: 0;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255,239,217,.16);
  border: 1px solid rgba(255,239,217,.34);
  box-shadow: 0 0 0 1px rgba(255,239,217,.08) inset;
  flex: 0 0 auto;
  position: relative;
  z-index: 100;
}

.lang-btn {
  height: 30px;
  min-width: 40px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #fff;
  border: 1px solid rgba(255,239,217,.45);
  background: rgba(255,239,217,.1);
  text-shadow: 0 1px 1px rgba(0,0,0,.45);
  transition: border-color .2s, color .2s, background .2s;
  flex: 0 0 auto;
}

.lang-btn:hover {
  color: #fff;
  border-color: rgba(255,239,217,.45);
  background: rgba(255,239,217,.08);
}

.lang-btn.active {
  color: #2b1200;
  border-color: rgba(247,170,79,.7);
  background: linear-gradient(135deg, rgba(249,189,115,.98), rgba(247,170,79,.98));
  box-shadow: 0 0 0 1px rgba(247,170,79,.3) inset;
  text-shadow: none;
}

.btn-ghost {
  flex: 0 0 auto;
}

.btn-ghost {
  height: 32px;
  padding: 0 14px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid rgba(255,239,217,.12);
  transition: color .2s, border-color .2s;
}

.btn-ghost:hover {
  color: var(--cream);
  border-color: rgba(255,239,217,.28);
}

.btn-refresh {
  height: 32px;
  width: 32px;
  border-radius: 4px;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  transition: background .2s, transform .35s;
}

.btn-refresh:hover { background: rgba(247,170,79,.06); }
.btn-refresh.spinning svg { animation: spin .5s linear; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ───────── page body ───────── */
.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 20px 0;
}

.page-head {
  margin-bottom: 28px;
}

.page-head h1 {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 6px;
}

.page-head h1 em {
  color: var(--gold);
  font-style: italic;
}

.page-head p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

/* ───────── banner ───────── */
.banner {
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.55;
  margin-bottom: 24px;
  min-height: 0;
}

.banner.ok {
  border: 1px solid rgba(247,170,79,.22);
  background: rgba(247,170,79,.05);
  color: rgba(255,239,217,.88);
}

.banner.warn {
  border: 1px solid rgba(232,136,136,.3);
  background: var(--red-bg);
  color: #ebb;
}

.banner.info {
  border: 1px solid rgba(255,239,217,.12);
  background: rgba(255,239,217,.04);
  color: var(--muted);
}

/* ───────── empty / loading ───────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 72px 20px;
  text-align: center;
}

.empty-state svg {
  opacity: .3;
}

.empty-state p {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.65;
}

.empty-state a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 20px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  background: rgba(247,170,79,.12);
  border: 1px solid rgba(247,170,79,.3);
  color: var(--gold);
  transition: background .2s;
}

.empty-state a:hover { background: rgba(247,170,79,.2); }

/* ───────── section label ───────── */
.section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border2);
  margin-bottom: 14px;
}

/* ───────── order card ───────── */
.orders-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 32px;
  min-width: 0;
}

.order-card {
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--border2);
  overflow: hidden;
  transition: border-color .2s;
  min-width: 0;
  max-width: 100%;
}

.order-card:hover { border-color: var(--border); }

.order-card.needs-payment {
  border-color: rgba(247,170,79,.35);
  box-shadow: 0 0 0 1px rgba(247,170,79,.12), 0 8px 32px rgba(0,0,0,.4);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border2);
  min-width: 0;
}

.card-header > div {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-wrap: wrap;
  row-gap: 6px;
}

.card-id {
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: .02em;
}

.card-date {
  font-size: 11px;
  color: var(--muted);
  text-align: right;
  flex: 0 0 auto;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* pending */
.badge-pending {
  background: rgba(255,239,217,.06);
  border: 1px solid rgba(255,239,217,.14);
  color: var(--muted);
}
.badge-pending .dot { background: rgba(255,239,217,.4); }

/* awaiting_payment — пульсирует */
.badge-awaiting {
  background: rgba(247,170,79,.1);
  border: 1px solid rgba(247,170,79,.35);
  color: var(--gold);
}
.badge-awaiting .dot {
  background: var(--gold);
  animation: pulse-dot 1.4s infinite;
}

@keyframes pulse-dot {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .4; transform: scale(.7); }
}

/* active */
.badge-active {
  background: var(--green-bg);
  border: 1px solid rgba(123,198,126,.3);
  color: var(--green);
}
.badge-active .dot { background: var(--green); }

/* delivered */
.badge-delivered {
  background: rgba(123,198,126,.08);
  border: 1px solid rgba(123,198,126,.2);
  color: var(--green);
}
.badge-delivered .dot { background: var(--green); }

/* canceled */
.badge-canceled {
  background: var(--red-bg);
  border: 1px solid rgba(232,136,136,.25);
  color: var(--red);
}
.badge-canceled .dot { background: var(--red); }

/* ───────── card body ───────── */
.card-body {
  padding: 16px 18px;
  min-width: 0;
}

.card-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 13px;
  line-height: 1.5;
  padding: 3px 0;
}

.card-row .label {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.card-row .value {
  text-align: right;
  font-weight: 500;
}

.card-divider {
  border: none;
  border-top: 1px solid var(--border2);
  margin: 12px 0;
}

.card-items-title {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.card-items {
  margin: 0 0 10px;
  padding-left: 18px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}

.card-items li {
  margin: 2px 0;
}

.card-items-empty {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--muted);
}

.card-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 4px 0;
}

.card-total-row .label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}

.card-total-row .amount {
  font-size: 22px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: -.01em;
}

/* address */
.card-address {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  line-height: 1.5;
}

.card-address svg { flex-shrink: 0; margin-top: 1px; }

/* ───────── pending info block ───────── */
.pending-info {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 6px;
  background: rgba(255,239,217,.03);
  border: 1px solid rgba(255,239,217,.08);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.65;
}

.pending-info strong {
  display: block;
  color: rgba(255,239,217,.75);
  font-size: 13px;
  margin-bottom: 4px;
}

/* ───────── delivery fee notice ───────── */
.fee-notice {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 6px;
  background: rgba(247,170,79,.06);
  border: 1px solid rgba(247,170,79,.18);
  font-size: 12px;
  color: rgba(255,239,217,.78);
  line-height: 1.65;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.fee-notice svg { flex-shrink: 0; margin-top: 1px; }

/* ───────── payment action ───────── */
.payment-action {
  padding: 18px 18px 18px;
  border-top: 1px solid rgba(247,170,79,.12);
  background: rgba(247,170,79,.03);
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.payment-deadline {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  column-gap: 8px;
  align-items: start;
  overflow-wrap: break-word;
  word-break: normal;
}

.payment-deadline svg { width: 14px; height: 14px; margin-top: 2px; }

.payment-deadline-body {
  min-width: 0;
}

.payment-deadline-lead {
  color: var(--muted);
}

.payment-deadline-summary {
  margin-top: 4px;
  color: rgba(255,239,217,.9);
}

.payment-inline-amount {
  color: var(--gold);
  white-space: nowrap;
  display: inline-block;
  margin-right: 0.2em;
}

.paycom-mount {
  width: 100%;
  max-width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 56px;
  overflow: hidden;
}

.paycom-form {
  width: auto;
  max-width: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 auto;
}

.paycom-button-slot {
  width: 200px;
  height: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto;
}

.paycom-button-slot > * {
  width: 200px !important;
  max-width: 200px !important;
}

.paycom-button-slot img,
.paycom-button-slot svg,
.paycom-button-slot button {
  width: 200px !important;
  max-width: 200px !important;
  height: auto !important;
}

.paycom-submit-btn {
  display: block;
  width: 200px !important;
  max-width: 100% !important;
  border: none;
  padding: 0;
  margin: 0 auto;
  background: transparent;
  cursor: pointer;
  line-height: 0;
  border-radius: 10px;
  overflow: hidden;
}

.paycom-submit-btn.loading {
  opacity: .78;
  filter: saturate(.9);
}

.paycom-submit-btn img {
  display: block;
  width: 200px !important;
  max-width: 100% !important;
  height: auto;
  aspect-ratio: 736 / 170;
  object-fit: contain;
  margin: 0 auto;
}

.paycom-submit-btn:focus-visible {
  outline: 2px solid rgba(247, 170, 79, 0.85);
  outline-offset: 2px;
}

.paycom-loading,
.paycom-error {
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.45;
}

.paycom-loading {
  color: rgba(255,239,217,.85);
  background: rgba(255,255,255,.04);
  border: 1px dashed rgba(247,170,79,.35);
}

.paycom-error {
  color: #ffb4b4;
  background: rgba(190,40,40,.14);
  border: 1px solid rgba(190,40,40,.35);
}

.btn-pay {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 50px;
  padding: 0 28px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  background: linear-gradient(135deg, #00AAFF 0%, #0077DD 100%);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: opacity .2s, transform .15s;
  width: 100%;
  position: relative;
  overflow: hidden;
}

.btn-pay:hover:not(:disabled) {
  opacity: .92;
  transform: translateY(-1px);
}

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

.btn-pay:disabled {
  opacity: .55;
  cursor: not-allowed;
  transform: none;
}

.btn-pay .pay-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Spinner inside pay button */
.btn-pay .pay-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spin .7s linear infinite;
  display: none;
}

.btn-pay.loading .pay-spinner { display: block; }
.btn-pay.loading .pay-text    { display: none;  }
.btn-pay.loading .pay-icon    { display: none;  }

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

/* ───────── active / delivered status info ───────── */
.status-info {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
}

.status-info svg { flex-shrink: 0; }

/* ───────── rating section ───────── */
.rating-section {
  margin-top: 14px;
  padding: 12px;
  border-radius: 6px;
  background: rgba(123,198,126,.08);
  border: 1px solid rgba(123,198,126,.2);
}

.rating-stars {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}

.rating-stars .star {
  font-size: 18px;
  color: rgba(123,198,126,.4);
}

.rating-stars .star.filled {
  color: var(--green);
}

.rating-comment {
  font-size: 12px;
  color: var(--cream);
  line-height: 1.5;
  padding: 0;
}

/* ───────── cancellation reason ───────── */
.cancellation-reason {
  margin-top: 14px;
  padding: 12px;
  border-radius: 6px;
  background: var(--red-bg);
  border: 1px solid rgba(232,136,136,.25);
}

.reason-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 6px;
}

.reason-text {
  font-size: 12px;
  color: rgba(255,239,217,.88);
  line-height: 1.5;
}

/* ───────── rate order button ───────── */
.btn-rate-order {
  width: 100%;
  height: 44px;
  margin-top: 14px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .05em;
  background: rgba(123,198,126,.1);
  border: 1px solid rgba(123,198,126,.3);
  color: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .2s;
}

.btn-rate-order:hover { background: rgba(123,198,126,.15); }

/* ───────── rating modal ───────── */
.rating-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  background: rgba(13,3,3,.85);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-width: 380px;
  width: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border2);
}

.modal-header h2 {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
}

.btn-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  color: var(--muted);
  transition: background .2s, color .2s;
}

.btn-close:hover {
  background: rgba(255,239,217,.08);
  color: var(--cream);
}

.modal-body {
  padding: 18px;
  flex: 1;
  overflow-y: auto;
}

.stars-selector {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 18px;
}

.star-btn {
  width: 48px;
  height: 48px;
  border-radius: 4px;
  font-size: 28px;
  color: rgba(255,239,217,.3);
  background: rgba(255,239,217,.04);
  border: 1px solid rgba(255,239,217,.1);
  transition: all .2s;
}

.star-btn:hover {
  background: rgba(247,170,79,.1);
  color: var(--gold);
}

.star-btn.active {
  background: rgba(123,198,126,.15);
  border-color: rgba(123,198,126,.3);
  color: var(--green);
}

.comment-input {
  width: 100%;
  padding: 10px;
  border-radius: 4px;
  border: 1px solid var(--border2);
  background: rgba(255,239,217,.03);
  color: var(--cream);
  font-family: inherit;
  font-size: 12px;
  line-height: 1.5;
  resize: vertical;
  min-height: 80px;
  transition: border-color .2s;
}

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

.comment-input:focus {
  outline: none;
  border-color: rgba(247,170,79,.35);
  background: rgba(255,239,217,.05);
}

.modal-footer {
  display: flex;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--border2);
  background: rgba(0,0,0,.2);
}

.btn-cancel,
.btn-submit {
  flex: 1;
  height: 40px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  transition: all .2s;
}

.btn-cancel {
  background: rgba(255,239,217,.06);
  border: 1px solid rgba(255,239,217,.14);
  color: var(--muted);
}

.btn-cancel:hover { background: rgba(255,239,217,.12); }

.btn-submit {
  background: linear-gradient(135deg, rgba(247,170,79,.3), rgba(247,170,79,.15));
  border: 1px solid rgba(247,170,79,.3);
  color: var(--gold);
}

.btn-submit:hover:not(:disabled) { background: linear-gradient(135deg, rgba(247,170,79,.4), rgba(247,170,79,.25)); }

.btn-submit:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.btn-submit.loading {
  position: relative;
  color: transparent;
}

.btn-submit.loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(247,170,79,.3);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

/* ───────── scrollable old orders ───────── */
.section-history { margin-top: 8px; }

/* ───────── auth wall ───────── */
.auth-wall {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 80px 20px;
  text-align: center;
}

.auth-wall p {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.65;
  max-width: 340px;
}

.btn-gold {
  height: 44px;
  padding: 0 28px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--gold-dk), var(--gold));
  color: var(--void);
  transition: opacity .2s;
}

.btn-gold:hover { opacity: .88; }

/* ───────── responsive ───────── */
@media (max-width: 480px) {
  .topbar { padding: 0 14px; }
  .topbar-title { display: none; }
  .topbar-right { gap: 8px; }
  .lang-switch { gap: 2px; padding: 2px; }
  .lang-btn {
    height: 28px;
    min-width: 34px;
    padding: 0 6px;
    font-size: 10px;
  }
  .btn-ghost {
    height: 30px;
    padding: 0 10px;
    font-size: 10px;
  }
  .page { padding: 22px 14px 0; }
  .card-header { padding: 12px 14px 10px; }
  .card-date { font-size: 10px; max-width: 40%; }
  .card-body { padding: 14px 14px; }
  .payment-action { padding: 14px 14px 14px; }
  .card-total-row .amount { font-size: 19px; }
  .btn-pay { height: 46px; font-size: 13px; }

  .paycom-mount { min-height: 56px; }
  .paycom-submit-btn { width: 188px !important; }
  .paycom-submit-btn img { width: 188px !important; }
  .paycom-submit-btn { border-radius: 8px; }
}

@media (max-width: 360px) {
  .topbar-right { gap: 6px; }
  .lang-btn {
    min-width: 32px;
    padding: 0 5px;
    font-size: 9px;
  }
  .btn-ghost {
    padding: 0 8px;
    font-size: 9px;
  }
  .paycom-submit-btn { width: 172px !important; }
  .paycom-submit-btn img { width: 172px !important; }
}
