:root {
  --bg: #0b0f14;
  --bg-elevated: #121822;
  --card: #161d29;
  --card-border: #232c3d;
  --text: #eef2f7;
  --text-dim: #8b96a8;
  --accent: #25D366;
  --accent-dim: #1a9e4c;
  --accent-glow: rgba(37, 211, 102, .25);
  --danger: #ff5c5c;
  --warn: #ffb84d;
  --radius: 18px;
  --radius-sm: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

.bg-glow {
  position: fixed;
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  width: 140%;
  height: 40vh;
  background: radial-gradient(ellipse at center, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  filter: blur(20px);
}

button { font-family: inherit; }

/* ===== Topbar ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: rgba(11, 15, 20, .85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--card-border);
}

.brand { display: flex; align-items: center; gap: 8px; }
.brand-badge { font-size: 18px; }
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: .2px; }
.brand-name b { color: var(--accent); }

.icon-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
  transition: background .15s ease;
}
.icon-btn:active { background: var(--bg-elevated); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.hidden { visibility: hidden; }

.topbar-right { display: flex; align-items: flex-start; gap: 8px; }
.orders-block { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.balance-text {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

/* ===== Layout ===== */
main#views {
  position: relative;
  z-index: 1;
  padding: 16px 16px 40px;
  max-width: 480px;
  margin: 0 auto;
}

.view { display: none; animation: fadeIn .25s ease; }
.view.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Hero / product card ===== */
.hero-card {
  background: linear-gradient(180deg, var(--card) 0%, var(--bg-elevated) 100%);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 28px 22px 24px;
  text-align: center;
  margin-top: 8px;
}

.hero-logo {
  width: 64px; height: 64px;
  margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
  filter: drop-shadow(0 8px 20px var(--accent-glow));
}

.hero-icon-emoji { font-size: 32px; }

.hero-title { font-size: 22px; font-weight: 800; letter-spacing: 1.5px; margin: 0 0 4px; }
.hero-sub { font-size: 13.5px; color: var(--text-dim); margin: 0 0 16px; line-height: 1.5; }

.selector-row-wrap { display: flex; gap: 8px; justify-content: center; margin-bottom: 16px; flex-wrap: wrap; }
.selector-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.selector-chip:active { background: var(--card-border); }
.selector-chip-empty { color: var(--text-dim); border-style: dashed; }
.selector-chip-icon { width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; }
.selector-chip-icon svg { width: 100%; height: 100%; }
.selector-chevron { color: var(--text-dim); font-size: 11px; }

.selection-prompt {
  font-size: 13px;
  color: var(--text-dim);
  padding: 18px 10px;
  text-align: center;
}

.info-note {
  font-size: 12px;
  color: var(--text-dim);
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-bottom: 18px;
  line-height: 1.5;
}
.info-note b { color: var(--text); }

.price-skeleton {
  height: 64px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--card-border) 37%, var(--bg-elevated) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  margin-bottom: 16px;
}

@keyframes shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

.price-box { margin-bottom: 18px; }
.price-main { font-size: 34px; font-weight: 800; letter-spacing: -.5px; }
.price-unit { font-size: 15px; font-weight: 600; color: var(--accent); }
.price-sub { font-size: 14px; color: var(--text-dim); margin-top: 2px; }

.discount-badge {
  display: inline-block;
  margin-bottom: 10px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 20px;
  background: rgba(255,184,77,.14);
  color: var(--warn);
}

.price-list-try {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  text-decoration: line-through;
  margin-bottom: 2px;
}

.stock-badge {
  display: inline-block;
  margin-top: 10px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 20px;
  background: rgba(37,211,102,.12);
  color: var(--accent);
}

.error-box {
  padding: 14px;
  border-radius: var(--radius-sm);
  background: rgba(255,92,92,.1);
  color: var(--danger);
  font-size: 13.5px;
  margin-bottom: 16px;
}

