/* =============================================================
   COMPONENT / PRODUCT-ITEM
   
   Карточка хотелки (модели под заказ).
   Похожа на unit-container, но компактнее — нет характеристик.
   ============================================================= */

/* ---------------------------------------------------------
   КОНТЕЙНЕР
   --------------------------------------------------------- */

.product-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    background-color: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    box-shadow: var(--shadow-surface);
}

/* ---------------------------------------------------------
   ОСНОВНАЯ СЕТКА: детали слева, aside справа
   --------------------------------------------------------- */

.product-main {
    display: grid;
    grid-template-columns: 1fr max-content;
    gap: var(--space-5);
    align-items: center;
}

.product-details {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    min-width: 0;
    /* критично для обрезки длинного текста */
}

.product-container .product-media {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    background-color: var(--bg-surface-alt);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding-top: 0;
    /* Перебиваем padding-top: 100% из product-card.css */
}

.product-container .product-media img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    mix-blend-mode: darken;
}

.product-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    min-width: 0;
}

.product-container .product-title {
    font-size: var(--fs-md);
    font-weight: var(--fw-semibold);
    color: var(--text-primary);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
    /* Так как это теперь <a> */
}

/* ---------------------------------------------------------
   ASIDE (правая колонка)
   --------------------------------------------------------- */

.product-container .product-aside {
    display: flex;
    align-items: center;
    gap: var(--space-5);
}

.product-container .product-price {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    white-space: nowrap;
}

.product-container .product-price .price-old {
    font-size: var(--fs-sm);
    color: var(--text-secondary);
}

.product-price .price-actual {
    font-size: var(--fs-lg);
    font-weight: var(--fw-bold);
    color: var(--text-primary);
}

.product-price .price-input {
    width: 100px;
    padding: var(--space-1);
    text-align: right;
    font-size: var(--fs-lg);
    font-weight: var(--fw-bold);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
}

.product-price .price-input:hover {
    border-color: var(--border-default);
}

.product-price .price-input:focus {
    background-color: var(--blue-100);
    border-color: var(--blue-500);
    outline: none;
}

.product-subtotal {
    font-weight: var(--fw-semibold);
    min-width: 100px;
    text-align: right;
    white-space: nowrap;
}

/* ---------------------------------------------------------
   ИНПУТ КОЛИЧЕСТВА С КНОПКАМИ ±
   --------------------------------------------------------- */

.product-quantity {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    overflow: hidden;
    height: var(--control-h-md);
}

.product-quantity input[type="number"] {
    width: 48px;
    height: 100%;
    text-align: center;
    border: none;
    background: transparent;
    font-weight: var(--fw-medium);
    font-size: var(--fs-md);
    padding: 0;
}

/* Скрываем нативные спиннеры */
.product-quantity input[type="number"]::-webkit-outer-spin-button,
.product-quantity input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.product-quantity input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.qty-btn {
    width: var(--control-h-md);
    height: 100%;
    background: var(--bg-surface-alt);
    border: none;
    cursor: pointer;
    font-size: var(--fs-lg);
    line-height: 1;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--duration-fast) var(--ease-default);
    user-select: none;
}

.qty-btn:hover {
    background: var(--neutral-300);
}

.qty-btn:active {
    background: var(--neutral-500);
    color: var(--fg-on-accent);
}

/* ---------------------------------------------------------
   ОБЁРТКА КНОПОК ДЕЙСТВИЯ
   --------------------------------------------------------- */

.product-action-wrapper {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* Страница товара: кнопка добавления и блок «в корзине» */
.product-add-wrapper {
    display: flex;
}

.product-add-wrapper,
.product-in-cart-wrapper {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* Чтобы кнопки и инпут не растягивались */
.product-action-wrapper .btn {
    flex-shrink: 0;
}

/* ---------------------------------------------------------
   МОБИЛЬНАЯ ВЕРСИЯ
   --------------------------------------------------------- */

@media (max-width: 767px) {
    .product-main {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .product-aside {
        flex-wrap: wrap;
        justify-content: space-between;
        width: 100%;
        gap: var(--space-3);
    }

    .product-title {
        white-space: normal;
    }
}