/* ===== Ranglar va umumiy sozlamalar ===== */
:root {
  --asosiy: #FF6B6B;
  --ikkinchi: #4ECDC4;
  --urgu: #FFE66D;
  --fon: #FFFDF7;
  --matn: #2d3142;
  --kulrang: #6b7080;
  --radius: 16px;
  --soya: 0 6px 20px rgba(0, 0, 0, 0.08);
}

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

body {
  font-family: "Nunito", sans-serif;
  background: var(--fon);
  color: var(--matn);
  line-height: 1.6;
}

h1, h2, h3, .logo { font-family: "Baloo 2", cursive; line-height: 1.2; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.section { padding: 48px 0; }
.section h2 { font-size: 2rem; text-align: center; margin-bottom: 24px; }

/* ===== Tugmalar ===== */
.btn {
  display: inline-block;
  background: var(--asosiy);
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-weight: 700;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  transition: transform .15s;
  font-family: inherit;
}
.btn:hover { transform: translateY(-2px); }
.btn-ikkinchi { background: var(--ikkinchi); }

/* ===== Header ===== */
.header { background: #fff; box-shadow: var(--soya); position: sticky; top: 0; z-index: 10; }
.header .container { display: flex; align-items: center; justify-content: space-between; min-height: 64px; flex-wrap: wrap; gap: 8px; }
.logo { font-size: 1.5rem; color: var(--asosiy); font-weight: 800; }
.header-o-ng { display: flex; align-items: center; gap: 8px; }
.til-tugma {
  background: var(--fon); border: 2px solid var(--ikkinchi); border-radius: 10px;
  padding: 6px 10px; font-weight: 800; font-size: .85rem; cursor: pointer; color: var(--matn);
}
.menu-tugma { background: none; border: none; font-size: 1.8rem; cursor: pointer; }
.nav { display: none; width: 100%; flex-direction: column; padding-bottom: 12px; }
.nav.ochiq { display: flex; }
.nav a { padding: 10px 0; font-weight: 700; }
.nav a.faol { color: var(--asosiy); }

/* ===== Banner ===== */
.banner {
  background: linear-gradient(135deg, var(--urgu), var(--ikkinchi));
  padding: 56px 0;
  text-align: center;
}
.banner h1 { font-size: 2.2rem; margin-bottom: 12px; }
.banner p { font-size: 1.1rem; margin-bottom: 24px; }

/* ===== Mahsulot kartalari ===== */
.grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
.karta {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--soya);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.karta-rasm {
  height: 180px;
  background: var(--urgu);
  display: flex; align-items: center; justify-content: center;
  font-size: 4rem;
  position: relative;
}
.karta-rasm img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.karta-ichi { padding: 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.karta h3 { font-size: 1.2rem; }
.karta .yosh { font-size: .85rem; color: var(--kulrang); }
.karta .narx { font-size: 1.2rem; font-weight: 800; color: var(--asosiy); margin-top: auto; }
.karta .btn { text-align: center; }
.karta-link { display: block; color: inherit; }
.karta-link:hover h3 { color: var(--asosiy); }

/* ===== Mahsulot sahifasi ===== */
.mahsulot-sahifa { display: grid; grid-template-columns: 1fr; gap: 24px; }
.mahsulot-rasm {
  background: var(--urgu); border-radius: var(--radius); box-shadow: var(--soya);
  height: 260px; display: flex; align-items: center; justify-content: center;
  font-size: 6rem; position: relative; overflow: hidden;
}
.mahsulot-rasm img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mahsulot-info h1 { font-size: 1.6rem; margin-bottom: 8px; }
.mahsulot-info .yosh { color: var(--kulrang); display: block; margin-bottom: 12px; }
.mahsulot-info .narx { font-size: 1.6rem; font-weight: 800; color: var(--asosiy); display: block; margin: 16px 0; }
.mahsulot-info .yetkazish { margin-top: 16px; color: var(--kulrang); font-size: .95rem; }
.orqaga { display: inline-block; margin-bottom: 16px; font-weight: 700; color: var(--kulrang); }
.orqaga:hover { color: var(--asosiy); }

/* ===== Suzib yuruvchi Telegram tugmasi ===== */
.tg-suzuvchi {
  position: fixed; right: 16px; bottom: 16px; z-index: 50;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--ikkinchi); box-shadow: var(--soya);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; transition: transform .15s;
}
.tg-suzuvchi:hover { transform: scale(1.08); }

/* ===== Filtr ===== */
.filtr { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.filtr select {
  padding: 12px; border-radius: var(--radius); border: 2px solid var(--ikkinchi);
  font-family: inherit; font-size: 1rem; background: #fff;
}
.bosh { grid-column: 1 / -1; text-align: center; color: var(--kulrang); padding: 32px 0; }

/* ===== Matnli bloklar ===== */
.blok { background: #fff; border-radius: var(--radius); box-shadow: var(--soya); padding: 24px; margin-bottom: 20px; }
.blok h3 { margin-bottom: 8px; color: var(--asosiy); }
.xarita { width: 100%; height: 320px; border: 0; border-radius: var(--radius); }

/* ===== Footer ===== */
.footer { background: var(--matn); color: #fff; padding: 32px 0; margin-top: 48px; text-align: center; }
.footer a { color: var(--urgu); }
.footer p { margin: 4px 0; }

/* ===== Planshet va kompyuter ===== */
@media (min-width: 600px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .filtr { flex-direction: row; }
}
@media (min-width: 900px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .menu-tugma { display: none; }
  .nav { display: flex; flex-direction: row; width: auto; gap: 24px; padding: 0; }
  .banner h1 { font-size: 3rem; }
  .mahsulot-sahifa { grid-template-columns: 1fr 1fr; align-items: start; }
  .mahsulot-rasm { height: 380px; }
}

/* ===== Buyurtma oynasi ===== */
.modal {
  position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, .45);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal-ichi {
  position: relative; width: 100%; max-width: 420px; max-height: 100%; overflow-y: auto;
  background: #fff; border-radius: var(--radius); padding: 24px; display: grid; gap: 12px; box-shadow: var(--soya);
}
.modal-ichi h3 { font-size: 1.5rem; padding-right: 32px; }
.modal-ichi label { display: grid; gap: 4px; font-weight: 700; font-size: .92rem; }
.modal-ichi input, .modal-ichi textarea {
  width: 100%; padding: 10px 12px; border: 2px solid #e4e6eb; border-radius: 12px; font: inherit; font-weight: 400;
}
.modal-ichi input:focus, .modal-ichi textarea:focus { outline: none; border-color: var(--ikkinchi); }
.modal-mahsulot { color: var(--kulrang); }
.modal-yop { position: absolute; top: 12px; right: 12px; background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--kulrang); }
.modal-xabar:empty { display: none; }
.modal-xabar.xato { color: #d63c3c; font-weight: 700; }
.modal-ok { font-weight: 700; font-size: 1.1rem; padding-right: 24px; }
.modal-tg { text-align: center; color: var(--kulrang); text-decoration: underline; font-size: .9rem; }
.modal .btn:disabled { opacity: .6; cursor: progress; }

/* ===== Savat ===== */
.savat-tugma { position: relative; background: none; border: none; font-size: 1.6rem; cursor: pointer; padding: 0 6px; }
.savat-soni {
  position: absolute; top: -6px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px;
  background: var(--asosiy); color: #fff; border-radius: 999px; font: 800 .75rem/20px "Nunito", sans-serif; text-align: center;
}
.savat-soni[hidden] { display: none; }
.savat-qator { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #eee; }
.savat-rasm {
  width: 56px; height: 56px; flex-shrink: 0; position: relative; overflow: hidden;
  background: var(--urgu); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.8rem;
}
.savat-rasm img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.savat-rasm .belgi-tugagan { display: none; }
.savat-nom { flex: 1; min-width: 0; }
.savat-nom small { color: var(--kulrang); }
.son { display: flex; align-items: center; gap: 8px; font-weight: 800; }
.son button {
  width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--ikkinchi); background: #fff;
  font-size: 1.2rem; line-height: 1; cursor: pointer; color: var(--matn);
}
.son span { min-width: 20px; text-align: center; }
.savat-jami { text-align: right; font-size: 1.15rem; padding: 12px 0 4px; }
.savat-forma[hidden] { display: none !important; }
.toast {
  position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%); z-index: 200; max-width: 90vw;
  background: var(--matn); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 700; box-shadow: var(--soya);
}

/* ===== Ombor belgilari ===== */
.belgi-tugagan {
  position: absolute; top: 10px; left: 10px; background: #555; color: #fff; padding: 4px 12px;
  border-radius: 999px; font-size: .85rem; font-weight: 800; font-family: "Nunito", sans-serif;
}
.oxirgi { font-size: .85rem; font-weight: 800; color: #d9534f; }
.btn:disabled { background: #bbb; cursor: not-allowed; transform: none; }
.mahsulot-rasm { position: relative; }

/* ===== Telefon uchun moslashtirish ===== */
.modal-ichi, .savat-forma { grid-template-columns: minmax(0, 1fr); }
.savat-nom b { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.savat-nom small { display: block; white-space: nowrap; }

/* Sarlavha bir qatorda qolsin: do'kon nomi uzun bo'lsa, oxiri "..." bilan qisqaradi */
@media (max-width: 899px) {
  .logo { flex: 1 1 0; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

@media (max-width: 599px) {
  /* Mahsulotlar ikki ustunda — bir ekranda ko'proq mahsulot ko'rinadi */
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .karta-rasm { height: 150px; font-size: 3rem; }
  .karta-ichi { padding: 10px 12px; gap: 4px; }
  .karta h3 { font-size: 1rem; }
  .karta h3, .karta-link p { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
  .karta-link p { font-size: .85rem; line-height: 1.4; }
  .karta .yosh { font-size: .75rem; line-height: 1.3; }
  .karta .narx { font-size: 1.05rem; }
  .karta .btn { padding: 10px 6px; font-size: .88rem; line-height: 1.25; }
  .oxirgi { font-size: .75rem; }
  .belgi-tugagan { top: 6px; left: 6px; padding: 3px 9px; font-size: .75rem; }

  .section { padding: 32px 0; }
  .section h2 { font-size: 1.6rem; margin-bottom: 18px; }
  .banner { padding: 40px 0; }
  .banner h1 { font-size: 1.8rem; }

  .mahsulot-info .btn { display: block; width: 100%; text-align: center; }

  /* Savat telefonda pastdan chiqadi va butun kenglikni egallaydi */
  .modal { align-items: flex-end; padding: 0; }
  .modal-ichi {
    max-width: none; max-height: 92%; border-radius: 20px 20px 0 0;
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  }
  .savat-qator { gap: 10px; }
  .savat-rasm { width: 48px; height: 48px; font-size: 1.5rem; }
  .son { gap: 6px; }
  .son button { width: 36px; height: 36px; }
}
@supports (aspect-ratio: 1) {
  @media (max-width: 599px) { .karta-rasm { height: auto; aspect-ratio: 1; } }
}

/* Juda tor ekranlar (320–380px) */
@media (max-width: 380px) {
  .logo { font-size: 1.25rem; }
  .header-o-ng { gap: 4px; }
  .karta .btn-belgi { display: none; }
  .karta .narx { font-size: 1rem; }
}

/* Sarlavha aylantirganda ham tepada tursin (savat tugmasi doim qo'l ostida).
   .header o'zi bilan bir xil balandlikdagi #header ichida bo'lgani uchun "yopishqoqlik" tashqi blokka beriladi */
#header { position: sticky; top: 0; z-index: 10; }

@media (max-width: 599px) {
  .tg-suzuvchi { width: 48px; height: 48px; right: 12px; bottom: 12px; font-size: 1.5rem; }
}
