/* Brand */
:root {
    --brand-red: #d90000;
    --store-ink: #111;
    --page-padding-desktop: 64px;
    --page-padding-mobile: 24px;
    --header-padding-mobile: 12px;
    --page-padding: var(--page-padding-desktop);
    --page-edge-color: #fff;
}

html {
    background-color: var(--page-edge-color);
}

html.at-page-bottom {
    --page-edge-color: var(--brand-red);
}

.page-container {
    width: 100%;
    overflow-x: hidden;
    padding-left: max(var(--page-padding), env(safe-area-inset-left, 0px));
    padding-right: max(var(--page-padding), env(safe-area-inset-right, 0px));
}

@media (max-width: 991.98px) {
    :root {
        --page-padding: var(--page-padding-mobile);
        --header-padding: var(--header-padding-mobile);
    }
}

[x-cloak] {
    display: none !important;
}

body {
    color: var(--store-ink);
    background: var(--page-edge-color);
    font-family: Arial, Helvetica, sans-serif;
}

#main-content {
    background: #fff;
}

a {
    color: inherit;
}

button,
input,
a {
    -webkit-tap-highlight-color: transparent;
}

:where(a, button, input):focus-visible {
    outline: 3px solid var(--brand-red);
    outline-offset: 4px;
}

/* Shared page breadcrumbs */
.store-breadcrumbs .breadcrumb {
    --bs-breadcrumb-divider: '/';
    --bs-breadcrumb-divider-color: #858585;
    --bs-breadcrumb-item-active-color: #737373;
    margin-bottom: 16px;
    color: #737373;
    font-size: 13px;
}

.store-breadcrumbs a {
    text-decoration: none;
}

.store-breadcrumbs a:hover {
    color: var(--brand-red);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.skip-link {
    position: fixed;
    top: -80px;
    left: var(--page-padding);
    z-index: 1100;
    background: #fff;
    padding: 12px;
}

.skip-link:focus {
    top: 8px;
}

.store-header {
    position: sticky;
    top: 0;
    z-index: 1020;
    flex-shrink: 0;
    border-bottom: 1px solid #ececec;
    background: #fff;
}

.header-main {
    display: flex;
    align-items: center;
    gap: 22px;
    min-height: 112px;
}

.header-logo {
    flex-shrink: 0;
    display: flex;
}

.header-logo img {
    width: auto;
    height: 58px;
    max-width: 100%;
    object-fit: contain;
}

.catalog-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 58px;
    padding: 12px 26px;
    border-radius: 8px;
    background: var(--brand-red);
    color: #fff;
    font-size: 17px;
    border: 0;
}

.catalog-button:hover,
.catalog-button:focus-visible {
    background: var(--brand-red);
    color: #fff;
}

.header-search {
    position: relative;
    flex: 1;
    min-width: 0;
}

.header-search .form-control {
    height: 58px;
    padding: 12px 18px 12px 52px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: #f6f6f6;
    font-size: 15px;
}

.header-search .form-control::placeholder {
    color: #858585;
}

.header-search .form-control:focus {
    border-color: var(--brand-red);
    box-shadow: 0 0 0 3px rgb(216 0 4 / 8%);
    background: #fff;
}

.search-submit {
    position: absolute;
    left: 4px;
    top: 7px;
    width: 44px;
    height: 44px;
    border: 0;
    background: transparent;
    color: #707070;
    font-size: 19px;
}

.header-icon {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    border: 0;
    border-radius: 8px;
    background: #f6f6f6;
    text-decoration: none;
    color: var(--store-ink);
    font-size: 29px;
}

.header-icon:hover {
    color: var(--brand-red);
    background: #f1f1f1;
}

