/* ================================================================
   КАТАЛОГ — ПУБЛІЧНА СІТКА
   ================================================================ */

/* ПК: 4 в ряд */
.catalog-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-top: 16px;
}

/* Планшет */
@media (max-width: 1024px) {
    .catalog-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Мобіла: 2 в ряд */
@media (max-width: 640px) {
    .catalog-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}

/* Картка */
.catalog-card {
    display: flex;
    flex-direction: column;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e8ddd0;
    background: #fff;
    transition: box-shadow 0.2s, transform 0.2s;
    color: inherit;
}
.catalog-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.10);
    transform: translateY(-2px);
    opacity: 1;
}

/* Зображення */
.catalog-card-img {
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #f5efe8;
}
.catalog-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}
.catalog-card:hover .catalog-card-img img { transform: scale(1.04); }

.catalog-card-noimg {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #ccc;
}

/* Інфо */
.catalog-card-info {
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.catalog-card-title {
    font-size: 14px;
    color: #2c2c2c;
    line-height: 1.4;
}

.catalog-card-price {
    font-size: 15px;
    font-weight: bold;
    color: #8B4513;
}
.catalog-card-noprice {
    font-size: 13px;
    font-weight: normal;
    color: #aaa;
}

/* Заголовки секцій */
.catalog-page-title,
.home-catalog-title {
    font-size: 22px;
    color: #2c2c2c;
    margin-bottom: 20px;
}

.catalog-page { padding-bottom: 40px; }
.home-catalog { margin-top: 48px; }
.catalog-empty { color: #aaa; font-size: 15px; }

/* ================================================================
   СТОРІНКА ТОВАРУ
   ================================================================ */

.item-page { padding-bottom: 48px; }

/* Назва — мобільна версія прихована на ПК */
.item-title-mobile { display: none; }
.item-title-desktop { display: block; }

/* Двоколонковий layout */
.item-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
    margin-top: 24px;
}

/* ── Галерея ── */
.item-main-photo {
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    background: #f5efe8;
    border: 1px solid #e8ddd0;
}
.item-main-photo img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
    transition: opacity 0.2s;
}
.item-no-photo {
    width: 100%;
    aspect-ratio: 4 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
    font-size: 14px;
}

