/* Reusable, screen-agnostic component styles. */

/* ---------------------------------------------------------------------
   App bar (top header)
--------------------------------------------------------------------- */
.app-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  /* Grows downward by the safe-area inset (fullscreen mode has no native
     status bar to hold the clock/battery clear of our header anymore, so
     we pad for it ourselves) instead of centering content into a fixed
     height that would otherwise sit under it. */
  height: calc(var(--header-height) + var(--tg-safe-area-top));
  padding-top: var(--tg-safe-area-top);
  max-width: var(--app-max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: var(--margin);
  background: var(--glass-bar-bg);
  backdrop-filter: var(--glass-bar-blur);
  -webkit-backdrop-filter: var(--glass-bar-blur);
  border-bottom: 1px solid var(--glass-bar-border);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.app-bar__icon-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--c-on-surface-variant);
  transition: opacity 0.15s ease;
}
.app-bar__icon-btn:active {
  opacity: 0.7;
}

.app-bar__title-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.app-bar__title {
  font: var(--text-headline-sm);
  color: var(--c-on-surface);
  line-height: 1.2;
}
.app-bar__logo {
  height: 40px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
}

/* Brand mark shown alone in the header (see public/assets/logo-mark*.png). */
.app-bar__logo-mark {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex-shrink: 0;
}
.app-bar__subtitle {
  font: var(--text-label-sm);
  color: var(--c-on-surface-variant);
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}
.app-bar__subtitle-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--c-tertiary);
  display: inline-block;
}

/* Right-aligned brand block used on the select-service header (brand name
   + tiny Persian subtitle stacked, RTL-start aligned) plus the instant
   -delivery pill on the opposite side. */
.app-bar__brand {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: right;
}
.app-bar__brand-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.app-bar__brand-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--c-on-surface);
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.app-bar__brand-subtitle {
  font-size: 12px;
  font-weight: 500;
  color: var(--c-on-surface-variant);
  margin-top: 1px;
  line-height: 1;
}
.app-bar__delivery-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  color: #059669;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.25);
  backdrop-filter: blur(6px);
}
.app-bar__delivery-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: #10b981;
  margin-inline-start: 6px;
  animation: pulse-dot 1.8s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ---------------------------------------------------------------------
   Security note pill (below the header on the select-service screen)
--------------------------------------------------------------------- */
.security-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.75) 0%, rgba(255, 255, 255, 0.45) 100%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  padding: 8px 16px;
  box-shadow: 0 4px 16px 0 rgba(31, 38, 135, 0.04);
}
.security-note__icon {
  width: 14px;
  height: 14px;
  color: #f59e0b;
  flex-shrink: 0;
}
.security-note__text {
  font: var(--text-label-sm);
  color: var(--c-on-surface-variant);
  font-weight: 600;
}

/* ---------------------------------------------------------------------
   Main scroll canvas
--------------------------------------------------------------------- */
.app-main {
  flex: 1;
  min-height: 0; /* required so a flex child can actually shrink and scroll instead of stretching #app taller than the viewport */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-inline: var(--margin);
  padding-top: calc(var(--header-height) + var(--tg-safe-area-top) + var(--space-md));
  padding-bottom: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}
/* Bottom clearance so the last row of content can scroll fully ABOVE the
   fixed bottom bar(s). It is a real flex item (not padding-bottom) on
   purpose: trailing padding of a scroll container is dropped from the
   scrollable area by some WebViews, a spacer element never is.
   Screens override --main-clearance (confirm/result set a fixed value; the
   select screen measures its two floating docks at runtime — see
   js/screens/select-service.js). The default is >= 120px. */
.app-main::after {
  content: "";
  display: block;
  flex: 0 0 auto;
  height: var(--main-clearance, calc(120px + var(--tg-safe-area-bottom)));
}

