/* ===== КАТАЛОГ ===== */

body {
    background: var(--bg);
}


.catalog-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 20px 40px;
}

/* ===== ШАПКА КАТАЛОГА ===== */
.catalog-header {
    text-align: left;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.catalog-header h1 {
    font-size: 22px;
    color: var(--text);
    margin-bottom: 6px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.catalog-header .subtitle {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 0;
}

/* ===== КНОПКИ В ШАПКЕ (desktop) ===== */
.cart-button,
.unlock-button {
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-family: "IBM Plex Mono", monospace;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Корзина — контурная */
.cart-button {
    background: var(--surface);
    color: var(--text);
    border: 1.5px solid var(--text);
}

.cart-button:hover {
    background: var(--text);
    color: white;
}

/* Открыть замок — красная */
.unlock-button {
    background: var(--primary);
    color: white;
}

.unlock-button:hover {
    background: var(--primary-hover);
}

#cart-count {
    background: var(--primary);
    color: white;
    padding: 1px 7px;
    border-radius: 10px;
    margin-left: 6px;
    font-size: 11px;
    font-weight: 700;
    display: inline-block;
    min-width: 20px;
    text-align: center;
}

/* ===== СЕТКА ТОВАРОВ ===== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.product-card {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    box-shadow: var(--shadow-md);
}

.card-out-of-stock {
    opacity: 0.7;
}

.product-image-wrap {
    width: 100%;
    height: 200px;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
    position: relative;
}

.product-image {
    max-width: 100%;
    max-height: 200px;
    width: 100%;
    height: 200px;
    object-fit: contain;
    display: block;
    padding: 8px;
}

.product-image-placeholder {
    font-size: 48px;
    color: var(--border);
}

.product-info {
    padding: 14px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-info h3 {
    font-size: 14px;
    color: var(--text);
    margin-bottom: 4px;
    font-weight: 700;
}

.product-description {
    color: var(--text-muted);
    font-size: 12px;
    margin-bottom: 8px;
    flex: 1;
}

.product-characteristics {
    background: var(--bg);
    padding: 6px 10px;
    border-radius: var(--radius);
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 8px;
    white-space: pre-line;
    border: 1px solid var(--border);
    font-family: "IBM Plex Mono", monospace;
}

.product-stock {
    color: var(--success);
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 10px;
}

.product-stock::before {
    content: "● ";
    font-size: 10px;
}

.product-stock.out-of-stock {
    color: var(--error);
}

.out-of-stock-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--error);
    text-transform: uppercase;
    letter-spacing: 1px;
    backdrop-filter: blur(1px);
    font-family: "IBM Plex Mono", monospace;
}

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

.quantity-input {
    width: 52px;
    padding: 8px 6px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    text-align: center;
    font-family: "IBM Plex Mono", monospace;
}

.quantity-input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.12);
}

.btn-add-to-cart {
    flex: 1;
    padding: 8px 10px;
    font-size: 11px;
    width: auto;
}

.empty-catalog {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 14px;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

/* ===== МОДАЛЬНЫЕ ОКНА ===== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--surface);
    border-radius: var(--radius);
    width: 100%;
    max-width: 520px;
    min-height: 300px;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 18px 24px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-header h2 {
    font-size: 16px;
    color: var(--text);
    margin: 0;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.modal-body {
    padding: 20px 24px;
    flex: 1;
}

.close-btn {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.15s;
    line-height: 1;
    font-family: "IBM Plex Mono", monospace;
}

.close-btn:hover {
    background: var(--bg);
    color: var(--text);
}

/* ===== КОРЗИНА ===== */
.cart-items {
    padding: 16px 24px;
    max-height: 340px;
    overflow-y: auto;
    flex: 1;
}

.empty-cart {
    text-align: center;
    color: var(--text-muted);
    padding: 32px 20px;
    font-size: 13px;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item-info {
    flex: 1;
    min-width: 0;
}

.cart-item-name {
    font-weight: 700;
    color: var(--text);
    margin-bottom: 2px;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item-quantity {
    color: var(--text-muted);
    font-size: 12px;
}

.cart-item-remove {
    background: none;
    color: var(--primary);
    border: 1px solid var(--primary);
    padding: 4px 10px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    margin-left: 12px;
    flex-shrink: 0;
    transition: background 0.15s;
    font-family: "IBM Plex Mono", monospace;
    text-transform: uppercase;
}

.cart-item-remove:hover {
    background: var(--error-bg);
}

.cart-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.cart-total {
    font-size: 13px;
    margin-bottom: 14px;
    color: var(--text-muted);
}

.cart-total strong {
    color: var(--text);
}

.btn-checkout {
    width: 100%;
}

/* ===== ФОРМА ОФОРМЛЕНИЯ ===== */
.checkout-form-body {
    padding: 20px 24px;
}

.order-summary {
    background: var(--bg);
    padding: 12px 14px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

.order-summary h3 {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.order-summary-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.order-summary-item:last-child {
    border-bottom: none;
}

/* ===== АДАПТИВНОСТЬ ===== */
@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .catalog-container {
        padding: 24px 14px 32px;
    }

    .catalog-header h1 {
        font-size: 18px;
    }
}

@media (max-width: 600px) {
    .site-header .header-actions {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        transform: none;
        display: flex;
        gap: 0;
        z-index: 200;
    }

    .cart-button,
    .unlock-button {
        border-radius: 0;
        padding: 14px 10px;
        font-size: 11px;
        width: 50%;
        text-align: center;
        border: none;
        box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
    }

    .unlock-button {
        background: var(--primary);
        color: white;
        border-right: 1px solid rgba(255,255,255,0.2);
    }

    .cart-button {
        background: var(--surface);
        color: var(--text);
        border-top: 1px solid var(--border);
        border-left: 1px solid var(--border);
    }

    .catalog-container {
        padding: 24px 12px 80px;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .product-image-wrap {
        height: 160px;
    }

    .product-image {
        height: 160px;
        max-height: 160px;
    }

    .modal {
        padding: 0;
        align-items: flex-end;
    }

    .modal-content {
        border-radius: var(--radius) var(--radius) 0 0;
        max-height: 90vh;
        min-height: unset;
    }
}
