/* =========================================================
   TutYakTut / Tytyaktyt — Global Design Tokens & Base Styles
   ========================================================= */

:root {
  /* Brand */
  --color-primary: #FF6B00;
  --color-primary-light: #FFF3E6;
  --color-primary-dark: #E55D00;
  --color-primary-soft: #FFFBF5;

  /* Surfaces */
  --color-bg: #FAFAFA;
  --color-surface: #FFFFFF;
  --color-surface-alt: #F5F5F5;

  /* Status colors */
  --color-green: #22C55E;
  --color-green-dark: #16A34A;
  --color-green-light: #E8F5E9;
  --color-red: #F44336;
  --color-red-light: #FFEBEE;
  --color-blue: #3B82F6;
  --color-blue-light: #DBEAFE;
  --color-purple: #A855F7;
  --color-purple-light: #F3E8FF;

  /* Text */
  --color-text: #1A1A1A;
  --color-text-secondary: #6B7280;
  --color-text-tertiary: #9CA3AF;
  --color-text-white: #FFFFFF;

  /* Borders */
  --border-color: #E5E7EB;
  --border-dashed: #D1D5DB;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-button: 0 6px 20px rgba(255, 107, 0, 0.35);
  --shadow-button-green: 0 6px 20px rgba(34, 197, 94, 0.3);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.04);

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  /* Typography */
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter',
    Roboto, 'Helvetica Neue', Arial, sans-serif;

  /* Safe areas */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* App frame (max mobile width, centered on desktop) */
  --app-max-width: 430px;
}

/* --------- Reset & base --------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  color: var(--color-text);
  background: #EEEEEE;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  overscroll-behavior-y: none;
}

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

input,
textarea,
select {
  font-family: inherit;
  color: inherit;
}

textarea {
  resize: none;
}

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

img {
  max-width: 100%;
  display: block;
}

[x-cloak] {
  display: none !important;
}

/* --------- App frame (mobile emulation on desktop) --------- */
.app-frame {
  position: relative;
  min-height: 100vh;
  max-width: var(--app-max-width);
  margin: 0 auto;
  background: var(--color-bg);
  overflow-x: hidden;
  padding-top: var(--safe-top);
  box-shadow: 0 0 32px rgba(0, 0, 0, 0.08);
}

.app-frame--onboarding {
  background: var(--color-primary-soft);
}

/* --------- Header pattern --------- */
.screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  gap: 12px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--color-surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  color: var(--color-text);
  flex-shrink: 0;
  transition: transform 120ms ease;
}

.icon-btn:active {
  transform: scale(0.94);
}

.icon-btn--round {
  border-radius: 50%;
}

.icon-btn--primary {
  color: var(--color-primary);
}

/* --------- Card --------- */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-card);
  padding: 20px;
}

.card--tight {
  padding: 16px;
}

/* --------- Buttons --------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 24px;
  border-radius: var(--radius-full);
  font-size: 16px;
  font-weight: 600;
  transition: transform 120ms ease, box-shadow 200ms ease, opacity 200ms ease;
  min-height: 52px;
  line-height: 1;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

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

.btn--primary {
  background: var(--color-primary);
  color: var(--color-text-white);
  box-shadow: var(--shadow-button);
}

.btn--secondary {
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
}

.btn--ghost-primary {
  background: transparent;
  color: var(--color-primary);
  border: 1.5px solid var(--color-primary);
}

.btn--soft-primary {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.btn--block {
  width: 100%;
}

/* --------- Bottom Tab Bar --------- */
.tab-bar {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--color-surface);
  border-top: 1px solid var(--border-color);
  padding: 10px 12px calc(10px + var(--safe-bottom));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  z-index: 20;
}

.tab-bar__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  color: var(--color-text-tertiary);
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: color 120ms ease;
  min-height: 48px;
  justify-content: center;
}

.tab-bar__item.is-active {
  color: var(--color-primary);
}

/* --------- Sticky bottom action bar --------- */
.action-bar {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--color-surface);
  padding: 14px 20px calc(14px + var(--safe-bottom));
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 20;
}

/* --------- Inputs --------- */
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--color-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  gap: 12px;
  transition: border-color 150ms ease;
}

.input-wrap:focus-within {
  border-color: var(--color-primary);
}

.input-wrap__icon {
  color: var(--color-text-tertiary);
  flex-shrink: 0;
}

.input-wrap input,
.input-wrap textarea {
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  font-size: 16px;
  color: var(--color-text);
}

.input-wrap input::placeholder,
.input-wrap textarea::placeholder {
  color: var(--color-text-tertiary);
}

.textarea-wrap {
  background: var(--color-surface-alt);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  position: relative;
}

.textarea-wrap textarea {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-size: 15px;
  color: var(--color-text);
  min-height: 100px;
  line-height: 1.5;
}