/* ---------------------------------------------------------------------
   Step progress indicator
--------------------------------------------------------------------- */
.step-progress {
  padding-top: var(--space-xs);
  padding-bottom: var(--space-xs);
}
.step-progress__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: 4px;
  margin-bottom: var(--space-sm);
}
.step-progress__label {
  font: var(--text-label-sm);
  color: var(--c-primary);
  font-weight: 700;
}
.step-progress__percent {
  font: var(--text-label-sm);
  color: var(--c-secondary);
  font-weight: 500;
}
.step-progress__bars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
/* The wizard is 3 steps (select -> confirm & pay -> result) now that the
   standalone "در حال انتقال به درگاه" screen was folded into step 2. */
.step-progress__bars--3 {
  grid-template-columns: repeat(3, 1fr);
}
.step-progress__bar {
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--c-surface-container-highest);
}
.step-progress__bar--active {
  background: var(--c-primary);
}
.step-progress__bar--done {
  background: var(--c-tertiary);
}

/* ---------------------------------------------------------------------
   Segmented control (tabs)
--------------------------------------------------------------------- */
.segmented {
  display: flex;
  align-items: center;
  background: var(--c-surface-container-high);
  border: 1px solid color-mix(in srgb, var(--c-outline-variant) 60%, transparent);
  border-radius: var(--radius-xl);
  padding: 4px;
  gap: 4px;
}
.segmented__btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-lg);
  font: var(--text-label-md);
  font-weight: 700;
  color: var(--c-secondary);
  transition: background-color 0.15s ease, color 0.15s ease;
}
.segmented__btn--active {
  background: var(--c-surface-container-lowest);
  color: var(--c-primary);
  border: 1px solid color-mix(in srgb, var(--c-outline-variant) 40%, transparent);
}
.segmented__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ---------------------------------------------------------------------
   Card (generic container)
--------------------------------------------------------------------- */
.card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.82) 0%, rgba(255, 255, 255, 0.52) 100%);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-2xl);
  padding: var(--space-lg);
  box-shadow: var(--glass-shadow);
}
.card__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--c-surface-container-high);
}
.card__row:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}
.card__label {
  font: var(--text-body-sm);
  color: var(--c-secondary);
  font-weight: 500;
}
.card__value {
  font: var(--text-body-md);
  color: var(--c-on-surface);
  font-weight: 600;
}

/* ---------------------------------------------------------------------
   Quantity stepper
--------------------------------------------------------------------- */
.stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 8px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}
.stepper__btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  background: rgba(100, 116, 139, 0.1);
  border: 1px solid #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-on-surface-variant);
  transition: background-color 0.15s ease, transform 0.1s ease;
  flex-shrink: 0;
}
.stepper__btn:active {
  transform: scale(0.95);
  background: rgba(100, 116, 139, 0.18);
}
.stepper__btn--plus {
  background: rgba(0, 152, 234, 0.1);
  border-color: rgba(56, 189, 248, 0.2);
  color: var(--c-primary-container);
}
.stepper__btn--plus:active {
  background: rgba(0, 152, 234, 0.2);
}
.stepper__display {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.stepper__value-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.stepper__value {
  font: var(--text-headline-lg-mobile);
  font-weight: 800;
  color: var(--c-on-surface);
  letter-spacing: -0.01em;
  min-width: 3ch;
  text-align: center;
}
.stepper__unit-label {
  font: var(--text-label-sm);
  color: var(--c-on-surface-variant);
  font-weight: 700;
}
.stepper__star-icon {
  color: #f59e0b;
  filter: drop-shadow(0 1px 1px rgba(245, 158, 11, 0.25));
}

/* Header row above the number box: field label + per-unit rate, used on
   the stars stepper card. */
.stepper-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-inline: 2px;
}
.stepper-card__label {
  font: var(--text-label-md);
  font-weight: 700;
  color: var(--c-on-surface-variant);
}
.stepper-card__rate {
  font: var(--text-label-sm);
  color: var(--c-on-surface-variant);
  font-weight: 600;
}

