/* ============================================================
   GOD.SOFTWARE — Telegram Mini App
   Clean, fast, beautiful.
   ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --tg-bg: var(--tg-theme-bg-color, #0a0a14);
  --tg-text: var(--tg-theme-text-color, #e4e4f0);
  --tg-hint: var(--tg-theme-hint-color, #888898);
  --tg-link: var(--tg-theme-link-color, #2997ff);
  --tg-btn: var(--tg-theme-button-color, #2997ff);
  --tg-btn-text: var(--tg-theme-button-text-color, #ffffff);
  --tg-secondary: var(--tg-theme-secondary-bg-color, #111122);

  --blue: #2997ff;
  --purple: #bf5af2;
  --green: #30d158;
  --surface: rgba(255,255,255,0.04);
  --surface2: rgba(255,255,255,0.07);
  --border: rgba(255,255,255,0.06);
  --border2: rgba(255,255,255,0.1);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --gradient: linear-gradient(135deg, #2997ff, #bf5af2);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--tg-bg);
  color: var(--tg-text);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  min-height: 100vh;
}

.app {
  max-width: 100%;
  padding-bottom: 80px; /* space for tabs */
}

/* ===== HEADER ===== */
.header {
  padding: 16px 20px 12px;
  text-align: center;
}
.header-brand {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 18px; font-weight: 600; color: var(--tg-text);
  letter-spacing: -0.02em;
}
.header-brand b { color: var(--blue); }
.logo-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--gradient);
  box-shadow: 0 0 12px rgba(41,151,255,0.5);
}
.header-sub {
  font-size: 12px; color: var(--tg-hint); margin-top: 2px;
  letter-spacing: 0.04em; text-transform: uppercase;
}

/* ===== TABS ===== */
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  display: flex; justify-content: space-around;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: rgba(10,10,20,0.92);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 12px; border: none; background: none;
  color: var(--tg-hint); font-size: 10px; font-weight: 500;
  cursor: pointer; transition: color .2s;
  letter-spacing: 0.02em;
}
.tab svg { width: 22px; height: 22px; transition: color .2s; }
.tab.active { color: var(--blue); }
.tab.active svg { stroke: var(--blue); }

/* ===== SCREENS ===== */
.screen {
  display: none; padding: 0 16px 20px;
  animation: fade-in .25s ease;
}
.screen.active { display: block; }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ===== SECTION LABEL ===== */
.section-label {
  font-size: 13px; font-weight: 700; color: var(--tg-hint);
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 20px 0 10px;
}

/* ===== HOME: HERO CARD ===== */
.hero-card {
  position: relative; overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px 24px;
}
.hero-glow {
  position: absolute; top: -40px; right: -40px;
  width: 140px; height: 140px; border-radius: 50%;
  background: radial-gradient(circle, rgba(41,151,255,0.15), transparent 70%);
  pointer-events: none;
}
.hero-card h1 {
  font-size: 26px; font-weight: 800; line-height: 1.15;
  letter-spacing: -0.03em; color: #fff;
}
.grad {
  background: var(--gradient);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-card p {
  font-size: 14px; color: var(--tg-hint); line-height: 1.5;
  margin: 10px 0 18px;
}
.hero-stats {
  display: flex; gap: 0; margin-bottom: 20px;
  border-radius: var(--radius-sm); overflow: hidden;
  border: 1px solid var(--border);
}
.stat {
  flex: 1; padding: 12px 8px; text-align: center;
  background: var(--surface);
}
.stat + .stat { border-left: 1px solid var(--border); }
.stat strong { display: block; font-size: 14px; color: var(--blue); font-weight: 700; }
.stat span { font-size: 11px; color: var(--tg-hint); }

/* ===== MAIN BUTTON ===== */
.btn-main {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 24px; border-radius: var(--radius);
  background: var(--gradient); color: #fff; border: none;
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: all .25s; width: auto;
  box-shadow: 0 4px 20px rgba(41,151,255,0.3);
  letter-spacing: -0.01em;
}
.btn-main svg { width: 18px; height: 18px; }
.btn-main:active { transform: scale(0.97); }
.btn-full { width: 100%; }

/* ===== QUICK GRID ===== */
.quick-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.quick-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 18px 8px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  cursor: pointer; transition: all .2s;
  color: var(--tg-text);
}
.quick-card:active { transform: scale(0.96); background: var(--surface2); }
.qc-icon { font-size: 26px; }
.quick-card span { font-size: 12px; font-weight: 600; }

