/* ============================================================
   NarxBaza — zamonaviy dark UI
   ============================================================ */
:root {
    --bg:        #0a0e1a;
    --bg-soft:   #0e1424;
    --surface:   #141c30;
    --surface-2: #1b2540;
    --surface-3: #222e4e;
    /* ba'zi admin sahifalarida ishlatiladigan taxalluslar (input/select foni) */
    --bg-2:      var(--surface-2);
    --bg-3:      var(--surface-3);
    --line:      #2a3656;
    --line-soft: #1f2a45;
    --text:      #eaf0fb;
    --muted:     #93a1bd;
    --accent:    #34d6a5;
    --accent-2:  #4aa8ff;
    --grad:      linear-gradient(135deg, #34d6a5 0%, #4aa8ff 100%);
    --grad-soft: linear-gradient(135deg, rgba(52,214,165,.15), rgba(74,168,255,.15));
    --cheap:     #34d6a5;
    --mid:       #fbbf24;
    --high:      #fb7185;
    --radius:    16px;
    --radius-sm: 11px;
    --shadow:    0 10px 30px rgba(0,0,0,.35);
    --shadow-sm: 0 4px 14px rgba(0,0,0,.25);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: "Inter", -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
    color: var(--text);
    line-height: 1.55;
    background:
        radial-gradient(900px 500px at 12% -8%, rgba(74,168,255,.13), transparent 60%),
        radial-gradient(800px 500px at 100% 0%, rgba(52,214,165,.12), transparent 55%),
        var(--bg);
    background-attachment: fixed;
    min-height: 100vh;
}
a { color: var(--accent-2); text-decoration: none; transition: color .15s; }
a:hover { color: var(--accent); }
.wrap { max-width: 1060px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); font-size: .9em; }
h1, h2, h3 { line-height: 1.2; }

/* ---- topbar ---- */
.topbar {
    background: rgba(14,20,36,.78);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line-soft);
    position: sticky; top: 0; z-index: 50;
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { font-size: 1.3rem; font-weight: 800; color: var(--text); letter-spacing: -.02em; display: flex; align-items: center; gap: 8px; }
.brand:hover { color: var(--text); }
.brand-mark {
    display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px;
    background: var(--grad); color: #062018; font-size: 1rem; box-shadow: 0 4px 12px rgba(52,214,165,.4);
}
.topnav { display: flex; align-items: center; gap: 4px; }
.topnav a {
    color: var(--muted); font-weight: 600; font-size: .92rem; padding: 7px 12px; border-radius: 9px;
    transition: .15s;
}
.topnav a:hover { color: var(--text); background: var(--surface-2); }