/* ---------------------------------------------------------------------
   Preset chips
--------------------------------------------------------------------- */
.chip-row {
  display: grid;
  /* Three equal columns. Built as 6 tracks with every chip spanning 2 so a
     short last row (e.g. 5 presets = 3 + 2) can be centered instead of
     leaving an empty hole on one side. */
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
.chip-row > .chip {
  grid-column: span 2;
  width: 100%;
  text-align: center;
}
/* last row has 2 chips -> center them under the 3-column grid */
.chip-row > .chip:nth-last-child(2):nth-child(3n + 1) {
  grid-column: 2 / span 2;
}
.chip-row > .chip:last-child:nth-child(3n + 2) {
  grid-column: 4 / span 2;
}
/* last row has 1 chip -> center it */
.chip-row > .chip:last-child:nth-child(3n + 1) {
  grid-column: 3 / span 2;
}
.chip-row--3 {
  grid-template-columns: repeat(3, 1fr);
}
.chip-row--3 > .chip {
  grid-column: auto;
}
.chip {
  padding: 10px 4px;
  border-radius: var(--radius-lg);
  font: var(--text-label-md);
  font-weight: 800;
  text-align: center;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.75);
  color: var(--c-on-surface-variant);
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}
.chip:active {
  transform: scale(0.97);
}
.chip--active {
  border: 2px solid var(--c-primary);
  background: linear-gradient(to bottom, rgba(0, 152, 234, 0.2), rgba(0, 152, 234, 0.1));
  color: var(--c-primary-container);
  font-weight: 800;
  transform: scale(1.03);
  box-shadow: 0 1px 4px rgba(0, 152, 234, 0.1);
}
.chip--stacked {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  min-height: 52px;
}
.chip__qty {
  font: var(--text-label-md);
  font-weight: 800;
}
.chip__tag {
  font: var(--text-label-sm);
  font-weight: 700;
  color: var(--c-primary);
  line-height: 1.1;
}
.chip__tag--muted {
  color: var(--c-on-surface-variant);
  font-weight: 600;
}
.stars-pack-hint {
  font: var(--text-label-sm);
  color: var(--c-on-surface-variant);
  margin: 0 0 10px;
  line-height: 1.5;
}
.chip-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 14px 0;
  border-radius: var(--radius-xl);
  border: 1px solid color-mix(in srgb, var(--c-outline-variant) 80%, transparent);
  background: var(--c-surface-container-lowest);
  color: var(--c-secondary);
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.chip-tile--active {
  border-color: var(--c-primary);
  background: var(--c-primary);
  color: var(--c-on-primary);
}
.chip-tile__num {
  font: var(--text-headline-sm);
  font-weight: 700;
}
.chip-tile__unit {
  font: var(--text-label-sm);
}

/* ---------------------------------------------------------------------
   Text input
--------------------------------------------------------------------- */
.field-label {
  display: block;
  font: var(--text-label-lg);
  color: var(--c-on-surface);
  font-weight: 600;
  margin-bottom: var(--space-xs);
}
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}
.input-wrap__prefix {
  position: absolute;
  left: 12px;
  color: var(--c-secondary);
  font-weight: 700;
  font-size: 16px;
  pointer-events: none;
  user-select: none;
}
.text-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 14px 12px 14px 36px;
  font: var(--text-body-md);
  color: var(--c-on-surface);
  font-weight: 600;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.text-input::placeholder {
  color: var(--c-outline);
}
.text-input:focus {
  outline: none;
  background: #ffffff;
  border-color: rgba(56, 189, 248, 0.6);
  box-shadow: 0 0 0 3px rgba(0, 152, 234, 0.15);
}
.field-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font: var(--text-label-sm);
  min-height: 16px;
}
.field-status__hint {
  color: var(--c-secondary);
}
.field-status__ok {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--c-secondary);
}
.field-status__ok-badge {
  color: var(--c-tertiary);
  font-weight: 700;
}
.field-status__error {
  color: var(--c-error);
  font-weight: 600;
}

