/* =====================================================
   Telegram Account Market - Shared Theme
   Dark, iOS-style, glassmorphism
   ===================================================== */

:root {
  --bg-base: #0a0a0c;
  --bg-elevated: rgba(28, 28, 32, 0.7);
  --bg-elevated-solid: #1c1c20;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-input: rgba(255, 255, 255, 0.06);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);

  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.6);
  --text-tertiary: rgba(255, 255, 255, 0.38);

  --accent: #ffffff;
  --accent-blue: #0a84ff;
  --accent-green: #30d158;
  --accent-red: #ff453a;
  --accent-amber: #ff9f0a;

  --gradient-primary: linear-gradient(135deg, #3a3a3f 0%, #1a1a1d 100%);
  --gradient-accent: linear-gradient(135deg, #ffffff 0%, #c7c7cc 100%);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-pill: 999px;

  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);

  --nav-height: 64px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 12px);
  min-height: 100vh;
  background: radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.06) 0%, transparent 45%), var(--bg-base);
}

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

/* =====================================================
   Layout helpers
   ===================================================== */
.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px;
}

.page-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--safe-top) + 14px) 16px 14px;
  background: rgba(10, 10, 12, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 0.5px solid var(--border-subtle);
}

.page-header h1 {
  font-size: 17px;
  font-weight: 600;
  margin: 0;
}

.page-header-icons {
  display: flex;
  align-items: center;
  gap: 14px;
}

.page-header-icons .icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 0.5px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: var(--text-primary);
  position: relative;
}

.icon-btn .badge-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent-red);
  border: 1.5px solid var(--bg-base);
}

/* =====================================================
   Cards & glassmorphism
   ===================================================== */
.card {
  background: var(--bg-card);
  border: 0.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.glass-panel {
  background: var(--bg-elevated);
  border: 0.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
}

/* =====================================================
   Buttons
   ===================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  padding: 13px 18px;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.1s ease;
  -webkit-user-select: none;
  user-select: none;
}

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

.btn-primary {
  background: var(--gradient-accent);
  color: #000;
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 0.5px solid var(--border-strong);
}

.btn-success {
  background: rgba(48, 209, 88, 0.16);
  color: var(--accent-green);
  border: 0.5px solid rgba(48, 209, 88, 0.3);
}

.btn-danger {
  background: rgba(255, 69, 58, 0.12);
  color: var(--accent-red);
  border: 0.5px solid rgba(255, 69, 58, 0.25);
}

.btn-block { width: 100%; }

.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
}

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

/* =====================================================
   Forms
   ===================================================== */
label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}

input, select, textarea {
  width: 100%;
  background: var(--bg-input);
  border: 0.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s ease;
}

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

input:focus, select:focus, textarea:focus {
  border-color: var(--border-strong);
}

textarea { resize: vertical; min-height: 80px; }

.form-group { margin-bottom: 14px; }

.form-row {
  display: flex;
  gap: 10px;
}

.form-row > * { flex: 1; }

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ffffff60' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* =====================================================
   Bottom navigation
   ===================================================== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: var(--nav-height);
  padding-bottom: var(--safe-bottom);
  background: rgba(18, 18, 22, 0.75);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-top: 0.5px solid var(--border-subtle);
}

.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--text-tertiary);
  font-size: 11px;
  flex: 1;
  padding: 6px 0;
}

.bottom-nav a i {
  font-size: 21px;
}

.bottom-nav a.active {
  color: var(--text-primary);
}

/* =====================================================
   Badges & pills
   ===================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.badge-neutral { background: rgba(255,255,255,0.08); color: var(--text-secondary); }
.badge-success { background: rgba(48, 209, 88, 0.16); color: var(--accent-green); }
.badge-warning { background: rgba(255, 159, 10, 0.16); color: var(--accent-amber); }
.badge-danger  { background: rgba(255, 69, 58, 0.16); color: var(--accent-red); }
.badge-info    { background: rgba(10, 132, 255, 0.16); color: var(--accent-blue); }

.pill-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 12px 16px;
  scrollbar-width: none;
}
.pill-tabs::-webkit-scrollbar { display: none; }

.pill-tab {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 0.5px solid var(--border-subtle);
  color: var(--text-secondary);
  white-space: nowrap;
  background: transparent;
  cursor: pointer;
}

.pill-tab.active {
  background: var(--text-primary);
  color: #000;
  border-color: var(--text-primary);
}

/* =====================================================
   Listing cards
   ===================================================== */
.listing-card {
  display: flex;
  gap: 12px;
  padding: 12px;
  margin-bottom: 10px;
}

.listing-thumb {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 22px;
  color: var(--text-tertiary);
  overflow: hidden;
}

.listing-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.listing-info { flex: 1; min-width: 0; }

.listing-info-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.listing-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.listing-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 4px 0 0;
}

.listing-price {
  font-size: 16px;
  font-weight: 700;
  margin: 6px 0 0;
}

/* =====================================================
   Section headers
   ===================================================== */
.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

/* =====================================================
   Misc utilities
   ===================================================== */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.font-mono { font-family: "SF Mono", Menlo, Consolas, monospace; }
.font-semibold { font-weight: 600; }
.divider {
  height: 0.5px;
  background: var(--border-subtle);
  margin: 12px 0;
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-tertiary);
}
.empty-state i {
  font-size: 40px;
  margin-bottom: 12px;
  display: block;
}

.loading-state {
  text-align: center;
  padding: 32px 0;
  color: var(--text-tertiary);
  font-size: 13px;
}

/* =====================================================
   Toast
   ===================================================== */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(28, 28, 32, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius-pill);
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  max-width: 90%;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* =====================================================
   Modal / overlay
   ===================================================== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.sheet {
  background: var(--bg-elevated-solid);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  border-top: 0.5px solid var(--border-strong);
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 20px 16px calc(var(--safe-bottom) + 20px);
  transform: translateY(100%);
  transition: transform 0.25s ease;
}

.overlay.show .sheet {
  transform: translateY(0);
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.sheet-header h2 {
  font-size: 17px;
  font-weight: 600;
  margin: 0;
}

.sheet-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--text-secondary);
}

/* =====================================================
   Skeleton loading
   ===================================================== */
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 37%, rgba(255,255,255,0.03) 63%);
  background-size: 400% 100%;
  animation: skeleton-loading 1.4s ease infinite;
  border-radius: var(--radius-md);
}

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