/* Мініатюри */
.item-thumbs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}
.item-thumb {
    width: 72px;
    height: 72px;
    border: 2px solid #e0d6cc;
    border-radius: 5px;
    overflow: hidden;
    cursor: pointer;
    padding: 0;
    background: none;
    transition: border-color 0.15s;
    flex-shrink: 0;
}
.item-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.item-thumb.active  { border-color: #8B4513; }
.item-thumb:hover   { border-color: #a0522d; }

/* ── Права колонка ── */
.item-info {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.item-title {
    font-size: 26px;
    font-weight: bold;
    color: #2c2c2c;
    line-height: 1.3;
}

.item-price {
    font-size: 28px;
    font-weight: bold;
    color: #8B4513;
}

/* Кнопка кошик */
.btn-add-cart {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px;
    background: #2c2c2c;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-add-cart:hover  { background: #444; }
.btn-add-cart.added  { background: #2e7d32; }

.item-descr {
    font-size: 15px;
    line-height: 1.7;
    color: #444;
    border-top: 1px solid #eee;
    padding-top: 16px;
}

.item-back {
    font-size: 13px;
    color: #999;
    margin-top: 8px;
}
.item-back:hover { color: #2c2c2c; opacity: 1; }

/* ── МОБІЛА ── */
@media (max-width: 768px) {
    .item-title-mobile  { display: block; font-size: 20px; margin-bottom: 4px; }
    .item-title-desktop { display: none; }

    .item-layout {
        grid-template-columns: 1fr;
        gap: 20px;
        margin-top: 12px;
    }

    .item-price    { font-size: 22px; }
    .item-title    { font-size: 20px; }
    .btn-add-cart  { padding: 12px; font-size: 15px; }
    .item-thumbs   { gap: 6px; }
    .item-thumb    { width: 58px; height: 58px; }
}

.item-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #888;
    margin-bottom: 16px;
}
.item-back:hover { color: #2c2c2c; opacity: 1; }

@media (max-width: 768px) {
    .item-back {
        display: flex;
        justify-content: center;
        width: 100%;
        padding: 9px;
        border: 1px solid #ddd;
        border-radius: 4px;
        font-size: 14px;
        color: #555;
        margin-bottom: 12px;
    }
}

/* ================================================================
   КОШИК
   ================================================================ */
.cart-section { max-width: 760px; margin: 0 auto; padding-bottom: 48px; }
.cart-title   { font-size: 24px; margin-bottom: 24px; }

/* Порожній кошик */
.cart-empty { text-align: center; padding: 48px 20px; }
.cart-empty p { font-size: 16px; color: #aaa; margin-bottom: 20px; }
.cart-go-catalog { display: inline-block; text-decoration: none; }

/* Список */
/* Список — табличний layout */
.cart-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 24px;
}

/* Шапка таблиці */
.cart-header {
    display: grid;
    grid-template-columns: 1fr 120px 110px 110px 80px;
    gap: 0;
    padding: 8px 16px;
    font-size: 12px;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.cart-row {
    display: grid;
    grid-template-columns: 1fr 120px 110px 110px 80px;
    align-items: center;
    gap: 0;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 6px;
}

.cart-row > * { padding: 0 8px; }
.cart-row > *:first-child { padding-left: 0; }
.cart-row > *:last-child  { padding-right: 0; text-align: right; }

.cart-item-title  { font-size: 15px; color: #2c2c2c; }
.cart-item-title:hover { color: #8B4513; opacity: 1; }

.cart-item-price  { font-size: 13px; color: #999; }
.cart-qty         { display: flex; align-items: center; gap: 8px; justify-content: center; }
.cart-line-total  { font-size: 15px; font-weight: bold; color: #2c2c2c; text-align: right; }

.cart-qty-btn {
    width: 26px; height: 26px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    font-size: 15px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
    line-height: 1; flex-shrink: 0;
}
.cart-qty-btn:hover { background: #f0f0f0; }
.cart-qty-val { min-width: 20px; text-align: center; font-size: 15px; }

.cart-remove {
    background: none; border: none;
    color: #c0392b; font-size: 12px;
    cursor: pointer; padding: 4px 0;
    text-align: right; width: 100%;
    transition: opacity 0.15s;
}
.cart-remove:hover { opacity: 0.7; }

/* ── МОБІЛА ── */
@media (max-width: 600px) {
    .cart-header { display: none; }

    .cart-row {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto;
        padding: 12px;
        gap: 8px 0;
    }

    /* Рядок 1: назва зліва, видалити справа */
    .cart-item-title {
        grid-column: 1; grid-row: 1;
        padding: 0; font-size: 14px;
    }
    .cart-remove {
        grid-column: 2; grid-row: 1;
        text-align: right; padding: 0;
        font-size: 12px; width: auto;
    }

    /* Рядок 2: ціна/шт зліва, кількість і сума справа */
    .cart-item-price {
        grid-column: 1; grid-row: 2;
        padding: 0; align-self: center;
    }
    .cart-qty {
        grid-column: 2; grid-row: 2;
        justify-content: flex-end; gap: 6px;
    }
    .cart-line-total { display: none; } /* ховаємо — сума рядка в qty блоці */

    .cart-footer { flex-direction: column; align-items: stretch; }
    .cart-checkout { text-align: center; }
}

.cart-item-title {
    flex: 1;
    font-size: 15px;
    color: #2c2c2c;
    min-width: 140px;
}
.cart-item-title:hover { color: #8B4513; opacity: 1; }

.cart-item-price { font-size: 13px; color: #999; white-space: nowrap; }

/* Кількість */
.cart-qty { display: flex; align-items: center; gap: 8px; }

.cart-qty-btn {
    width: 28px;
    height: 28px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    line-height: 1;
}
.cart-qty-btn:hover { background: #f0f0f0; }

.cart-qty-val { min-width: 24px; text-align: center; font-size: 15px; }

.cart-line-total { font-size: 15px; font-weight: bold; color: #2c2c2c; white-space: nowrap; }

.cart-remove {
    background: none;
    border: none;
    color: #c0392b;
    font-size: 12px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 3px;
    transition: background 0.15s;
}
.cart-remove:hover { background: #fff0f0; }

/* Футер кошика */
.cart-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0;
    border-top: 2px solid #eee;
    gap: 16px;
    flex-wrap: wrap;
}

.cart-total { font-size: 18px; color: #2c2c2c; }
.cart-total strong { color: #8B4513; }

.cart-checkout {
    padding: 13px 28px;
    font-size: 15px;
    text-decoration: none;
    display: inline-block;
}

/* Кнопка "Вже в кошику" */
.btn-add-cart.added { background: #2e7d32; }
.btn-add-cart:disabled { cursor: default; }

/* Заглушка checkout */
.checkout-stub { color: #aaa; font-size: 15px; margin-bottom: 20px; }

/* Мобіла */
@media (max-width: 600px) {
    .cart-row { gap: 10px; padding: 12px; }
    .cart-item-title { min-width: 100%; }
    .cart-footer { flex-direction: column; align-items: stretch; }
    .cart-checkout { text-align: center; }
}

/* ================================================================
   ОФОРМЛЕННЯ ЗАМОВЛЕННЯ
   ================================================================ */
.checkout-section {
    max-width: 700px;
    margin: 0 auto;
    padding-bottom: 48px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* ── Рахунок ── */
.checkout-invoice {
    background: #fff;
    border: 1px solid #e0d6cc;
    border-radius: 8px;
    overflow: hidden;
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: #2c2c2c;
    color: #fff;
}
.invoice-brand { font-size: 16px; font-weight: bold; }
.invoice-label { font-size: 13px; color: #aaa; }

/* Рядки рахунку */
.invoice-items { padding: 0 24px; }

.invoice-row {
    display: grid;
    grid-template-columns: 28px 1fr 90px 110px 110px;
    gap: 0 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f0ebe5;
    align-items: center;
    font-size: 14px;
}
.invoice-row:last-child { border-bottom: none; }

.invoice-row-head {
    font-size: 11px;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 12px 0 8px;
    border-bottom: 2px solid #e0d6cc;
}

.inv-num   { color: #bbb; text-align: center; }
.inv-title { color: #2c2c2c; }
.inv-qty   { text-align: center; color: #666; }
.inv-pcs   { text-align: right; color: #888; }
.inv-total { text-align: right; font-weight: bold; color: #2c2c2c; }

/* Підсумки */
.invoice-totals { padding: 12px 24px 16px; border-top: 2px solid #e0d6cc; }

.invoice-total-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 16px;
    font-size: 18px;
}
.invoice-total-row strong { color: #8B4513; font-size: 20px; }

.invoice-note {
    padding: 12px 24px;
    background: #fdf6ee;
    font-size: 12px;
    color: #a08060;
    border-top: 1px solid #e0d6cc;
    line-height: 1.6;
}

/* ── Форма ── */
.checkout-form-wrap {
    background: #fff;
    border: 1px solid #e8e0d8;
    border-radius: 8px;
    padding: 24px;
}
.checkout-form-title { font-size: 18px; margin-bottom: 20px; color: #2c2c2c; }

.checkout-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.checkout-field label { font-size: 13px; color: #777; }
.field-required { font-size: 11px; color: #c0392b; margin-left: 4px; }

.checkout-field input,
.checkout-field textarea {
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
.checkout-field input:focus,
.checkout-field textarea:focus { border-color: #2c2c2c; }
.checkout-field textarea { resize: vertical; }

.checkout-error { color: #c0392b; font-size: 13px; min-height: 18px; margin-bottom: 8px; }

.checkout-submit { width: 100%; padding: 14px; font-size: 16px; }

/* ── Підтвердження ── */
.checkout-success {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
    padding: 48px 20px;
}
.success-icon {
    width: 64px; height: 64px;
    background: #2e7d32;
    color: #fff;
    border-radius: 50%;
    font-size: 28px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 20px;
}
.checkout-success h2 { font-size: 24px; margin-bottom: 12px; }
.success-msg { color: #666; font-size: 15px; margin-bottom: 28px; line-height: 1.6; }

.success-summary {
    text-align: left;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 20px 24px;
    margin-bottom: 24px;
}
.success-order-id { font-size: 13px; color: #aaa; margin-bottom: 14px; }

.success-items { margin-bottom: 12px; }
.success-item {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    padding: 6px 0;
    border-bottom: 1px solid #f5f5f5;
    color: #555;
}
.success-total {
    font-size: 16px;
    text-align: right;
    padding-top: 10px;
    margin-bottom: 14px;
}
.success-total strong { color: #8B4513; }
.success-contacts { font-size: 14px; color: #666; display: flex; flex-direction: column; gap: 4px; }

.success-back { display: inline-block; margin-top: 4px; }

/* Мобіла */
@media (max-width: 600px) {
    .invoice-row {
        grid-template-columns: 24px 1fr 70px 80px;
    }
    .inv-pcs { display: none; }
    .invoice-header { padding: 14px 16px; }
    .invoice-items  { padding: 0 16px; }
    .invoice-totals { padding: 12px 16px; }
    .invoice-note   { padding: 10px 16px; }
    .checkout-form-wrap { padding: 16px; }
}

/* ================================================================
   ЗАМОВЛЕННЯ
   ================================================================ */
.orders-section { max-width: 700px; margin: 0 auto; padding-bottom: 48px; }
.orders-title   { font-size: 24px; margin-bottom: 24px; }
.orders-empty   { color: #aaa; font-size: 15px; }
.orders-hint    { font-size: 14px; color: #666; margin-bottom: 8px; }

/* Список (залогінений) */
.orders-list { display: flex; flex-direction: column; gap: 4px; }
.order-row {
    display: grid;
    grid-template-columns: 90px 100px 80px 1fr 110px;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 6px;
    font-size: 14px;
}
.order-id    { font-weight: bold; color: #2c2c2c; }
.order-date  { color: #999; }
.order-total { font-weight: bold; color: #8B4513; }
.order-status { font-size: 12px; padding: 3px 10px; border-radius: 10px; text-align: center; }
.order-status-0 { background: #fff8e1; color: #f57c00; }
.order-status-1 { background: #e3f2fd; color: #1565c0; }
.order-status-2 { background: #e8f5e9; color: #2e7d32; }
.order-status-3 { background: #f5f5f5; color: #999; }

/* Форма гостя */
.orders-guest { max-width: 480px; }
.orders-hint-sub { font-size: 13px; color: #aaa; margin-bottom: 12px; }
.orders-search {
    display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px;
}
.orders-search input,
.orders-search select {
    padding: 9px 12px; border: 1px solid #ccc;
    border-radius: 4px; font-size: 14px; flex: 1; min-width: 120px;
}
.orders-register-hint { margin-top: 20px; font-size: 13px; color: #aaa; }

/* Деталі замовлення */
.order-detail { margin-top: 16px; background: #fff; border: 1px solid #eee; border-radius: 6px; padding: 16px; }
.order-detail-status { margin-bottom: 12px; font-size: 14px; }
.order-detail-row {
    display: flex; justify-content: space-between; gap: 12px;
    font-size: 14px; padding: 6px 0; border-bottom: 1px solid #f5f5f5; color: #555;
}
.order-search-error { color: #c0392b; font-size: 14px; margin-top: 8px; }
.orders-register-hint a { color: #8B4513; }

/* Іконка замовлень в меню */
.nav-orders {
    color: #fff; font-size: 14px;
    display: flex; align-items: center; gap: 4px;
}
.nav-orders:hover { opacity: 0.7; }
.orders-count {
    background: #8B4513; color: #fff;
    font-size: 11px; font-weight: bold;
    min-width: 18px; height: 18px;
    border-radius: 9px; display: flex;
    align-items: center; justify-content: center;
    padding: 0 4px;
}

@media (max-width: 600px) {
    .order-row { grid-template-columns: 80px 1fr 100px; }
    .order-date, .order-items { display: none; }
}

/* Промо реєстрації на сторінці замовлень */
.orders-reg-promo {
    background: #fdf6ee;
    border: 1px solid #e0c9a0;
    border-radius: 8px;
    padding: 20px 24px;
    margin-bottom: 24px;
    font-size: 15px;
    color: #5a3e1b;
    line-height: 1.6;
}
.orders-reg-btns {
    display: flex;
    gap: 10px;
    margin-top: 14px;
    flex-wrap: wrap;
}
.orders-reg-btns .btn-primary  { padding: 10px 22px; text-decoration: none; display: inline-block; }
.orders-reg-btns .btn-secondary { padding: 9px 20px; text-decoration: none; display: inline-block; }

.orders-track-wrap { margin-top: 8px; }
.orders-track-title { font-size: 14px; color: #888; margin-bottom: 10px; }

.orders-unreg { max-width: 480px; }

/* Клікабельний рядок замовлення */
.order-row-link { cursor: pointer; transition: background 0.15s; }
.order-row-link:hover { background: #fdf6ee; border-color: #e0c9a0; }

/* Деталі замовлення */
.order-detail-nav    { margin-bottom: 20px; }
.order-detail-header {
    display: flex; align-items: center; gap: 16px;
    margin-bottom: 20px; flex-wrap: wrap;
}
.order-detail-id   { font-size: 18px; font-weight: bold; }
.order-detail-date { font-size: 14px; color: #999; }

.order-detail-items {
    background: #fff; border: 1px solid #eee;
    border-radius: 6px; overflow: hidden;
    margin-bottom: 16px;
}
.order-detail-row {
    display: grid;
    grid-template-columns: 1fr 80px 120px 110px;
    gap: 12px; padding: 12px 16px;
    border-bottom: 1px solid #f5f5f5;
    font-size: 14px; align-items: center;
}
.order-detail-row:last-child { border-bottom: none; }
.order-detail-head {
    font-size: 11px; color: #aaa;
    text-transform: uppercase; letter-spacing: 0.04em;
    background: #fafafa; border-bottom: 1px solid #eee;
}
.order-detail-title { color: #2c2c2c; }
.order-detail-title:hover { color: #8B4513; opacity: 1; }
.order-detail-line-total { font-weight: bold; text-align: right; }

.order-detail-total {
    text-align: right; font-size: 18px;
    padding: 8px 0; margin-bottom: 12px;
}
.order-detail-total strong { color: #8B4513; }

.order-detail-note {
    font-size: 14px; color: #666;
    background: #fdf6ee; border-radius: 4px;
    padding: 10px 14px;
}

@media (max-width: 600px) {
    .order-detail-row { grid-template-columns: 1fr 60px 90px; }
    .order-detail-row span:nth-child(3) { display: none; }
}