/* ---------------------------------------------------------------------
   Gift message (optional text + "show my username" checkbox) —
   confirm-order screen, gift orders only.
--------------------------------------------------------------------- */
.text-input--textarea {
  padding: 12px 14px;
  resize: none;
  font-family: inherit;
  line-height: 1.6;
  min-height: 76px;
}
.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 4px;
  font: var(--text-body-sm);
  color: var(--c-on-surface);
  cursor: pointer;
}
.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--c-primary);
  flex-shrink: 0;
}

/* Recipient name + avatar preview, shown under the username field once a
   Telegram lookup succeeds (see resolveRecipient in api.js). Hidden by
   default — most lookups miss (Bot API can only resolve users it has
   already seen), so this only appears on an actual match. */
.recipient-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  margin-top: 8px;
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--c-tertiary) 8%, var(--c-surface-container-low));
  border: 1px solid color-mix(in srgb, var(--c-tertiary) 20%, transparent);
  animation: recipient-preview-in 0.18s ease;
}
.recipient-preview .recipient-card {
  width: 100%;
}
.recipient-preview .recipient-card__lines {
  flex: 1;
}
@keyframes recipient-preview-in {
  from { opacity: 0; transform: translateY(-2px); }
  to { opacity: 1; transform: translateY(0); }
}
.recipient-preview__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--c-surface-container-high);
}
.recipient-preview__avatar--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-outline);
}
.recipient-preview__avatar--placeholder .icon {
  width: 20px;
  height: 20px;
}
.recipient-preview__name {
  font: var(--text-body-sm);
  font-weight: 700;
  color: var(--c-on-surface);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recipient-preview__check {
  color: var(--c-tertiary);
  flex-shrink: 0;
}
.recipient-preview__check .icon {
  width: 16px;
  height: 16px;
}

/* Two-line "who is this actually going to" card — full name on top,
   @username underneath, avatar photo beside both. Shared markup between
   screen 1 (public/js/lib/recipient-card.js) and screen 2's order
   summary, so the buyer sees the same visual confirmation in both places. */
.recipient-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.recipient-card__avatar {
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--c-surface-container-high);
}
.recipient-card__avatar--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-outline);
}
.recipient-card__avatar--placeholder .icon {
  width: 60%;
  height: 60%;
}
.recipient-card__lines {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}
.recipient-card__fullname {
  font: var(--text-body-sm);
  font-weight: 700;
  color: var(--c-on-surface);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recipient-card__username {
  font: var(--text-label-sm);
  color: var(--c-secondary);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recipient-card__check {
  color: var(--c-tertiary);
  flex-shrink: 0;
  display: flex;
}
.recipient-card__check .icon {
  width: 16px;
  height: 16px;
}

/* ---------------------------------------------------------------------
   Badges
--------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font: var(--text-label-sm);
  font-weight: 700;
}
.badge--primary {
  color: var(--c-primary);
  background: color-mix(in srgb, var(--c-primary-fixed) 50%, transparent);
}
.badge--success {
  color: var(--c-tertiary);
  background: color-mix(in srgb, var(--c-tertiary) 10%, transparent);
}

/* ---------------------------------------------------------------------
   Info / guarantee micro-card
--------------------------------------------------------------------- */
.info-note {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 12px;
}
.info-note__icon {
  color: var(--c-primary);
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}
.info-note__text {
  font: var(--text-label-sm);
  color: var(--c-on-surface-variant);
  line-height: 1.6;
}

/* ---------------------------------------------------------------------
   Error banner
--------------------------------------------------------------------- */
.error-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--c-error-container);
  border: 1px solid color-mix(in srgb, var(--c-error) 30%, transparent);
  border-radius: var(--radius-lg);
  padding: 12px;
}
.error-banner__icon {
  color: var(--c-error);
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}
.error-banner__text {
  font: var(--text-label-sm);
  color: var(--c-on-error-container);
  line-height: 1.6;
  flex: 1;
}