.textarea-wrap__counter {
  position: absolute;
  right: 12px;
  bottom: 10px;
  font-size: 12px;
  color: var(--color-text-tertiary);
}

.field-label {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
}

/* --------- Radio card (payment options) --------- */
.radio-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease;
  background: var(--color-surface);
}

.radio-card.is-active {
  border-color: var(--color-green);
  background: #F7FDF9;
}

.radio-card__icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--color-surface-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  flex-shrink: 0;
}

.radio-card__body {
  flex: 1;
  min-width: 0;
}

.radio-card__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
}

.radio-card__subtitle {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-top: 2px;
}

.radio-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.radio-card.is-active .radio-dot {
  border-color: var(--color-primary);
  background: var(--color-primary);
}

.radio-card.is-active .radio-dot::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
}

/* --------- Segmented control --------- */
.segmented {
  display: flex;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 4px;
}

.segmented__item {
  flex: 1;
  text-align: center;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}

.segmented__item.is-active {
  background: var(--color-primary);
  color: #fff;
}

/* --------- Stepper (order creation) --------- */
.stepper {
  display: flex;
  align-items: center;
  padding: 0 12px;
}

.stepper__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.stepper__circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--border-color);
  color: var(--color-text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  background: var(--color-surface);
}

.stepper__label {
  font-size: 12px;
  color: var(--color-text-tertiary);
}

