/*
 * Onlayn do'kon — haridor sahifasi (/shop/<havola>).
 *
 * Ranglar `app.css` dagi o'zgaruvchilardan olinadi — yorug' va
 * qorong'i temada o'zi moslashadi. Telefon birinchi o'rinda: haridorlar
 * havolani asosan Telegramdan ochadi.
 */

.sf-body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--app-body-bg);
    color: var(--app-text);
}

.sf-body.sf-has-cart {
    /* Pastdagi savat paneli oxirgi mahsulotlarni yopib qo'ymasin */
    padding-bottom: 88px;
}

.sf-wrap {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 16px;
}

/* --------------------------------------------------------------- sarlavha */

.sf-hero {
    background: var(--app-surface);
    border-bottom: 1px solid var(--app-border);
    padding: 22px 0 18px;
}

.sf-hero__inner {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sf-hero__logo {
    flex: 0 0 64px;
    width: 64px;
    height: 64px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    font-size: 1.7rem;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, var(--app-accent), #7c3aed);
    box-shadow: 0 8px 20px -8px rgba(var(--app-accent-rgb), .6);
}

.sf-hero__text {
    min-width: 0;
}

.sf-hero__name {
    margin: 0;
    font-size: 1.45rem;
    font-weight: 800;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.sf-hero__about {
    margin: 4px 0 0;
    color: var(--app-muted);
    font-size: .92rem;
    white-space: pre-line;
}

.sf-hero__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    margin-top: 8px;
    font-size: .88rem;
    color: var(--app-muted);
}

.sf-hero__meta a {
    color: var(--app-accent);
    font-weight: 600;
    text-decoration: none;
}

.sf-hero__meta i {
    width: 1em;
    margin-right: 2px;
}

.sf-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 14px;
    padding: 10px 14px;
    border-radius: var(--app-radius-sm);
    background: var(--app-accent-soft);
    color: var(--app-text);
    font-size: .88rem;
}

.sf-note i {
    margin-top: 3px;
    color: var(--app-accent);
}

/* --------------------------------------------------------------- qidiruv */

.sf-searchbar {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 12px 0;
    background: color-mix(in srgb, var(--app-body-bg) 92%, transparent);
    backdrop-filter: saturate(1.4) blur(8px);
    -webkit-backdrop-filter: saturate(1.4) blur(8px);
}

.sf-search {
    position: relative;
    display: block;
    margin: 0;
}

.sf-search i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--app-muted);
    pointer-events: none;
}

.sf-search input {
    width: 100%;
    height: 48px;
    padding: 0 16px 0 44px;
    border: 1px solid var(--app-border);
    border-radius: 999px;
    background: var(--app-surface);
    color: var(--app-text);
    font-size: 1rem;
    box-shadow: var(--app-shadow-sm);
    outline: none;
}

.sf-search input:focus {
    border-color: var(--app-accent);
    box-shadow: 0 0 0 4px var(--app-accent-soft);
}

/* --------------------------------------------------------------- mahsulotlar */

.sf-main {
    flex: 1 0 auto;
    padding-top: 4px;
    padding-bottom: 24px;
}

.sf-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

@media (min-width: 576px) {
    .sf-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
}

@media (min-width: 992px) {
    .sf-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
}

@media (min-width: 1200px) {
    .sf-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

.sf-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: var(--app-surface);
    box-shadow: var(--app-shadow-sm);
    transition: box-shadow .15s ease, transform .15s ease;
}

@media (hover: hover) {
    .sf-card:hover {
        box-shadow: var(--app-shadow);
        transform: translateY(-1px);
    }
}

.sf-card__img {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    padding: 0;
    border: 0;
    background: var(--app-surface-2);
    overflow: hidden;
    cursor: pointer;
}