/* ---------------------------------------------------------------------
   Buttons
--------------------------------------------------------------------- */
.btn-primary {
  width: 100%;
  height: 54px;
  background: var(--c-primary-gradient);
  color: var(--c-on-primary);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: var(--radius-xl);
  font: var(--text-label-lg);
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--glow-sky);
  transition: transform 0.15s ease, filter 0.15s ease;
}
.btn-primary:active {
  transform: scale(0.98);
  filter: brightness(1.05);
}
.btn-secondary {
  width: 100%;
  height: 48px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--c-on-surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  font: var(--text-label-lg);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background-color 0.15s ease;
}
.btn-secondary:active {
  background: rgba(255, 255, 255, 0.85);
}
.btn-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ---------------------------------------------------------------------
   Bottom action dock
--------------------------------------------------------------------- */
.action-dock {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  max-width: var(--app-max-width);
  margin: 0 auto;
  background: var(--glass-bar-bg);
  backdrop-filter: var(--glass-bar-blur);
  -webkit-backdrop-filter: var(--glass-bar-blur);
  border-top: 1px solid var(--glass-bar-border);
  box-shadow: 0 -12px 36px rgba(15, 23, 42, 0.08);
  padding: 12px var(--margin);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: max(12px, env(safe-area-inset-bottom), var(--tg-safe-area-bottom));
}
.action-dock--split {
  flex-direction: row;
}
.action-dock--split .btn-primary,
.action-dock--split .btn-secondary {
  flex: 1;
  width: auto;
}
/* Back is a secondary escape hatch on the confirm+pay screen — most people
   are here to finish, not to leave — so it shrinks to a small icon-only
   button (~20% of the dock) and lets "پرداخت" (~80%) read as the obvious
   next step. */
.action-dock--split .btn-secondary--compact {
  flex: 0 0 auto;
  width: 54px;
  padding: 0;
}

.dock-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding-block: 2px;
}
.dock-dots__dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--c-surface-container-highest);
}
.dock-dots__dot--active {
  width: 10px;
  height: 10px;
  background: var(--c-primary);
}
.dock-dots__dot--done {
  background: var(--c-primary);
}

/* ---------------------------------------------------------------------
   Skeleton loading placeholder
--------------------------------------------------------------------- */
.skeleton {
  display: inline-block;
  border-radius: var(--radius-sm);
  background: linear-gradient(
    90deg,
    var(--c-surface-container-high) 25%,
    var(--c-surface-container-highest) 37%,
    var(--c-surface-container-high) 63%
  );
  background-size: 400% 100%;
  animation: skeleton-loading 1.4s ease infinite;
}
@keyframes skeleton-loading {
  0% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0 50%;
  }
}
@media (prefers-reduced-motion: reduce) {
  .skeleton {
    animation: none;
  }
}

/* ---------------------------------------------------------------------
   Glass bottom tab bar (mimics Telegram's own native tab bar: translucent,
   blurred, floating over content — only shown on the service-select screen)
--------------------------------------------------------------------- */
.glass-tabbar {
  position: fixed;
  bottom: 14px;
  left: 12px;
  right: 12px;
  z-index: 45;
  max-width: calc(var(--app-max-width, 100vw) - 24px);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 6px;
  border-radius: var(--radius-2xl);

  /* The glass effect: translucent surface + blur + hairline border + a
     soft shadow lifting the floating pill off the content behind it.
     Opacity kept low enough that the blur is actually visible (a near-
     opaque background defeats backdrop-filter visually even where the
     WebView supports it) — matches Telegram's own frosted panels. */
  background: var(--glass-bar-bg);
  backdrop-filter: var(--glass-bar-blur);
  -webkit-backdrop-filter: var(--glass-bar-blur);
  border: 1px solid var(--glass-bar-border);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
}
.glass-tabbar__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border-radius: var(--radius-xl);
  color: var(--c-outline);
  transition: color 0.15s ease, background-color 0.15s ease;
}
.glass-tabbar__item--active {
  color: var(--c-primary-container);
  background: rgba(0, 152, 234, 0.12);
  font-weight: 700;
}
.glass-tabbar__icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}
.glass-tabbar__item--active .glass-tabbar__icon-wrap {
  transform: scale(1.1);
}
.glass-tabbar__icon {
  width: 20px;
  height: 20px;
}
.glass-tabbar__label {
  font: var(--text-label-sm);
  font-weight: 600;
}