.link-btn {
  background: none; border: none; color: var(--accent);
  font-weight: 700; text-decoration: underline; cursor: pointer; font-size: 13.5px;
}

.hidden { display: none !important; }

/* ===== Buttons ===== */
.primary-btn {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #2ee372, var(--accent));
  color: #08210f;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 24px var(--accent-glow);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .1s ease, opacity .15s ease;
}
.primary-btn:active { transform: scale(.98); }
.primary-btn:disabled { opacity: .5; pointer-events: none; }

.ghost-btn {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 14px;
}

.btn-spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(8,33,15,.3);
  border-top-color: #08210f;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Steps mini card ===== */
.steps-card {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 14px;
  padding: 14px 10px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
}
.step { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 11px; color: var(--text-dim); flex: 1; }
.step-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--bg-elevated);
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  border: 1px solid var(--card-border);
}
.step-arrow { color: var(--card-border); font-size: 14px; }

/* ===== Stepper (payment/number views) ===== */
.stepper { display: flex; align-items: center; justify-content: center; margin: 6px 0 18px; }
.stepper-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--card-border);
}
.stepper-dot.active { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-glow); }
.stepper-dot.done { background: var(--accent-dim); }
.stepper-line { width: 44px; height: 2px; background: var(--card-border); }
.stepper-line.done { background: var(--accent-dim); }

/* ===== Payment card ===== */
.pay-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 22px;
}

.pay-status {
  display: flex; align-items: center; gap: 8px;
  justify-content: center;
  font-size: 14px; font-weight: 700;
  margin-bottom: 18px;
}

.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 0 0 rgba(255,184,77,.6);
  animation: pulse 1.6s ease infinite;
}
.pay-status.paid .pulse-dot { background: var(--accent); box-shadow: 0 0 0 0 var(--accent-glow); }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255,184,77,.5); }
  70% { box-shadow: 0 0 0 8px rgba(255,184,77,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,184,77,0); }
}

.countdown-wrap {
  position: relative;
  width: 80px; height: 80px;
  margin: 0 auto 18px;
}
.countdown-ring { width: 80px; height: 80px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--card-border); stroke-width: 5; }
.ring-fg {
  fill: none; stroke: var(--accent); stroke-width: 5; stroke-linecap: round;
  stroke-dasharray: 226;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear;
}
.countdown-text {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
}

.amount-row, .address-row { margin-bottom: 14px; }
.amount-label { font-size: 12px; color: var(--text-dim); font-weight: 600; }
.amount-value-row { display: flex; align-items: baseline; gap: 8px; margin-top: 4px; }
.amount-value { font-size: 26px; font-weight: 800; letter-spacing: -.3px; }
.amount-unit { font-size: 13px; color: var(--accent); font-weight: 700; }
.amount-try-sub { font-size: 12.5px; color: var(--text-dim); }

.copy-chip {
  margin-left: auto;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 20px;
  border: 1px solid var(--card-border);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
}
.copy-chip:active { background: var(--accent); color: #08210f; border-color: var(--accent); }

.warn-box {
  font-size: 12px;
  color: var(--warn);
  background: rgba(255,184,77,.1);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 14px;
  line-height: 1.5;
}

.address-box {
  display: flex; align-items: center; gap: 8px;
  margin-top: 4px;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
}
.address-text {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  word-break: break-all;
  color: var(--text);
}

.qr-wrap { display: flex; justify-content: center; margin: 16px 0 4px; }
.qr-img {
  width: 150px; height: 150px;
  border-radius: 12px;
  background: #fff;
  padding: 8px;
}

/* ===== Result card (number / code) ===== */
.result-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 24px 22px;
  text-align: center;
}
.result-label { font-size: 13px; color: var(--text-dim); font-weight: 700; margin: 0 0 8px; }
.result-value-row { display: flex; align-items: center; justify-content: center; gap: 10px; }
.result-value {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 24px; font-weight: 800; letter-spacing: .5px;
}
.code-value { color: var(--accent); font-size: 30px; letter-spacing: 4px; }
.hint-text { font-size: 12.5px; color: var(--text-dim); margin-top: 10px; line-height: 1.5; }
.divider { height: 1px; background: var(--card-border); margin: 20px 0; }

