/* =========================================================
   Albatross Food — мобильный каталог
   ========================================================= */

/* ---------- base ---------- */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    background: #fafafa;
    color: #222;
    -webkit-text-size-adjust: 100%;
}

body {
    padding: 10px 12px 24px;
}

a {
    color: #0077cc;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1,
h2,
h3 {
    margin: 0 0 8px;
    font-weight: 700;
}

h1 {
    font-size: 18px;
}

h2 {
    font-size: 16px;
}

h3 {
    font-size: 13px;
    line-height: 1.3;
}

/* ---------- header / nav ---------- */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 8px;
}

header h1 a {
    color: #222;
    font-size: 18px;
}

nav {
    display: flex;
    gap: 10px;
    font-size: 13px;
}

nav a {
    white-space: nowrap;
}

/* ---------- buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    min-height: 44px;
    /* тач-таргет */
    border-radius: 8px;
    background: #ff8c42;
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    touch-action: manipulation;
    user-select: none;
}

.btn-secondary {
    background: #eee;
    color: #333;
    font-weight: 500;
}

@media (hover: hover) {
    .btn:hover {
        background: #f4772d;
    }

    .btn-secondary:hover {
        background: #ddd;
    }
}

/* ---------- catalog head ---------- */
.catalog-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.btn-filter-toggle {
    background: #fff;
    color: #333;
    border: 1px solid #ddd;
    padding: 8px 14px;
    font-size: 13px;
    min-height: 40px;
}

@media (hover: hover) {
    .btn-filter-toggle:hover {
        background: #f4f4f4;
    }
}

/* ---------- active filter chips ---------- */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    /* переносим, а не скроллим */
    gap: 6px;
    padding: 4px 0 10px;
    margin: 0;
}

.chip-active {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff3e6;
    color: #a35a13;
    padding: 6px 10px;
    border-radius: 16px;
    font-size: 13px;
    text-decoration: none;
    border: 1px solid #ffd9b3;
    white-space: nowrap;
    min-height: 32px;
    touch-action: manipulation;
    user-select: none;
}

.chip-x {
    font-weight: 700;
    opacity: .5;
    font-size: 15px;
    line-height: 1;
}

.chip-active:active .chip-x {
    opacity: 1;
}

.chip-clear {
    background: #f6f6f6;
    color: #666;
    border: 1px solid #e0e0e0;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 13px;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    touch-action: manipulation;
}

/* =========================================================
   Filters modal
   ========================================================= */

.filters-overlay {
    position: fixed;
    inset: 0;
    background: #fff;
    z-index: 100;
    display: flex;
    align-items: stretch;
    justify-content: center;
}

.filters-overlay[hidden] {
    display: none;
}

.filters-modal {
    background: #fff;
    width: 100%;
    max-width: 520px;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.filters-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.filters-modal-header h3 {
    margin: 0;
    font-size: 16px;
}

.filters-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 22px;
    color: #666;
    padding: 6px 12px;
    border-radius: 6px;
    line-height: 1;
    min-height: 44px;
    min-width: 44px;
    touch-action: manipulation;
    user-select: none;
}

@media (hover: hover) {
    .filters-close:hover {
        background: #f4f4f4;
    }
}

.filters-form {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #fff;
    border: none;
    margin: 0;
    -webkit-overflow-scrolling: touch;
}

.filter-row {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.filter-label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
}

.filter-row select,
.filter-row input[type="number"] {
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 15px;
    /* 16px убирает авто-зум на iOS, 15 — компромисс */
    background: #fff;
    min-height: 44px;
    width: 100%;
    touch-action: manipulation;
}

.range {
    display: flex;
    gap: 6px;
    align-items: center;
}

.range input {
    flex: 1;
}

.filters-modal-footer {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #eee;
    background: #fff;
    flex-shrink: 0;
}

.filters-modal-footer .btn {
    flex: 1;
}

/* ---------- dropdown (multiselect) ---------- */
.dropdown {
    position: relative;
    display: block;
}

.dropdown-summary {
    list-style: none;
    cursor: pointer;
    padding: 11px 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    background: #fff;
    font-size: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 44px;
    touch-action: manipulation;
    user-select: none;
}

.dropdown-summary::-webkit-details-marker {
    display: none;
}

.dropdown-summary::after {
    content: "▾";
    margin-left: 8px;
    color: #888;
    transition: transform .15s;
}

.dropdown[open] .dropdown-summary::after {
    transform: rotate(180deg);
}

.dropdown-body {
    position: relative;
    margin-top: 6px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 6px;
    max-height: 240px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    -webkit-overflow-scrolling: touch;
}

.dropdown-body .check {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    min-height: 44px;
    touch-action: manipulation;
    user-select: none;
}

.dropdown-body .check input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #ff8c42;
}

@media (hover: hover) {
    .dropdown-body .check:hover {
        background: #f6f6f6;
    }
}

/* =========================================================
   Products
   ========================================================= */

.counter {
    font-size: 12px;
    color: #888;
    margin: 6px 2px 8px;
}

.counter b {
    color: #333;
}

.products {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 16px;
}

@media (min-width: 720px) {
    .products {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
}

@media (min-width: 960px) {
    .products {
        grid-template-columns: repeat(4, 1fr);
    }
}

.product-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.product-img {
    width: 100%;
    aspect-ratio: 4 / 3;
    background: #f4f4f4;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 6px;
}

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

.product-card h3 {
    font-size: 13px;
    line-height: 1.25;
    margin: 0 0 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 30px;
}

.meta {
    display: flex;
    flex-wrap: nowrap;
    gap: 3px;
    margin-bottom: 6px;
    min-height: 16px;
    overflow: hidden;
}

.meta .chip {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 8px;
    background: #eef;
    color: #334;
}

.meta .chip-veg {
    background: #e6f7e6;
    color: #2a6a2a;
}

.meta .chip-spicy {
    background: #ffefef;
    color: #a22;
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    margin-top: auto;
}

.price {
    font-weight: 700;
    font-size: 14px;
}

.product-footer .btn {
    padding: 0;
    min-height: 40px;
    min-width: 40px;
    font-size: 20px;
    line-height: 1;
    font-weight: 500;
    touch-action: manipulation;
}

/* ---------- empty ---------- */
.empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 32px 16px;
    background: #fff;
    border: 1px dashed #ddd;
    border-radius: 12px;
    color: #666;
    font-size: 14px;
}

.empty a {
    color: #a35a13;
    margin-top: 10px;
}

/* ---------- pagination ---------- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
    font-size: 14px;
}

.pagination .btn {
    min-width: 44px;
}

/* ---------- cart badge in header ---------- */
.cart-count {
    color: #ff8c42;
    font-weight: 700;
    margin-left: 3px;
}

/* ---------- toast (всплывашка «Добавлено ✓») ---------- */
.cart-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%) translateY(20px);
    background: #333;
    color: #fff;
    padding: 10px 18px;
    border-radius: 20px;
    font-size: 14px;
    opacity: 0;
    transition: opacity .2s, transform .2s;
    pointer-events: none;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .2);
    touch-action: manipulation;
    user-select: none;
}

.cart-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* test-cache-busting */