/* ---------------------------------------------------------------------
   Screen transition (subtle fade+rise on navigation)
--------------------------------------------------------------------- */
.screen-enter {
  animation: screen-enter-anim 0.22s ease;
}
@keyframes screen-enter-anim {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@media (prefers-reduced-motion: reduce) {
  .screen-enter {
    animation: none;
  }
}

/* ---------------------------------------------------------------------
   Service hero (icon badge + title + description, top of select screen)
--------------------------------------------------------------------- */
.service-hero {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding-top: 4px;
}
.service-hero__badge {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.82) 0%, rgba(255, 255, 255, 0.52) 100%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}
.service-hero__badge--stars {
  color: #f59e0b;
}
.service-hero__badge--gift {
  color: #f43f5e;
}
.service-hero__badge--premium {
  color: #6366f1;
}
.service-hero__title {
  font: var(--text-headline-md);
  color: var(--c-on-surface);
  font-weight: 900;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 6px;
}
.service-hero__title-icon {
  width: 16px;
  height: 16px;
  color: #fbbf24;
}
.service-hero__desc {
  font: var(--text-body-sm);
  color: var(--c-on-surface-variant);
  line-height: 1.7;
  margin-top: 2px;
}

/* ---------------------------------------------------------------------
   Gift grid + gift card
--------------------------------------------------------------------- */
.gift-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px 16px;
}
.gift-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: var(--space-lg) var(--space-sm);
  border-radius: var(--radius-2xl);
  border: 1px solid var(--glass-border);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.82) 0%, rgba(255, 255, 255, 0.52) 100%);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
  text-align: center;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.gift-card--active {
  border: 2px solid rgba(56, 189, 248, 0.8);
  background: rgba(0, 152, 234, 0.1);
  box-shadow: var(--glass-shadow-float), 0 0 0 2px rgba(56, 189, 248, 0.3);
  transform: scale(1.02);
}
.gift-card__emoji {
  font-size: 40px;
  line-height: 1;
}
.gift-card__name {
  font: var(--text-label-md);
  font-weight: 700;
  color: var(--c-on-surface);
}
.gift-card__tagline {
  font: var(--text-label-sm);
  color: var(--c-on-surface-variant);
  font-weight: 500;
  line-height: 1.35;
  max-width: 100%;
}
.gift-card__price {
  font: var(--text-label-sm);
  color: var(--c-secondary);
  font-weight: 600;
  opacity: 0.85;
}
.gift-card__tag {
  position: absolute;
  top: 8px;
  right: 8px;
  font: var(--text-label-sm);
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--c-tertiary) 14%, transparent);
  color: var(--c-tertiary);
}
.gift-card__check {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  background: var(--c-primary);
  color: var(--c-on-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------------------------------------------------------------------
   Premium plan list
--------------------------------------------------------------------- */
.plan-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.plan-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* <button> centers its text by default; cards must read start-aligned
     (right in RTL) so subtitles sit exactly under the plan title. */
  text-align: start;
  gap: 12px;
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-2xl);
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.68);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.plan-card--featured {
  /* room for the ribbon tab that sits inside the top edge */
  padding-top: calc(var(--space-md) + 14px);
  transform: scale(1.015);
  border-color: rgba(34, 158, 217, 0.35);
  box-shadow:
    0 12px 32px rgba(34, 158, 217, 0.12),
    0 0 0 1px rgba(255, 255, 255, 0.6) inset;
}
/* "Best value" tab: sits INSIDE the top edge of the 12-month card, so it
   can never poke out over the neighbouring card's border. */