.code-waiting {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 14px; color: var(--text-dim); font-weight: 600;
}

.success-badge {
  display: inline-block;
  margin-top: 14px;
  padding: 6px 14px;
  border-radius: 20px;
  background: rgba(37,211,102,.14);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 700;
}

.fail-card .fail-icon { font-size: 38px; margin: 0 0 8px; }
.fail-card { margin-top: 8px; }

#new-order-btn { margin-top: 18px; }
#failure-home-btn { margin-top: 18px; }

/* ===== Orders list ===== */
.orders-list { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.order-item {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer;
}
.order-item-left { display: flex; flex-direction: column; gap: 3px; }
.order-item-id { font-size: 12px; color: var(--text-dim); }
.order-item-amount { font-size: 15px; font-weight: 700; }
.order-badge {
  font-size: 11px; font-weight: 700;
  padding: 4px 10px; border-radius: 20px;
}
.badge-pending { background: rgba(255,184,77,.14); color: var(--warn); }
.badge-success { background: rgba(37,211,102,.14); color: var(--accent); }
.badge-fail { background: rgba(255,92,92,.14); color: var(--danger); }

.skeleton-list { display: flex; flex-direction: column; gap: 10px; }
.skeleton-card {
  height: 62px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--card-border) 37%, var(--bg-elevated) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}

.empty-state { text-align: center; padding: 60px 20px; }
.empty-title { font-weight: 700; font-size: 15px; margin: 0 0 6px; }
.empty-sub { font-size: 13px; color: var(--text-dim); margin: 0; }

/* ===== Toast ===== */
.toast {
  position: fixed;
  left: 50%; bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  padding: 10px 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  max-width: min(85vw, 360px);
  white-space: normal;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 100;
  box-shadow: 0 8px 20px rgba(0,0,0,.4);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== Bottom sheet (servis / ulke / bakiye onayi) ===== */
.sheet-overlay {
  position: fixed; inset: 0;
  z-index: 200;
  visibility: hidden;
  pointer-events: none;
}
.sheet-overlay.open { visibility: visible; pointer-events: auto; }

.sheet-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.55);
  opacity: 0;
  transition: opacity .2s ease;
}
.sheet-overlay.open .sheet-backdrop { opacity: 1; }

.sheet-panel {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  max-width: 480px;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-bottom: none;
  border-radius: 20px 20px 0 0;
  padding: 10px 18px 24px;
  transform: translateY(100%);
  transition: transform .25s ease;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
.sheet-overlay.open .sheet-panel { transform: translateY(0); }
.sheet-panel-tall { height: 70vh; }

.sheet-handle {
  width: 36px; height: 4px;
  background: var(--card-border);
  border-radius: 4px;
  margin: 4px auto 12px;
}

.sheet-title { font-size: 15px; font-weight: 800; margin: 0 0 12px; text-align: center; }

.sheet-search {
  width: 100%;
  padding: 10px 14px;
  margin-bottom: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
}
.sheet-search::placeholder { color: var(--text-dim); }

.sheet-list { display: flex; flex-direction: column; gap: 6px; overflow-y: hidden; }
.sheet-list-scroll { overflow-y: auto; flex: 1; }

.sheet-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}
.sheet-item:active { background: var(--bg-elevated); }
.sheet-item.selected { background: rgba(37,211,102,.12); color: var(--accent); }
.sheet-item-icon {
  font-size: 18px;
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sheet-item-icon svg { width: 100%; height: 100%; }
.sheet-item-name { flex: 1; }
.sheet-item-count { font-size: 11px; color: var(--text-dim); font-weight: 600; }

.confirm-text { text-align: center; font-size: 14px; color: var(--text); margin: 0 0 18px; line-height: 1.6; }
.confirm-text b { color: var(--accent); }

/* ===== Toplu Alim ===== */
.balance-summary {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 16px;
}
.balance-summary b { color: var(--accent); font-size: 15px; }

.topup-input-row { margin-bottom: 6px; }
.topup-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  text-align: center;
}
.topup-input::placeholder { color: var(--text-dim); font-size: 14px; font-weight: 600; }
#topup-min-hint { text-align: center; margin-bottom: 16px; }
#topup-create-btn { margin-top: 4px; }
#topup-cancel-btn { margin-top: 14px; }

