/* Apple Dnipro Mini App */
:root {
  --bg: #050508;
  --bg2: #0c0c12;
  --card: rgba(22, 22, 32, 0.85);
  --card-border: rgba(255, 255, 255, 0.06);
  --text: #f5f5f7;
  --muted: #8e8e93;
  --accent: #0a84ff;
  --accent2: #5e5ce6;
  --gold: #d4af37;
  --success: #30d158;
  --warn: #ff9f0a;
  --radius: 18px;
  --nav-h: 72px;
  --header-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tg-bg: var(--bg);
  --tg-text: var(--text);
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(10, 132, 255, 0.18), transparent),
    radial-gradient(ellipse 60% 40% at 100% 50%, rgba(94, 92, 230, 0.12), transparent),
    radial-gradient(ellipse 50% 30% at 0% 80%, rgba(212, 175, 55, 0.08), transparent);
  pointer-events: none;
  z-index: 0;
}

#app {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
}

.header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  height: var(--header-h);
  background: rgba(5, 5, 8, 0.75);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--card-border);
}

.header__brand { display: flex; align-items: center; gap: 10px; }
.logo { font-size: 28px; line-height: 1; }
.header__title { font-size: 17px; font-weight: 700; letter-spacing: -0.3px; }
.header__sub { font-size: 11px; color: var(--muted); margin-top: 1px; }

.lang-btn {
  background: var(--card);
  border: 1px solid var(--card-border);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
}

.main {
  flex: 1;
  padding: 16px 16px calc(var(--nav-h) + var(--safe-b) + 16px);
  animation: fadeIn 0.35s ease;
}

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

/* Hero */
.hero {
  background: linear-gradient(135deg, rgba(10, 132, 255, 0.2), rgba(94, 92, 230, 0.15));
  border: 1px solid rgba(10, 132, 255, 0.25);
  border-radius: 24px;
  padding: 24px 20px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: '📱';
  position: absolute;
  right: -10px;
  bottom: -10px;
  font-size: 80px;
  opacity: 0.15;
}

.hero__tag {
  display: inline-block;
  background: rgba(212, 175, 55, 0.2);
  color: var(--gold);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.hero h1 {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.hero p { color: var(--muted); font-size: 14px; line-height: 1.5; }

/* Search */
.search {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.search input {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 14px 16px;
  color: var(--text);
  font-size: 15px;
  outline: none;
}

.search input:focus { border-color: var(--accent); }
.search input::placeholder { color: var(--muted); }

/* Section */
.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 12px;
}

/* Brand grid */
.brand-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.brand-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 18px 14px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
  backdrop-filter: blur(10px);
}

.brand-card:active { transform: scale(0.97); }
.brand-card:hover { border-color: rgba(10, 132, 255, 0.4); }
.brand-card__emoji { font-size: 32px; margin-bottom: 6px; }
.brand-card__name { font-size: 14px; font-weight: 600; }

/* Product grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.product-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s;
}

.product-card:active { transform: scale(0.98); }

.product-card__img {
  aspect-ratio: 1;
  background: linear-gradient(145deg, #1a1a28, #0d0d14);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  position: relative;
  overflow: hidden;
}

.product-card__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-card__status {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 9px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.product-card__status.available { color: var(--success); }
.product-card__status.on_order { color: var(--warn); }

.product-card__body { padding: 12px; }
.product-card__title {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card__price {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
}

/* Product detail */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 16px;
  padding: 0;
}

.detail-gallery {
  border-radius: 20px;
  overflow: hidden;
  margin-bottom: 16px;
  background: var(--card);
  border: 1px solid var(--card-border);
}

.detail-gallery__main {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 72px;
  background: linear-gradient(145deg, #1a1a28, #0d0d14);
}

.detail-gallery__main img { width: 100%; height: 100%; object-fit: cover; }

.detail-gallery__dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 10px;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  opacity: 0.4;
}

.dot.active { background: var(--accent); opacity: 1; }

.detail h2 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.3px;
  margin-bottom: 8px;
}

.detail__price {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 16px;
}

.detail__specs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.spec {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 10px 12px;
}

.spec__label { font-size: 10px; color: var(--muted); text-transform: uppercase; }
.spec__val { font-size: 13px; font-weight: 600; margin-top: 2px; }

.detail__desc {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  margin-bottom: 20px;
}

/* Buttons */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
}

.btn:active { transform: scale(0.98); opacity: 0.9; }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; }
.btn-secondary {
  background: var(--card);
  border: 1px solid var(--card-border);
  color: var(--text);
  margin-top: 10px;
}

.btn-gold {
  background: linear-gradient(135deg, #c9a227, #d4af37);
  color: #000;
}

/* Promo */
.promo-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
}

.promo-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.promo-card p { font-size: 13px; color: var(--muted); line-height: 1.45; }

/* Cart */
.cart-item {
  display: flex;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 10px;
}

.cart-item__emoji { font-size: 36px; }
.cart-item__info { flex: 1; min-width: 0; }
.cart-item__title { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.cart-item__price { color: var(--accent); font-weight: 700; font-size: 14px; }

.cart-item__qty {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.qty-btn {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: var(--bg2);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
}

.cart-total {
  background: linear-gradient(135deg, rgba(10, 132, 255, 0.15), rgba(94, 92, 230, 0.1));
  border: 1px solid rgba(10, 132, 255, 0.2);
  border-radius: var(--radius);
  padding: 16px;
  margin: 16px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cart-total__label { color: var(--muted); font-size: 14px; }
.cart-total__sum { font-size: 22px; font-weight: 800; }

.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}

.empty__icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }

/* Profile */
.profile-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.profile-card h3 { font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.profile-card p, .profile-card a {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
  text-decoration: none;
}

.profile-card a { color: var(--accent); }

/* Nav */
.nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: flex;
  background: rgba(8, 8, 12, 0.92);
  backdrop-filter: blur(24px);
  border-top: 1px solid var(--card-border);
  z-index: 100;
}

.nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  position: relative;
  transition: color 0.2s;
}

.nav__item.active { color: var(--accent); }
.nav__icon { font-size: 22px; }

.nav__badge {
  position: absolute;
  top: 8px;
  right: calc(50% - 22px);
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-b) + 16px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30, 30, 40, 0.95);
  border: 1px solid var(--card-border);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 500;
  z-index: 200;
  backdrop-filter: blur(12px);
  animation: toastIn 0.3s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 16px;
  color: var(--muted);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--card-border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.chip {
  background: var(--card);
  border: 1px solid var(--card-border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.chip.active {
  background: rgba(10, 132, 255, 0.2);
  border-color: var(--accent);
  color: var(--accent);
}