main.wrap { padding-top: 30px; padding-bottom: 70px; min-height: 62vh; animation: fade .4s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---- hero + search ---- */
.hero { text-align: center; padding: 30px 0 6px; }
.hero h1 {
    margin: 0 0 10px; font-size: 2.3rem; font-weight: 800; letter-spacing: -.03em;
    background: linear-gradient(120deg, #fff 30%, #9fd9ff 70%, #5ef0c0);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero p { max-width: 620px; margin: 0 auto; }
.search { display: flex; gap: 10px; max-width: 660px; margin: 22px auto 0; }
.search input {
    flex: 1; padding: 15px 18px; border-radius: var(--radius); font-size: 1rem;
    border: 1px solid var(--line); background: var(--surface); color: var(--text);
    transition: .18s; box-shadow: var(--shadow-sm);
}
.search input::placeholder { color: #6b7a99; }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(52,214,165,.16); }
.search button {
    padding: 0 26px; border: 0; border-radius: var(--radius); cursor: pointer;
    background: var(--grad); color: #062018; font-weight: 800; font-size: .98rem;
    box-shadow: 0 6px 18px rgba(52,214,165,.32); transition: .15s;
}
.search button:hover { transform: translateY(-1px); filter: brightness(1.05); }

/* ---- chips ---- */
.suggest { text-align: center; margin-top: 36px; }
.chips { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.chip { background: var(--surface-2); border: 1px solid var(--line); padding: 8px 16px; border-radius: 999px; color: var(--text); font-size: .9rem; transition: .15s; }
.chip:hover { border-color: var(--accent); color: var(--text); transform: translateY(-1px); }

/* ---- results ---- */
.results-head { margin: 24px 0 16px; font-size: 1.05rem; }
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 30px; text-align: center; color: var(--muted); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 18px; }
.card {
    position: relative; background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 18px; display: block; color: var(--text);
    transition: .18s; box-shadow: var(--shadow-sm); overflow: hidden;
}
.card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--grad); opacity: 0; transition: .18s; }
.card:hover { border-color: var(--line); transform: translateY(-3px); box-shadow: var(--shadow); color: var(--text); }
.card:hover::before { opacity: 1; }
.card-top { display: flex; justify-content: space-between; align-items: center; }
.badge { background: var(--grad-soft); color: #aee9ff; font-size: .72rem; font-weight: 600; padding: 4px 11px; border-radius: 999px; border: 1px solid var(--line); }
.product-name { margin: 12px 0 14px; font-size: 1.08rem; font-weight: 700; }

/* ---- price grid ---- */
.price-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.price-grid.big { gap: 14px; margin: 20px 0 8px; }
.pg { background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 11px 8px; text-align: center; }
.pg-label { display: block; font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.pg-val { display: block; font-weight: 800; margin-top: 5px; font-size: 1.02rem; }
.price-grid.big .pg-val { font-size: 1.4rem; }
.pg.cheap { background: linear-gradient(180deg, rgba(52,214,165,.12), transparent); }
.pg.mid   { background: linear-gradient(180deg, rgba(251,191,36,.10), transparent); }
.pg.high  { background: linear-gradient(180deg, rgba(251,113,133,.10), transparent); }
.pg.cheap .pg-val { color: var(--cheap); }
.pg.mid   .pg-val { color: var(--mid); }
.pg.high  .pg-val { color: var(--high); }
.cheapest-line { margin-top: 12px; font-size: .82rem; }

/* ---- product page ---- */
.back { display: inline-block; margin-bottom: 14px; color: var(--muted); font-weight: 600; }
.product-head h1 { margin: 10px 0 4px; font-size: 1.7rem; }
.panel {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 20px; margin-top: 22px; box-shadow: var(--shadow-sm); overflow-x: auto;
}
.panel h2 { margin: 0 0 16px; font-size: 1.12rem; }

.price-table { width: 100%; border-collapse: collapse; }
.price-table th, .price-table td { padding: 11px 9px; border-bottom: 1px solid var(--line-soft); text-align: left; }
.price-table th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.price-table tbody tr { transition: background .12s; }
.price-table tbody tr:hover { background: var(--surface-2); }
.price-table tr.is-cheapest { background: rgba(52,214,165,.08); }
.tag-cheap { background: var(--grad); color: #062018; font-size: .66rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; margin-left: 8px; }

/* ---- build (komplekt) ---- */
.build-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 18px; }
.build-col {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 18px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.build-col::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; }
.build-col.tier-cheap::before { background: var(--cheap); }
.build-col.tier-mid::before   { background: var(--mid); }
.build-col.tier-high::before  { background: var(--high); }
.build-col h3 { margin: 6px 0 4px; font-size: 1.1rem; }
.build-col.tier-cheap h3 { color: var(--cheap); }
.build-col.tier-mid h3 { color: var(--mid); }
.build-col.tier-high h3 { color: var(--high); }
.build-col .total { font-size: 1.5rem; font-weight: 800; margin: 4px 0 14px; }
.build-item { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: .9rem; }
.build-item .bi-cat { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .03em; }
.bi-missing { color: var(--high); }
.build-total-bottom { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; padding-top: 14px; border-top: 2px solid var(--line); font-weight: 800; font-size: 1.2rem; }
.build-total-bottom span:last-child { color: var(--accent); }

/* ---- assembled (talab bo'yicha yig'ma) ---- */
.assembled { margin: 22px 0 8px; }
.assembled-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.assembled-head h2 { margin: 0; font-size: 1.25rem; }
.assembled-warn { background: rgba(251,191,36,.1); border: 1px solid rgba(251,191,36,.3); color: #fcd34d; border-radius: var(--radius-sm); padding: 9px 14px; margin: 8px 0; font-size: .9rem; }
.assembled-card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 6px 18px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.assembled-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--grad); }
.asm-row { display: grid; grid-template-columns: 130px 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.asm-row.is-pinned { background: linear-gradient(90deg, rgba(52,214,165,.07), transparent); margin: 0 -18px; padding: 12px 18px; }
.asm-cat { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.asm-model { font-weight: 600; }
.asm-pin { background: var(--grad); color: #062018; font-size: .64rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; margin-left: 8px; }
.asm-price { font-weight: 700; }
.asm-total { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; padding-top: 16px; border-top: 2px solid var(--line); font-size: 1.5rem; font-weight: 800; }
.asm-total span:last-child { color: var(--accent); }
.asm-actual { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: .82rem; }
.asm-actual b { color: var(--text); }
.asm-actions { display: flex; gap: 10px; margin-top: 14px; }
.asm-actions button { flex: 1; padding: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); border-radius: var(--radius-sm); font-weight: 600; cursor: pointer; font-size: .92rem; transition: .15s; }
.asm-actions button:hover { border-color: var(--accent); color: var(--accent); }
.asm-actions button:active { transform: scale(.97); }
.build-date { margin-top: 10px; color: var(--muted); font-size: .78rem; }
.build-actions { display: flex; gap: 8px; margin-top: 12px; }
.build-actions button { flex: 1; padding: 9px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); border-radius: 9px; font-weight: 600; cursor: pointer; font-size: .82rem; transition: .15s; }
.build-actions button:hover { border-color: var(--accent); color: var(--accent); }

/* ---- footer ---- */
.site-footer { border-top: 1px solid var(--line-soft); padding: 26px 0; color: var(--muted); font-size: .85rem; }
.site-footer .muted { display: block; margin-top: 4px; }

/* ---- channels ---- */
.channel-list { list-style: none; padding: 0; }
.channel-list li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 13px 16px; margin-bottom: 9px; display: flex; justify-content: space-between; box-shadow: var(--shadow-sm); }

/* ---- yuqori amal ikonlari (Admin / Chiqish) ---- */
.topactions { display: flex; gap: 6px; }
.topactions a {
    width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px;
    background: var(--surface-2); border: 1px solid var(--line); color: var(--muted);
    font-size: 1.05rem; transition: .15s;
}
.topactions a:hover { color: var(--text); border-color: var(--accent); }

/* ---- pastki tab navigatsiya (app uslubi) ---- */
.bottomnav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; display: none;
    justify-content: space-around; align-items: stretch;
    background: rgba(14,20,36,.94); backdrop-filter: blur(16px);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -8px 24px rgba(0,0,0,.4);
}
.bn-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 9px 0 8px; color: var(--muted); font-size: .66rem; font-weight: 600;
    text-decoration: none; transition: color .15s; position: relative;
}
.bn-item .bn-ico { display: grid; place-items: center; transition: .15s; }
.bn-item .bn-ico svg { width: 24px; height: 24px; }
.bn-item:active { transform: scale(.94); }
.bn-item.active { color: var(--accent); }
.bn-item.active .bn-ico { transform: translateY(-1px); }
.bn-item.active::before {
    content: ""; position: absolute; top: 0; width: 26px; height: 3px;
    border-radius: 0 0 4px 4px; background: var(--grad);
}

/* ============ MOBIL / Telegram WebApp (app rejimi) ============ */
@media (max-width: 640px) {
    .wrap { padding: 0 14px; }
    .topbar-inner { height: 56px; }
    .brand { font-size: 1.12rem; }
    .topnav { display: none; }
    .bottomnav { display: flex; }
    main.wrap { padding-bottom: 88px; }
    .site-footer { display: none; }
    .hero { padding-top: 14px; }
    .hero h1 { font-size: 1.7rem; }
    .search { flex-direction: column; }
    .search button { padding: 14px; }
    .cards { grid-template-columns: 1fr; }
    .price-grid.big .pg-val { font-size: 1.1rem; }
    .price-table { font-size: .85rem; white-space: nowrap; }
    .price-table th, .price-table td { padding: 9px 7px; }
    .build-grid { grid-template-columns: 1fr; }
    .asm-row { grid-template-columns: 1fr auto; }
    .asm-row .asm-cat { grid-column: 1 / -1; }
    h1 { font-size: 1.5rem; }
}

/* Telegram ichida — har doim app rejimi (ekran kengligidan qat'i nazar) */
html.tg .topnav { display: none; }
html.tg .bottomnav { display: flex; }
html.tg main.wrap { padding-bottom: 88px; padding-top: 18px; }
html.tg .site-footer { display: none; }
html.tg .topbar { position: sticky; top: 0; }
html.tg .topbar-inner { height: 54px; }