.cart-count {
    position: absolute;
    top: 3px;
    right: 3px;
    display: grid;
    place-items: center;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    border: 2px solid #fff;
    border-radius: 20px;
    background: var(--brand-red);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.header-secondary {
    background: #fff;
    border-bottom: 1px solid #ececec;
}

.header-secondary .page-container {
    gap: 34px;
    min-height: 55px;
}

.store-nav-link {
    padding: 12px 0;
    font-size: 14px;
    text-decoration: none;
}

.store-nav-link:hover {
    color: var(--brand-red);
}

.store-nav-link--accent {
    color: var(--brand-red);
}

.mobile-control {
    display: none;
}

.mobile-menu-layer {
    position: fixed;
    inset: 0;
    z-index: 1050;
}

.menu-backdrop {
    position: absolute;
    inset: 0;
    background: rgb(0 0 0 / 40%);
}

.mobile-menu {
    position: relative;
    width: min(350px, 88vw);
    height: 100%;
    overflow-y: auto;
    padding: 20px;
    padding-inline: var(--page-padding);
    background: #fff;
}

.mobile-menu-logo {
    display: block;
    width: 240px;
    max-width: 100%;
    margin: 0 auto 28px;
}

.mobile-menu-logo img {
    display: block;
    width: 100%;
    height: auto;
}

.mobile-links {
    display: flex;
    flex-direction: column;
    margin-top: 24px;
}

.mobile-links .store-nav-link {
    padding: 17px 0;
    border-bottom: 1px solid #eee;
    font-size: 16px;
}

.menu-enter {
    transition: transform 180ms ease-out;
}

.menu-offset {
    transform: translateX(-100%);
}

.menu-visible {
    transform: translateX(0);
}

@media (min-width: 992px) and (max-width: 1199.98px) {
    .header-main {
        gap: 16px;
    }

    .catalog-button {
        padding-inline: 20px;
    }
}

@media (max-width: 991.98px) {
    .header-main {
        min-height: 88px;
        gap: 4px;
        padding-left: var(--header-padding);
        padding-right: var(--header-padding);
    }

    .mobile-control {
        display: inline-flex;
    }

    .desktop-control,
    .header-secondary,
    .header-search,
    .mobile-hidden {
        display: none !important;
    }

    .header-logo {
        flex: 1;
        min-width: 0;
        justify-content: center;
        padding-inline: 6px;
    }

    .header-logo img {
        width: 100%;
        max-width: 145px;
        height: 44px;
        object-fit: contain;
    }

    .header-icon {
        width: 44px;
        height: 44px;
        background: transparent;
        font-size: 26px;
    }

    .cart-count {
        top: 0;
        right: -1px;
        min-width: 19px;
        height: 19px;
        font-size: 10px;
    }

    .header-search.is-open {
        display: block !important;
    }

    .header-search .form-control {
        height: 48px;
    }

    .search-submit {
        top: 2px;
    }

    .search-close {
        margin-left: 6px;
    }
}

@media (max-width: 374.98px) {
    .header-main {
        gap: 0;
        min-height: 76px;
    }

    .header-icon {
        width: 44px;
        height: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition: none !important;
        scroll-behavior: auto !important;
    }
}

/* Product card */
.product-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    border-radius: 20px;
    overflow: hidden;
    background: #f6f6f6;
    box-shadow: 2px 6px 16px rgb(0 0 0 / 13%);
}

.product-media {
    display: block;
    color: inherit;
    text-decoration: none;
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 20px;
    background: #ededed;
}

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

.product-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 100%;
    color: #777;
    font-size: 13px;
}

.product-placeholder i {
    font-size: 36px;
}

.product-marks,
.product-categories {
    position: absolute;
    left: 12px;
    right: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.product-marks {
    top: 12px;
}

.product-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    min-height: 32px;
    padding: 6px 9px;
    border-radius: 24px;
    background: #111;
    color: #fff;
    font-size: 12px;
}

.product-mark i,
.halal-mark {
    font-size: 16px;
    line-height: 1;
}

.header-logo,
.mobile-menu-logo {
    text-decoration: none;
}

.bone-mark {
    width: 18px;
    height: 18px;
}

.product-categories {
    bottom: 12px;
}

.product-categories span {
    padding: 5px 10px;
    border-radius: 20px;
    background: rgb(255 255 255 / 94%);
    font-size: 12px;
    line-height: 1.2;
}

.product-body {
    display: flex;
    flex: 1;
    flex-direction: column;
}

.product-title a {
    color: inherit;
    text-decoration: none;
}

.product-title a:hover {
    color: var(--brand-red);
}

.product-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    min-height: 2.7em;
    max-height: 2.7em;
    overflow: hidden;
    overflow-wrap: anywhere;
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.35;
}

.product-meta {
    color: #737373;
    font-size: 13px;
}