.plan-card__ribbon {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  font: var(--text-label-sm);
  font-weight: 800;
  color: var(--c-primary);
  background: color-mix(in srgb, var(--c-primary) 12%, rgba(255, 255, 255, 0.9));
  border: 1px solid rgba(34, 158, 217, 0.22);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 2px 14px 3px;
  white-space: nowrap;
}
.plan-card--active {
  border: 2px solid rgba(34, 158, 217, 0.55);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--glass-shadow-float), 0 0 0 2px rgba(34, 158, 217, 0.15);
}
.plan-card--featured.plan-card--active {
  transform: scale(1.02);
}
.plan-card__radio {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  border: 2px solid var(--c-outline-variant);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s ease;
}
.plan-card--active .plan-card__radio {
  border-color: var(--c-primary);
  background: var(--c-primary);
}
.plan-card__radio-dot {
  width: 9px;
  height: 9px;
  border-radius: var(--radius-full);
  background: var(--c-on-primary);
}
.plan-card__body {
  flex: 1;
  min-width: 0;
  /* title row and subtitle share one start edge (right in RTL) */
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: start;
}
.plan-card__title-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  flex-wrap: wrap;
}
.plan-card__title {
  font: var(--text-label-md);
  font-weight: 700;
  color: var(--c-on-surface);
}
.plan-card__badge {
  font: var(--text-label-sm);
  font-weight: 800;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--c-primary) 12%, transparent);
  color: var(--c-primary);
}
.plan-card__discount {
  /* legacy alias — prefer plan-card__badge */
  font: var(--text-label-sm);
  font-weight: 800;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--c-primary) 12%, transparent);
  color: var(--c-primary);
}
.plan-card__sub {
  display: block;
  text-align: start;
  font: var(--text-label-sm);
  color: var(--c-secondary);
  font-weight: 500;
  margin-top: 2px;
}
.plan-card__price-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}
.plan-card__price {
  font: var(--text-body-md);
  font-weight: 800;
  color: var(--c-on-surface);
  white-space: nowrap;
}
.plan-card__monthly {
  font: var(--text-label-sm);
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
}

/* ---------------------------------------------------------------------
   Sticky price + CTA footer (used by select screen, sits above tab bar)
--------------------------------------------------------------------- */
.price-dock {
  position: fixed;
  left: 12px;
  right: 12px;
  /* Sits above the tab bar with a real gap (--dock-gap) instead of nearly
     touching it. The tab bar itself floats 14px off the screen edge, so
     that offset is added too, or the two would still read as glued. */
  bottom: calc(var(--tabbar-height) + var(--tg-safe-area-bottom) + 14px + var(--dock-gap));
  z-index: 40;
  max-width: calc(var(--app-max-width, 100vw) - 24px);
  margin: 0 auto;
  background: var(--glass-bar-bg);
  backdrop-filter: var(--glass-bar-blur);
  -webkit-backdrop-filter: var(--glass-bar-blur);
  border: 1px solid var(--glass-bar-border);
  border-radius: var(--radius-2xl);
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.12);
  padding: 12px;
  /* Price on one side, call-to-action on the other (RTL: price on the right). */
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.price-dock__info {
  flex: 0 0 auto;
  min-width: 0;
  text-align: start;
}
.price-dock__label {
  display: block;
  font: var(--text-label-sm);
  color: var(--c-on-surface-variant);
  font-weight: 500;
  margin-bottom: 2px;
}
.price-dock__value {
  font: var(--text-headline-sm);
  color: var(--c-on-surface);
  font-weight: 800;
  white-space: nowrap;
  min-height: 26px;
}
.price-dock .btn-primary {
  width: auto;
  flex: 1 1 0;
  min-width: 0;
  max-width: 220px;
  height: 48px;
  padding-inline: 12px;
  white-space: nowrap;
}

/* ---------------------------------------------------------------------
   Icon helper (inline SVG sizing)
--------------------------------------------------------------------- */
.icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  fill: currentColor;
}