/* ===== FEATURES ===== */
.features { display: flex; flex-direction: column; gap: 12px; padding-bottom: 10px; }
.feature {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
}
.f-icon { font-size: 22px; flex-shrink: 0; margin-top: 2px; }
.feature strong { font-size: 14px; color: #fff; display: block; margin-bottom: 3px; }
.feature p { font-size: 13px; color: var(--tg-hint); line-height: 1.45; }

/* ===== PRODUCTS ===== */
.cat-tabs {
  display: flex; gap: 6px; padding: 0 0 14px;
  overflow-x: auto; scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tab {
  padding: 8px 16px; border-radius: 20px; font-size: 13px; font-weight: 600;
  background: var(--surface); color: var(--tg-hint);
  border: 1px solid var(--border); cursor: pointer;
  white-space: nowrap; transition: all .2s;
  flex-shrink: 0;
}
.cat-tab.active {
  background: var(--gradient); color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 12px rgba(41,151,255,0.25);
}
.cat-tab:active { transform: scale(0.96); }

.products-list { display: flex; flex-direction: column; gap: 10px; }
.product-item {
  display: flex; align-items: center; gap: 14px;
  padding: 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  cursor: pointer; transition: all .2s;
  animation: fade-in .3s ease both;
}
.product-item:active { transform: scale(0.98); background: var(--surface2); }
.pi-left { flex: 1; min-width: 0; }
.pi-name {
  font-size: 14px; font-weight: 600; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pi-desc {
  font-size: 12px; color: var(--tg-hint); margin-top: 3px;
  line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.pi-right { text-align: right; flex-shrink: 0; }
.pi-price { font-size: 16px; font-weight: 700; color: var(--blue); }
.pi-buy {
  display: inline-block; margin-top: 6px;
  padding: 6px 14px; border-radius: 8px;
  background: var(--gradient); color: #fff; border: none;
  font-size: 11px; font-weight: 600; cursor: pointer;
  box-shadow: 0 2px 8px rgba(41,151,255,0.2);
}
.pi-buy:active { transform: scale(0.95); }

/* ===== CHAT ===== */
#screen-chat {
  display: none; flex-direction: column; padding: 0 0 20px;
  height: calc(100vh - 120px);
}
#screen-chat.active { display: flex; }

.chat-messages {
  flex: 1; overflow-y: auto; padding: 0 16px;
  display: flex; flex-direction: column; gap: 12px;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.08) transparent;
}
.chat-msg {
  display: flex; gap: 10px;
  animation: fade-in .3s ease both;
}
.chat-avatar {
  width: 30px; height: 30px; min-width: 30px; border-radius: 10px;
  background: var(--gradient);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 12px; color: #fff;
  box-shadow: 0 2px 8px rgba(41,151,255,0.2);
}
.chat-bubble {
  padding: 12px 16px; border-radius: 4px 16px 16px 16px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 14px; color: var(--tg-text); line-height: 1.55;
  max-width: 85%;
}
.chat-user { flex-direction: row-reverse; }
.chat-user .chat-bubble {
  background: var(--gradient); border: none; color: #fff;
  border-radius: 16px 4px 16px 16px;
  box-shadow: 0 3px 14px rgba(41,151,255,0.25);
}

.chat-suggestions {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0;
}
.chat-suggestions button {
  padding: 8px 14px; border-radius: 18px; font-size: 12px; font-weight: 500;
  background: var(--surface); color: var(--tg-hint);
  border: 1px solid var(--border); cursor: pointer; transition: all .2s;
}
.chat-suggestions button:active {
  background: var(--surface2); border-color: var(--blue); color: var(--blue);
}

/* Chat recommend card */
.chat-rec {
  display: flex; align-items: center; gap: 12px;
  margin-top: 8px; padding: 12px 14px; border-radius: 12px;
  background: rgba(41,151,255,0.06); border: 1px solid rgba(41,151,255,0.12);
}
.chat-rec-info { flex: 1; min-width: 0; }
.chat-rec-name { font-size: 13px; font-weight: 600; color: #fff; }
.chat-rec-price { font-size: 12px; color: var(--blue); margin-top: 1px; }
.chat-rec-buy {
  padding: 7px 14px; border-radius: 8px; font-size: 11px; font-weight: 600;
  background: var(--gradient); color: #fff; border: none; cursor: pointer;
  box-shadow: 0 2px 8px rgba(41,151,255,0.2);
}

.chat-typing {
  display: flex; gap: 5px; padding: 12px 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 4px 16px 16px 16px; width: fit-content;
}
.chat-typing span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--blue);
  animation: typing .9s ease-in-out infinite;
}
.chat-typing span:nth-child(2) { animation-delay: .15s; }
.chat-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes typing {
  0%,100% { opacity: .2; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1) translateY(-4px); }
}