.product-meta strong {
    color: var(--store-ink);
    font-weight: 400;
}

.product-price {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: .35rem .6rem;
    margin-top: auto;
    font-size: 1.1rem;
    font-weight: 700;
}

.product-price span {
    font-size: 1.05rem;
    font-weight: 400;
}

.product-price .product-current-price {
    font-size: inherit;
    font-weight: inherit;
}

.product-old-price {
    color: #777;
    font-size: .9rem;
    font-weight: 400;
    white-space: nowrap;
}

.product-cart-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 28px;
    padding: .6rem;
    border: 0;
    border-radius: 28px;
    background: var(--brand-red);
    color: #fff;
    text-decoration: none;
    font-size: 1rem;
}

.product-cart-button:hover {
    background: #b50003;
    color: #fff;
}

.product-cart-button:disabled {
    opacity: .65;
    cursor: wait;
}

.product-quantity {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 16px;
    background: #e9ecef;
}

.quantity-button {
    display: grid;
    place-items: center;
    flex: 0 1 44px;
    min-width: 28px;
    width: 44px;
    min-height: 28px;
    padding: .6rem;
    border: 0;
    border-radius: 16px;
    background: transparent;
    color: var(--store-ink);
    font-size: 1rem;
}

.quantity-button:hover {
    color: var(--brand-red);
}

.quantity-button:disabled {
    opacity: .45;
    cursor: wait;
}

.quantity-summary {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: .9rem;
    line-height: 1.2;
    white-space: nowrap;
}

.quantity-weight {
    color: #737373;
}

.product-quantity.htmx-request .quantity-summary {
    opacity: .5;
}

.cart-loading,
.htmx-request .cart-label {
    display: none;
}

.htmx-request .cart-loading {
    display: inline;
}

.cart-error {
    margin: 10px 0 0;
    color: var(--brand-red);
    font-size: 13px;
}

@media (max-width: 575.98px) {
    .product-body {
        padding: 12px;
    }

    .product-title {
        font-size: 16px;
    }

    .product-price {
        font-size: 20px;
    }

    .product-marks,
    .product-categories {
        left: 8px;
        right: 8px;
        gap: 4px;
    }

    .product-mark {
        min-width: 30px;
        min-height: 30px;
        padding: 4px 6px;
    }
}

/* Reusable product grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px 16px;
}

.product-grid > .product-card {
    min-width: 0;
}

@media (max-width: 374.98px) {
    .product-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (min-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 28px 22px;
    }
}

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

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

@media (min-width: 1500px) {
    .product-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}

/* Reusable product rows */
.product-row + .product-row {
    margin-top: 40px;
}

.slider-arrow {
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border: 1px solid #e5e5e5;
    border-radius: 50%;
    background: #fff;
    color: var(--store-ink);
}

.slider-arrow:hover {
    border-color: var(--brand-red);
    color: var(--brand-red);
}

.slider-arrow:disabled {
    opacity: .35;
    cursor: default;
}

.section-heading {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -.6px;
}

@media (max-width: 575.98px) {
    .section-heading {
        font-size: 1.4rem;
    }
}

.items-swiper {
    padding: 0;
}

.items-swiper .swiper-slide {
    height: auto;
    padding-bottom: 1rem;
}

.offers-empty {
    padding: 28px;
    border-radius: 16px;
    background: #f6f6f6;
    color: #666;
}

.offers-empty a {
    display: inline-block;
    color: var(--brand-red);
}

/* Readable fallback when Swiper is unavailable */
.swiper:not(.swiper-initialized) .swiper-wrapper {
    gap: 20px;
    overflow-x: auto;
}

.items-swiper:not(.swiper-initialized) .swiper-slide {
    width: 210px;
}

.swiper:not(.swiper-initialized) .slider-arrow {
    display: none;
}

/* Site footer */
.store-footer {
    padding: 48px 0 24px;
    padding-bottom: max(24px, env(safe-area-inset-bottom, 0px));
    background: var(--brand-red);
    color: #fff;
}

.footer-main {
    display: grid;
    grid-template-columns: 1fr 1.2fr 1.3fr;
    gap: 48px;
    padding-bottom: 40px;
}

.footer-logo {
    display: inline-block;
}

.footer-logo img {
    width: 150px;
    max-width: 100%;
    height: auto;
}

