/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --red:        #e8192c;
  --red-hover:  #c91425;
  --blue:       #3b82f6;
  --blue-hover: #2563eb;
  --teal:       #14b8a6;
  --bg:         #0d0d0d;
  --surface:    #181818;
  --surface-2:  #222222;
  --border:     #2c2c2c;
  --text:       #f0f0f0;
  --text-muted: #888888;
  --radius:     10px;
  --font:       system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* Telegram WebApp подхватывает переменные через JS если нужно */
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

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

/* ── Layout ── */
.container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 16px;
}

.hidden { display: none !important; }

.view { flex: 1; padding: 24px 0 40px; }
.view.hidden { display: none; }

/* ── Header ── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 13, 13, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 16px;
}

.logo {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.logo .accent { color: var(--red); }

.nav {
  display: flex;
  gap: 20px;
}
.nav a {
  font-size: 13px;
  color: var(--text-muted);
  transition: color 0.15s;
}
.nav a:hover { color: var(--text); }

/* ── Search ── */
.search-wrap {
  position: relative;
  margin-bottom: 24px;
}

.search-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  padding: 12px 44px 12px 16px;
  outline: none;
  transition: border-color 0.15s;
  -webkit-appearance: none;
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus { border-color: var(--red); }
/* убираем системный крестик в Safari/Chrome */
.search-input::-webkit-search-cancel-button { -webkit-appearance: none; }

.search-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
}

/* ── Tickets Grid ── */
.tickets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

/* ── Ticket Card ── */
.ticket-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--red);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: background 0.15s, transform 0.12s;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ticket-card:hover {
  background: var(--surface-2);
  transform: translateY(-1px);
}

.ticket-artist {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}

.ticket-meta {
  font-size: 13px;
  color: var(--text-muted);
}

.ticket-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

.ticket-price {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.btn-buy {
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 7px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-buy:hover { background: var(--red-hover); }

/* ── Empty / Loading / Error ── */
.state-msg {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.state-msg b {
  display: block;
  font-size: 17px;
  color: var(--text);
  margin-bottom: 6px;
}

/* Skeleton */
.skeleton-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.skeleton-line {
  height: 14px;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--surface-2) 25%, #2a2a2a 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
.skeleton-line.w-70 { width: 70%; }
.skeleton-line.w-50 { width: 50%; }
.skeleton-line.w-40 { width: 40%; height: 18px; }

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

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 32px;
}

.btn-page {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  padding: 8px 18px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-page:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: #444;
}
.btn-page:disabled {
  opacity: 0.35;
  cursor: default;
}

.page-info {
  font-size: 13px;
  color: var(--text-muted);
}

/* ── Detail View ── */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 14px;
  cursor: pointer;
  padding: 0;
  margin-bottom: 20px;
  transition: color 0.15s;
}
.back-btn:hover { color: var(--text); }

.ticket-detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--red);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 540px;
}

.detail-artist {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 16px;
  line-height: 1.25;
}

.detail-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 14px;
}
.detail-label {
  color: var(--text-muted);
  min-width: 80px;
  flex-shrink: 0;
}
.detail-value {
  color: var(--text);
  font-weight: 500;
}

.detail-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

.detail-price {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 20px;
}

.btn-buy-detail {
  display: block;
  width: 100%;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 9px;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 700;
  padding: 14px;
  cursor: pointer;
  transition: background 0.15s;
  text-align: center;
}
.btn-buy-detail:hover { background: var(--red-hover); }

.detail-hint {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 10px;
}

/* ── Footer ── */
.footer {
  border-top: 1px solid var(--border);
  padding: 20px 0 16px;
  margin-top: auto;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.footer-copy {
  font-size: 12px;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: 16px;
}
.footer-links a {
  font-size: 12px;
  color: var(--text-muted);
  transition: color 0.15s;
}
.footer-links a:hover { color: var(--text); }

/* ── Платёжная секция футера ── */
.footer-payment {
  width: 100%;
  padding-top: 14px;
  margin-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.pay-logos {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* Логотипы платёжных систем */
.pay-logo {
  height: 22px;
  width: auto;
  border-radius: 4px;
  display: block;
  flex-shrink: 0;
}

/* Баннер Т-Банка */
.tbank-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #ffdd2d;
  color: #1a1a1a;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 5px;
  text-decoration: none;
  transition: opacity .15s;
}
.tbank-badge:hover { opacity: .85; }
.tbank-badge svg   { flex-shrink: 0; }

.footer-contacts {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
  line-height: 1.6;
}
.footer-contacts a { color: var(--text-muted); }
.footer-contacts a:hover { color: var(--text); }

/* Иконка в detail-view рядом с кнопкой оплаты */
.checkout-security {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.checkout-security .pay-logos { gap: 4px; }

/* ── СБП бейдж ── */
.sbp-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #1d6ff4;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  padding: 3px 8px;
  border-radius: 5px;
  flex-shrink: 0;
}

.sbp-badge-lg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #1d6ff4;
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: .05em;
  padding: 8px 20px;
  border-radius: 10px;
}

/* ── СБП экран оплаты ── */
.sbp-screen {
  text-align: center;
  padding: 24px 0;
}
.sbp-logo-wrap {
  margin-bottom: 16px;
}
.sbp-amount {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 10px;
  color: var(--text);
}
.sbp-hint {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 20px;
  line-height: 1.5;
}
.btn-sbp-pay {
  display: block;
  width: 100%;
  padding: 14px;
  background: #1d6ff4;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  border-radius: 12px;
  text-decoration: none;
  text-align: center;
  margin-bottom: 16px;
  transition: opacity .15s;
  box-sizing: border-box;
}
.btn-sbp-pay:hover { opacity: .88; }
.sbp-status {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.sbp-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--text-muted);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .8s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Static pages ── */
.static-page {
  max-width: 680px;
  margin: 0 auto;
  padding: 32px 0;
}
.static-page h1 {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 24px;
}
.static-page h2 {
  font-size: 17px;
  font-weight: 700;
  margin: 24px 0 10px;
  color: var(--text);
}
.static-page p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.65;
}
.static-page .stub-badge {
  display: inline-block;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 11px;
  color: var(--text-muted);
  padding: 3px 8px;
  margin-bottom: 20px;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .tickets-grid {
    grid-template-columns: 1fr;
  }
  .header-inner { height: 52px; }
  .logo { font-size: 16px; }
  .detail-artist { font-size: 20px; }
}