/* ===== Canli destek sohbeti (Instagram DM tarzi) ===== */
.view-chat.active {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 128px);
  margin: -4px -16px -40px;
  padding: 0 16px 16px;
}

.chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 2px 12px;
  border-bottom: 1px solid var(--card-border);
  margin-bottom: 10px;
}
.chat-peer-label { font-size: 14px; font-weight: 800; }
.chat-end-btn {
  padding: 6px 12px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--danger);
  background: rgba(255,92,92,.1);
  border: 1px solid rgba(255,92,92,.25);
  border-radius: 20px;
  cursor: pointer;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 2px 12px;
}

.chat-bubble-row { display: flex; }
.chat-bubble-row.own { justify-content: flex-end; }
.chat-bubble-row.peer { justify-content: flex-start; }

.chat-bubble {
  max-width: 78%;
  padding: 9px 13px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.4;
  word-break: break-word;
  white-space: pre-wrap;
}
.chat-bubble-row.own .chat-bubble {
  background: linear-gradient(180deg, #2ee372, var(--accent));
  color: #08210f;
  border-bottom-right-radius: 4px;
  font-weight: 600;
}
.chat-bubble-row.peer .chat-bubble {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-bottom-left-radius: 4px;
}
.chat-bubble img {
  max-width: 100%;
  border-radius: 10px;
  display: block;
  margin-top: 4px;
}
.chat-bubble-time {
  display: block;
  font-size: 10px;
  opacity: .6;
  margin-top: 3px;
}

.chat-ended-banner {
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: 10px;
  margin-bottom: 8px;
}

.chat-input-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 4px;
}
.chat-icon-btn {
  width: 38px; height: 38px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  color: var(--text);
}
.chat-send-btn { background: var(--accent); color: #08210f; border-color: var(--accent); }
.chat-text-input {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  color: var(--text);
  font-size: 14px;
}
.chat-photo-input-hidden { display: none; }

.chat-photo-preview-wrap {
  position: relative;
  display: inline-block;
  margin: 0 0 8px;
}
.chat-photo-preview { max-height: 70px; border-radius: 8px; display: block; }
.chat-photo-cancel-btn {
  position: absolute; top: -6px; right: -6px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  border: none;
  font-size: 11px;
  cursor: pointer;
}

/* ===== Staff paneli ===== */
.staff-session-item { position: relative; }
.staff-session-unread {
  position: absolute; top: 10px; right: 14px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

/* ===== Arkadasini davet et (referans) ===== */
.invite-promo-card {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  margin-top: 14px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(37,211,102,.14), var(--card));
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
}
.invite-promo-icon { font-size: 26px; flex-shrink: 0; }
.invite-promo-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.invite-promo-text b { font-size: 13.5px; color: var(--text); }
.invite-promo-text span:last-child { font-size: 12px; color: var(--text-dim); }

.ref-progress-wrap { margin-bottom: 18px; }
.ref-progress-bar {
  height: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  overflow: hidden;
}
.ref-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2ee372, var(--accent));
  transition: width .4s ease;
}
.ref-progress-text { text-align: center; font-size: 12.5px; color: var(--text-dim); margin-top: 8px; }

#ref-share-btn { margin-bottom: 14px; }