.footer-social {
    display: flex;
    align-items: center;
    gap: 10px;
    width: fit-content;
    margin-top: 24px;
    font-size: 14px;
}

.footer-social i {
    font-size: 28px;
}

.footer-stores {
    display: grid;
    gap: 22px;
}

.footer-location h2 {
    margin: 0 0 6px;
    font-size: 15px;
    font-weight: 700;
}

.footer-location address {
    margin: 0 0 6px;
    font-size: 13px;
    line-height: 1.6;
}

.footer-phone {
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}

.footer-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: start;
    gap: 16px 24px;
}

.footer-nav .store-nav-link {
    padding: 0;
    font-size: 14px;
}

.store-footer a,
.store-footer .store-nav-link--accent {
    color: #fff;
    text-decoration: none;
}

.store-footer a:hover {
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.store-footer a:focus-visible {
    outline-color: #fff;
}

.footer-bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 28px;
    padding-top: 24px;
    border-top: 1px solid rgb(255 255 255 / 25%);
    font-size: 12px;
    line-height: 1.5;
}

@media (max-width: 991.98px) {
    .footer-main {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 32px;
    }

    .footer-brand {
        grid-column: 1 / -1;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 20px;
    }

    .footer-social {
        margin-top: 0;
    }
}

@media (max-width: 575.98px) {
    .store-footer {
        padding-top: 32px;
    }

    .footer-main {
        grid-template-columns: minmax(0, 1fr);
        gap: 28px;
        padding-bottom: 28px;
    }

    .footer-bottom {
        flex-direction: column;
        align-items: flex-start;
    }
}
/* Shared authentication dialog */
.auth-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgb(0 0 0 / 55%);
    backdrop-filter: blur(5px);
    overflow-y: auto;
}

.auth-dialog {
    position: relative;
    width: 100%;
    max-width: 520px;
    max-height: calc(100dvh - 48px);
    overflow-y: auto;
    padding: 44px 36px 36px;
    border-radius: 28px;
    background: white;
    color: var(--brand-black, #171717);
    box-shadow: 0 24px 80px rgb(0 0 0 / 18%);
}

.auth-dialog h1,
.auth-dialog h2 {
    padding-right: 26px;
    font-size: clamp(26px, 5vw, 34px);
    font-weight: 700;
}

.auth-description {
    margin: 16px 0 28px;
    color: #777;
    line-height: 1.6;
}

.auth-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: #f4f4f4;
}

.auth-provider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    min-height: 56px;
    padding: 12px 16px;
    border: 0;
    border-radius: 14px;
    font-weight: 600;
    text-decoration: none;
}

.auth-provider i,
.auth-provider-symbol { font-size: 22px; }
.auth-provider-list { display: grid; gap: 10px; margin-top: 10px; }
.auth-provider:disabled { background: #f4f4f4; color: #8b8b8b; cursor: not-allowed; }
.auth-provider small { margin-left: auto; font-size: 11px; font-weight: 400; }
.auth-telegram { background: var(--brand-red); color: white; transition: background 180ms ease; }
.auth-telegram:hover { background: #af0003; color: white; }
.auth-telegram .htmx-indicator { display: none; }
.htmx-request .auth-telegram .htmx-indicator { display: inline-block; }
.auth-check { display: block; margin-top: 20px; color: #555; text-align: center; }
.auth-waiting { font-size: 20px; font-weight: 600; }
.auth-waiting i { color: var(--brand-red); }
.auth-error { color: var(--brand-red); }
.auth-page { display: flex; justify-content: center; padding-block: 48px; }
.auth-page .auth-dialog { max-height: none; }

.product-card { position: relative; }
.liked-form { position: absolute; z-index: 2; top: 10px; right: 10px; }
.liked-button {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: white;
    color: var(--brand-red);
    box-shadow: 0 2px 8px rgb(0 0 0 / 8%);
}
.liked-button:disabled { opacity: .5; }
.liked-error { position: absolute; right: 0; width: 150px; padding: 6px; background: white; color: var(--brand-red); font-size: 12px; }

@media (max-width: 575.98px) {
    .auth-overlay { padding: 16px; }
    .auth-dialog { padding: 40px 24px 24px; border-radius: 22px; }
}