.sf-card__img img,
.sf-pmodal__img img,
.sf-line__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sf-ph {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    font-size: 2.2rem;
    font-weight: 800;
    color: rgba(var(--app-accent-rgb), .45);
    background: linear-gradient(135deg, rgba(var(--app-accent-rgb), .08), rgba(var(--app-accent-rgb), .16));
}

.sf-card.is-out .sf-card__img img,
.sf-card.is-out .sf-ph {
    filter: grayscale(1);
    opacity: .55;
}

.sf-card__body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    gap: 4px;
    padding: 10px 12px 12px;
}

.sf-card__name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.6em;
    padding: 0;
    border: 0;
    background: none;
    color: var(--app-text);
    font-size: .9rem;
    font-weight: 500;
    line-height: 1.3;
    text-align: left;
    overflow-wrap: anywhere;
    cursor: pointer;
}

.sf-card__price {
    font-weight: 800;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sf-card__action {
    margin-top: auto;
    padding-top: 6px;
}

.sf-add {
    width: 100%;
    height: 40px;
    border-radius: 12px;
    font-weight: 600;
    font-size: .9rem;
}

.sf-out {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    border-radius: 12px;
    background: var(--app-surface-2);
    color: var(--app-muted);
    font-size: .85rem;
    font-weight: 600;
}

/* Miqdor: [−] 2 [+] */
.sf-stepper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 40px;
    border-radius: 12px;
    background: var(--app-accent-soft);
    overflow: hidden;
}

.sf-stepper__btn {
    flex: 0 0 40px;
    height: 100%;
    border: 0;
    background: transparent;
    color: var(--app-accent);
    font-size: .9rem;
    cursor: pointer;
}

.sf-stepper__btn:active {
    background: rgba(var(--app-accent-rgb), .18);
}

.sf-stepper__val {
    flex: 1 1 auto;
    min-width: 0;
    text-align: center;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sf-stepper--big {
    height: 52px;
    font-size: 1.1rem;
}

.sf-stepper--big .sf-stepper__btn {
    flex-basis: 56px;
}

.sf-empty {
    padding: 60px 16px;
    text-align: center;
    color: var(--app-muted);
}

.sf-empty i {
    font-size: 2rem;
    opacity: .5;
    margin-bottom: 10px;
}

.sf-more {
    display: flex;
    justify-content: center;
    padding: 20px 0 8px;
}

.sf-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--app-border);
    border-top-color: var(--app-accent);
    border-radius: 50%;
    animation: sf-spin .8s linear infinite;
}

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

/* --------------------------------------------------------------- savat paneli */

.sf-cartbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1040;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    pointer-events: none;
}

.sf-cartbar[hidden] {
    display: none;
}

.sf-cartbar__btn {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    padding: 10px 16px;
    border: 0;
    border-radius: 18px;
    background: var(--app-accent);
    color: #fff;
    box-shadow: 0 14px 30px -10px rgba(var(--app-accent-rgb), .75);
    text-align: left;
    cursor: pointer;
}

.sf-cartbar__icon {
    position: relative;
    font-size: 1.35rem;
}

.sf-cartbar__count {
    position: absolute;
    top: -8px;
    right: -10px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    background: #fff;
    color: var(--app-accent);
    font-size: .72rem;
    font-weight: 800;
    line-height: 20px;
    text-align: center;
}

.sf-cartbar__text {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
    line-height: 1.2;
    padding-left: 6px;
}

.sf-cartbar__label {
    font-size: .75rem;
    opacity: .85;
}

.sf-cartbar__go {
    font-weight: 700;
    font-size: .92rem;
    white-space: nowrap;
}

@media (max-width: 359.98px) {
    .sf-cartbar__go { font-size: 0; }
    .sf-cartbar__go i { font-size: 1rem; }
}

/* --------------------------------------------------------------- mahsulot oynasi */

.sf-pmodal {
    position: relative;
    overflow: hidden;
    border: 0;
    border-radius: 20px;
}

.sf-pmodal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    padding: 10px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, .9);
    opacity: 1;
}