/* Если открыто как Telegram WebApp — скрываем шапку (Telegram рисует свою) */
body.tg-webapp .header { display: none; }
body.tg-webapp .view   { padding-top: 16px; }

/* ── Tabs ── */
.tabs-wrap {
  position: sticky;
  top: 56px;
  z-index: 90;
  background: rgba(13,13,13,0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
body.tg-webapp .tabs-wrap { top: 0; }

.tabs {
  display: flex;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 16px;
}

.tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex: 1;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  padding: 13px 16px 10px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.tab svg { flex-shrink: 0; }
.tab:hover { color: var(--text); }
.tab.active[data-tab="selling"] {
  color: var(--red);
  border-bottom-color: var(--red);
}
.tab.active[data-tab="selling"] svg { stroke: var(--red); }
.tab.active[data-tab="looking"] {
  color: var(--blue);
  border-bottom-color: var(--blue);
}
.tab.active[data-tab="looking"] svg { stroke: var(--blue); }

/* ── Ищу: кнопка разместить объявление ── */
.btn-post-want-ad {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  padding: 13px 18px;
  cursor: pointer;
  transition: background 0.15s;
  margin-bottom: 20px;
}
.btn-post-want-ad:hover { background: var(--red-hover); }

/* ── Подсказка "Разместить объявление" в пустом поиске ── */
.suggest-post-block {
  margin-top: 20px;
  padding: 16px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}
.suggest-post-text {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
}
.btn-suggest-post {
  background: none;
  border: 1px solid var(--red);
  border-radius: 8px;
  color: var(--red);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.btn-suggest-post:hover { background: var(--red); color: #fff; }

/* ── Section titles ── */
.section-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
  margin-top: 28px;
}
.section-title-buyers { color: var(--blue); }
.section-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* ── No match block ── */
.no-match-block {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 20px;
  padding: 16px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.no-match-text {
  font-size: 14px;
  color: var(--text-muted);
  flex: 1;
  min-width: 120px;
}
.btn-no-match {
  background: none;
  border: 1px solid var(--blue);
  border-radius: 8px;
  color: var(--blue);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.btn-no-match:hover { background: var(--blue); color: #fff; }

/* ── Want-ad card (buyer) ── */
.want-ad-card {
  border-left-color: var(--blue) !important;
  cursor: default;
}
.want-ad-card:hover { transform: none !important; }
.want-ad-badge {
  display: inline-block;
  background: rgba(59,130,246,0.12);
  color: var(--blue);
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.want-ad-comment {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
}
.want-price { color: var(--teal) !important; }
.want-ad-contact {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(59,130,246,0.1);
  color: var(--blue);
  border: 1px solid rgba(59,130,246,0.25);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  padding: 5px 12px;
  text-decoration: none;
  transition: background 0.15s;
}
.want-ad-contact:hover { background: rgba(59,130,246,0.2); }

.buyer-skeleton { border-left-color: var(--blue) !important; }

/* ── Want-ad posting form ── */
.want-ad-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 20px;
  margin-bottom: 24px;
}
.want-ad-header {
  margin-bottom: 20px;
}
.want-ad-title {
  font-size: 18px;
  font-weight: 800;
  margin: 8px 0 4px;
}
.want-ad-desc {
  font-size: 13px;
  color: var(--text-muted);
}
.form-group {
  margin-bottom: 14px;
}
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.form-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  padding: 11px 14px;
  outline: none;
  transition: border-color 0.15s;
  -webkit-appearance: none;
}
.form-input::placeholder { color: var(--text-muted); }
.form-input:focus { border-color: var(--blue); }
.form-textarea {
  resize: vertical;
  min-height: 80px;
}
.btn-submit-want-ad {
  width: 100%;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  padding: 13px;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 4px;
}
.btn-submit-want-ad:hover:not(:disabled) { background: var(--blue-hover); }
.btn-submit-want-ad:disabled { opacity: 0.5; cursor: default; }

/* ── Заглушка "не в Telegram" ── */
.want-ad-no-tg {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
}

/* ── TG-бейдж пользователя в форме ── */
.tg-user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: rgba(59,130,246,0.08);
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 18px;
  font-size: 13px;
  color: var(--blue);
}
.tg-user-badge svg { flex-shrink: 0; }
.tg-user-name { font-weight: 600; color: var(--text); }
.tg-user-tag  { font-weight: 700; }
.tg-user-tag--warn { color: var(--red); font-weight: 600; }
.tg-user-hint {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-muted);
}

.want-ad-status {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
}
.want-ad-status.success { background: rgba(20,184,166,0.12); color: var(--teal); }
.want-ad-status.error   { background: rgba(232,25,44,0.12);  color: var(--red);  }

/* ── Responsive for Ищу ── */
@media (max-width: 480px) {
  .tab { padding: 11px 10px 8px; font-size: 13px; }
}