.stepper__item.is-active .stepper__circle {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.stepper__item.is-active .stepper__label {
  color: var(--color-primary);
  font-weight: 600;
}

.stepper__item.is-done .stepper__circle {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.stepper__line {
  flex: 1;
  height: 0;
  border-top: 1.5px dashed var(--border-dashed);
  margin: 0 6px;
  margin-bottom: 22px;
}

.stepper__line.is-done {
  border-top-color: var(--color-primary);
}

/* --------- Bottom sheet --------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 40;
}

.sheet {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: var(--app-max-width);
  background: var(--color-surface);
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  padding: 12px 20px calc(20px + var(--safe-bottom));
  z-index: 50;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15);
}

.sheet__handle {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: #D1D5DB;
  margin: 0 auto 14px;
}

/* --------- Star rating --------- */
.star {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #E5E7EB;
  transition: color 150ms ease, transform 150ms ease;
}

.star.is-active {
  color: var(--color-primary);
}

.star:active {
  transform: scale(0.9);
}

/* --------- Utility --------- */
.h1 { font-size: 30px; font-weight: 700; line-height: 1.15; }
.h2 { font-size: 22px; font-weight: 700; line-height: 1.25; }
.h3 { font-size: 18px; font-weight: 600; line-height: 1.3; }
.text-sec { color: var(--color-text-secondary); }
.text-ter { color: var(--color-text-tertiary); }
.text-green { color: var(--color-green-dark); }
.text-red { color: var(--color-red); }
.text-primary { color: var(--color-primary); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  background: var(--color-surface-alt);
  color: var(--color-text-secondary);
}
.badge--green {
  background: var(--color-green-light);
  color: var(--color-green-dark);
}
.badge--primary {
  background: var(--color-primary-light);
  color: var(--color-primary);
}
.badge--red {
  background: var(--color-red-light);
  color: var(--color-red);
}
.badge--blue {
  background: var(--color-blue-light);
  color: var(--color-blue);
}
.badge--purple {
  background: var(--color-purple-light);
  color: var(--color-purple);
}

/* Avatar */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FFB88C, #FF6B00);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}

.avatar--md {
  width: 56px;
  height: 56px;
  font-size: 18px;
}

.avatar--lg {
  width: 96px;
  height: 96px;
  font-size: 32px;
}

.avatar__online {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-green);
  border: 2px solid #fff;
}

.avatar--lg .avatar__online {
  width: 18px;
  height: 18px;
  border-width: 3px;
}

/* Divider */
.divider {
  height: 1px;
  background: var(--border-color);
  margin: 12px 0;
}

/* Content column with global horizontal padding */
.stack {
  display: flex;
  flex-direction: column;
}

.px-20 { padding-left: 20px; padding-right: 20px; }
.py-4  { padding-top: 4px;  padding-bottom: 4px; }
.py-8  { padding-top: 8px;  padding-bottom: 8px; }
.py-12 { padding-top: 12px; padding-bottom: 12px; }
.py-16 { padding-top: 16px; padding-bottom: 16px; }
.py-20 { padding-top: 20px; padding-bottom: 20px; }
.py-24 { padding-top: 24px; padding-bottom: 24px; }
.py-32 { padding-top: 32px; padding-bottom: 32px; }
.gap-4  { gap: 4px; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-24 { gap: 24px; }
.flex   { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.flex-1 { flex: 1; }
.grow-0 { flex-grow: 0; }
.shrink-0 { flex-shrink: 0; }
.w-full { width: 100%; }
.text-center { text-align: center; }

/* Grid utilities */
.grid { display: grid; }
.grid-2 { grid-template-columns: 1fr 1fr; }

/* Content scroll area (between header & fixed bottom) */
.scroll-area {
  padding-bottom: 24px;
}

/* Onboarding hero */
.hero-onboarding {
  height: 42vh;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
}

.hero-onboarding svg,
.hero-onboarding img {
  max-height: 100%;
  max-width: 100%;
}

/* Role cards */
.role-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0 20px;
}

.role-card {
  aspect-ratio: 3 / 4;
  background: var(--color-surface);
  border-radius: var(--radius-2xl);
  padding: 20px 16px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  text-align: center;
  transition: transform 150ms ease, box-shadow 200ms ease;
}

.role-card:active {
  transform: scale(0.97);
}

.role-card--client { background: linear-gradient(180deg, #FFF4E6 0%, #FFEBD1 100%); }
.role-card--courier { background: linear-gradient(180deg, #E8F7E4 0%, #D4EFCC 100%); }

.role-card__icon-wrap {
  width: 96px;
  height: 96px;
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.role-card__cta {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Wallet hero card (green gradient per reference image) */
.wallet-hero {
  background: linear-gradient(135deg, #5EB84A 0%, #4CAF50 45%, #3E9E42 100%);
  color: #fff;
  border-radius: var(--radius-2xl);
  padding: 22px;
  position: relative;
  overflow: hidden;
}

.wallet-hero::after {
  /* subtle decorative circles */
  content: '';
  position: absolute;
  right: -40px;
  bottom: -60px;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle at center, rgba(255,255,255,0.14) 0%, transparent 70%);
  pointer-events: none;
}

.wallet-hero__balance {
  font-size: 48px;
  font-weight: 800;
  line-height: 1;
  margin: 6px 0 4px;
  letter-spacing: -1px;
}

/* Progress dots (tracking, active order) */
.progress-track {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 4px;
  padding: 0 8px;
}

.progress-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.progress-node__circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-surface-alt);
  color: var(--color-text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid transparent;
  flex-shrink: 0;
}

.progress-node__label {
  font-size: 12px;
  color: var(--color-text-tertiary);
  text-align: center;
}

.progress-node.is-active .progress-node__circle {
  background: var(--color-primary);
  color: #fff;
}
.progress-node.is-active .progress-node__label {
  color: var(--color-primary);
  font-weight: 600;
}
.progress-node.is-done .progress-node__circle {
  background: var(--color-green-light);
  color: var(--color-green-dark);
}
.progress-node.is-done .progress-node__label {
  color: var(--color-green-dark);
}

.progress-connector {
  flex: 0 0 auto;
  height: 0;
  border-top: 2px dashed var(--border-dashed);
  align-self: center;
  margin-top: 20px;
  min-width: 8px;
  flex: 1;
}
.progress-connector.is-done {
  border-top-color: var(--color-primary);
}

/* Search pulse (auction) */
@keyframes pulse-ring {
  0%   { transform: scale(0.6); opacity: 0.7; }
  100% { transform: scale(1.8); opacity: 0; }
}

.pulse {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pulse::before,
.pulse::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--color-primary);
  opacity: 0.25;
  animation: pulse-ring 2s ease-out infinite;
}

.pulse::after {
  animation-delay: 1s;
}

.pulse__core {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  z-index: 1;
  box-shadow: 0 4px 16px rgba(255, 107, 0, 0.4);
}

/* Auction offers */
.offer-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}

/* Dropzone (topup / photos) */
.dropzone {
  border: 1.5px dashed var(--color-primary);
  background: var(--color-primary-soft);
  border-radius: var(--radius-md);
  padding: 20px;
  color: var(--color-primary);
  text-align: center;
  font-weight: 600;
}

.photo-slot {
  aspect-ratio: 1 / 1;
  border: 1.5px dashed var(--border-dashed);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-tertiary);
  background: transparent;
}
.photo-slot--primary {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
  color: var(--color-primary);
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
}

/* Setting row */
.setting-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--color-surface);
}

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

.setting-row__icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.setting-row__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
}

.setting-row__subtitle {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-top: 2px;
}

/* Toggle */
.toggle {
  width: 44px;
  height: 26px;
  border-radius: 13px;
  background: #D1D5DB;
  position: relative;
  transition: background 150ms ease;
  flex-shrink: 0;
}
.toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform 150ms ease;
}
.toggle.is-on {
  background: var(--color-green);
}
.toggle.is-on::after {
  transform: translateX(18px);
}

/* Emoji-illustration placeholder box */
.emoji-hero {
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-2xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 96px;
  line-height: 1;
}