.sf-pmodal__img {
    aspect-ratio: 1 / 1;
    max-height: 60vh;
    background: var(--app-surface-2);
}

.sf-pmodal__img .sf-ph {
    font-size: 4rem;
}

.sf-pmodal__body {
    padding: 16px 18px 20px;
}

.sf-pmodal__name {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 4px;
    overflow-wrap: anywhere;
}

.sf-pmodal__price {
    font-size: 1.3rem;
    font-weight: 800;
    margin-bottom: 14px;
}

.sf-pmodal__action .sf-out {
    height: 52px;
}

/* --------------------------------------------------------------- savat oynasi */

.sf-lines {
    margin: 0;
    padding: 0;
    list-style: none;
}

.sf-line {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--app-border);
}

.sf-line__img {
    width: 56px;
    height: 56px;
    overflow: hidden;
    border-radius: 12px;
    background: var(--app-surface-2);
}

.sf-line__img .sf-ph {
    font-size: 1.3rem;
}

.sf-line__name {
    font-weight: 600;
    font-size: .9rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.sf-line__price {
    font-size: .8rem;
    color: var(--app-muted);
}

.sf-line__right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.sf-line__right .sf-stepper {
    width: 118px;
    height: 34px;
}

.sf-line__right .sf-stepper__btn {
    flex-basis: 34px;
}

.sf-line__sum {
    font-weight: 700;
    font-size: .88rem;
    white-space: nowrap;
}

.sf-lines__empty {
    padding: 30px 0;
    text-align: center;
    color: var(--app-muted);
}

.sf-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 14px 0 6px;
    font-size: 1.05rem;
}

.sf-total strong {
    font-size: 1.3rem;
    font-weight: 800;
}

.sf-form {
    margin-top: 12px;
    padding-top: 14px;
    border-top: 1px dashed var(--app-border);
}

.sf-form__title {
    font-weight: 700;
    margin-bottom: 12px;
}

.sf-form .form-control {
    min-height: 46px;
    font-size: 1rem;
}

/* Tuzoq maydon — ekrandan tashqarida (display:none emas: ba'zi botlar buni tekshiradi) */
.sf-hp {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.sf-cart-foot {
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}

.sf-cart-foot .btn {
    border-radius: 14px;
    font-weight: 700;
}

.sf-done {
    padding: 40px 10px 24px;
    text-align: center;
}

.sf-done__icon {
    width: 76px;
    height: 76px;
    margin: 0 auto 16px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-size: 2rem;
    color: #fff;
    background: #16a34a;
    box-shadow: 0 12px 28px -10px rgba(22, 163, 74, .7);
}

.sf-done h4 {
    font-weight: 800;
}

.sf-done p {
    color: var(--app-muted);
    margin-bottom: 20px;
}

/* --------------------------------------------------------------- yopiq do'kon */

.sf-closed {
    flex: 1 0 auto;
    max-width: 440px;
    margin: 0 auto;
    padding: 18vh 20px 40px;
    text-align: center;
}

.sf-closed__icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 18px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-size: 1.8rem;
    color: var(--app-muted);
    background: var(--app-surface-2);
}

.sf-closed h1 {
    font-size: 1.35rem;
    font-weight: 700;
}

.sf-closed p {
    color: var(--app-muted);
}

/* --------------------------------------------------------------- pastki yozuv */

.sf-foot {
    padding: 18px 16px 24px;
    text-align: center;
    font-size: .8rem;
    color: var(--app-muted);
}

.sf-foot a {
    color: inherit;
    font-weight: 600;
}

@media (max-width: 575.98px) {
    .sf-hero { padding: 18px 0 14px; }
    .sf-hero__logo { flex-basis: 52px; width: 52px; height: 52px; font-size: 1.35rem; border-radius: 15px; }
    .sf-hero__name { font-size: 1.2rem; }
    .sf-card__body { padding: 8px 10px 10px; }
    .sf-card__price { font-size: .95rem; }
}