.chat-input-area {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; margin-top: auto;
  background: rgba(255,255,255,0.02);
  border-top: 1px solid var(--border);
}
.chat-input-area input {
  flex: 1; padding: 12px 0; background: none; border: none;
  font-size: 14px; color: var(--tg-text);
  font-family: 'Inter', sans-serif;
}
.chat-input-area input::placeholder { color: var(--tg-hint); }
.chat-input-area input:focus { outline: none; }
.chat-send {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--gradient); border: none; color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  box-shadow: 0 3px 12px rgba(41,151,255,0.3);
  transition: transform .2s;
}
.chat-send svg { width: 16px; height: 16px; }
.chat-send:active { transform: scale(0.92); }

/* ===== CONTACT ===== */
.contact-card {
  text-align: center; padding: 24px 20px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); margin-bottom: 16px;
}
.cc-icon { font-size: 36px; margin-bottom: 12px; }
.contact-card h2 { font-size: 22px; font-weight: 700; color: #fff; margin-bottom: 6px; }
.contact-card p { font-size: 13px; color: var(--tg-hint); line-height: 1.5; }

.tg-form { display: flex; flex-direction: column; gap: 10px; }
.tg-form input, .tg-form select, .tg-form textarea {
  padding: 14px 16px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--tg-text); font-size: 14px;
  font-family: 'Inter', sans-serif;
  transition: border-color .2s;
  -webkit-appearance: none;
}
.tg-form input:focus, .tg-form select:focus, .tg-form textarea:focus {
  outline: none; border-color: var(--blue);
}
.tg-form input::placeholder, .tg-form textarea::placeholder { color: var(--tg-hint); }
.tg-form select { color: var(--tg-hint); }
.tg-form select option { background: #111; color: var(--tg-text); }
.tg-form textarea { resize: none; min-height: 80px; }

.contact-success {
  display: none; text-align: center; padding: 40px 20px;
  animation: fade-in .3s ease;
}
.contact-success.show { display: block; }
.cs-icon { font-size: 40px; color: var(--green); margin-bottom: 12px; }
.contact-success strong { font-size: 18px; color: #fff; display: block; margin-bottom: 6px; }
.contact-success p { font-size: 14px; color: var(--tg-hint); }

/* ===== CHECKOUT SHEET ===== */
.sheet-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.5);
  opacity: 0; pointer-events: none;
  transition: opacity .3s;
}
.sheet-overlay.open { opacity: 1; pointer-events: all; }

.sheet {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 201;
  background: var(--tg-secondary);
  border-radius: 20px 20px 0 0;
  padding: 12px 20px calc(20px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform .35s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 -10px 40px rgba(0,0,0,0.4);
}
.sheet.open { transform: translateY(0); }
.sheet-handle {
  width: 36px; height: 4px; border-radius: 2px;
  background: rgba(255,255,255,0.15);
  margin: 0 auto 16px;
}
.sheet-content h3 {
  font-size: 20px; font-weight: 700; color: #fff;
  margin-bottom: 12px; text-align: center;
}
.sheet-product {
  text-align: center; padding: 14px; margin-bottom: 14px;
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border);
}
.sp-name { font-size: 15px; font-weight: 600; color: #fff; }
.sp-price { font-size: 22px; font-weight: 800; color: var(--blue); margin-top: 4px; }
.sp-delivery { font-size: 12px; color: var(--green); margin-top: 4px; }

.sheet-content form { display: flex; flex-direction: column; gap: 10px; }
.sheet-content input {
  padding: 14px 16px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--tg-text); font-size: 14px;
  font-family: 'Inter', sans-serif;
}
.sheet-content input:focus { outline: none; border-color: var(--blue); }
.sheet-content input::placeholder { color: var(--tg-hint); }
.sheet-secure {
  text-align: center; font-size: 12px; color: var(--tg-hint);
  margin-top: 12px;
}
