/* ===== КАЛЬКУЛЯТОР ===== */
.calculator__wrapper {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 30px;
    margin: 50px 0;
}

.category-block {
    background: var(--bg-card);
    border-radius: var(--border-radius-md);
    margin-bottom: 20px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.category-header {
    padding: 15px 20px;
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.category-header:hover {
    background: var(--primary-dark);
}

.category-header i {
    transition: transform 0.3s ease;
}

.category-products {
    padding: 20px;
    transition: all 0.3s ease;
}

/* Карточка товара */
.product-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    background: var(--bg-card);
    border-radius: var(--border-radius-md);
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}

.product-row:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

/* Верхняя строка с названием и ценой */
.product-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-card));
    padding: 8px 12px;
    border-radius: 30px;
    border: 1px solid var(--border-color);
}

.product-title-row .product-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    padding: 0 5px;
}

.product-title-row .product-price {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 0.95rem;
    background: rgba(255, 107, 53, 0.1);
    padding: 4px 12px;
    border-radius: 20px;
    white-space: nowrap;
}

/* Блок с выбором цвета и количеством */
.product-controls-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

/* Изображение товара */
.product-image-container {
    flex: 0 0 50px;
}

.product-image-thumb {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
    cursor: pointer;
    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease;
    border: 2px solid transparent;
}

.product-image-thumb:hover {
    transform: scale(2.1);
    box-shadow: 0 5px 15px rgba(255, 107, 53, 0.3);
    border-color: var(--primary-color);
}

/* Увеличенное изображение */
.product-image-zoom {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    opacity: 0;
    transition:
        transform 0.3s ease,
        opacity 0.3s ease;
    pointer-events: none;
}

.product-image-zoom.active {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.product-image-zoom-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.product-image-zoom-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Выбор цвета */
.product-color-selector {
    flex: 1;
    min-width: 140px;
}

.product-color-selector select {
    width: 100%;
    height: 38px;
    border: 2px solid var(--border-color);
    border-radius: 30px;
    padding: 0 12px 0 16px;
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff6b35' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-color-selector select:hover {
    border-color: var(--primary-color);
}

.product-color-selector select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

/* Блок ввода количества */
.quantity-block {
    display: flex;
    gap: 10px;
    flex: 2;
    min-width: 200px;
}

.quantity-input-wrapper {
    flex: 3;
    display: flex;
    align-items: center;
    background: var(--input-bg);
    border: 2px solid var(--border-color);
    border-radius: 30px;
    overflow: hidden;
    transition: border-color var(--transition-fast);
}

.quantity-input-wrapper:hover {
    border-color: var(--primary-color);
}

.quantity-input-wrapper:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.quantity-input {
    width: 0;
    flex: 1;
    height: 38px;
    padding: 0 12px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
}

.quantity-input:focus {
    outline: none;
}

.quantity-input::placeholder {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 400;
    font-style: italic;
}

.quantity-unit {
    display: inline-block;
    padding: 0 12px;
    height: 38px;
    line-height: 38px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    border-left: 2px solid var(--border-color);
    white-space: nowrap;
}

.add-to-cart-btn {
    flex: 1;
    padding: 8px !important;
    min-width: 40px;
}

/* Корзина */
.calculator__cart {
    background: var(--bg-card);
    border-radius: var(--border-radius-md);
    padding: 20px;
    position: sticky;
    top: 100px;
    height: fit-content;
    border: 1px solid var(--border-color);
}

.cart-items {
    max-height: 400px;
    overflow-y: auto;
    margin: 20px 0;
    padding-right: 5px;
}

.cart-items::-webkit-scrollbar {
    width: 6px;
}

.cart-items::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
}

.cart-items::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

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

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

.cart-item-info {
    flex: 1;
}

.cart-item-name {
    font-weight: 500;
    margin-bottom: 4px;
    font-size: 14px;
}

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

.cart-item-price {
    font-weight: bold;
    color: var(--primary-color);
    margin: 0 10px;
    font-size: 15px;
    white-space: nowrap;
}

.cart-item-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 0 5px;
    transition: color 0.2s;
}

.cart-item-remove:hover {
    color: var(--danger-color);
}

.cart-totals {
    margin: 20px 0;
    padding: 20px 0;
    border-top: 2px solid var(--border-color);
}

.discount-row {
    display: flex;
    justify-content: space-between;
    margin: 5px 0;
    font-size: 15px;
    color: var(--success-color);
}

.final-row {
    display: flex;
    justify-content: space-between;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

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

/* Форма заказа */
.order-form {
    background: var(--bg-card);
    border-radius: var(--border-radius-md);
    padding: 30px;
    margin-top: 30px;
    border: 1px solid var(--border-color);
}

.order-form h3 {
    margin-bottom: 20px;
    color: var(--primary-color);
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

/* Адаптивность */
@media (max-width: 992px) {
    .calculator__wrapper {
        grid-template-columns: 1fr;
    }

    .calculator__cart {
        position: static;
        margin-top: 20px;
    }
}

@media (max-width: 768px) {
    .product-controls-row {
        flex-direction: column;
        align-items: stretch;
    }

    .product-color-selector,
    .quantity-block {
        width: 100%;
        min-width: 100%;
    }

    .product-title-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 12px;
    }

    .product-title-row .product-price {
        align-self: flex-start;
    }

    .form-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .category-header {
        padding: 12px 15px;
        font-size: 14px;
    }

    .product-row {
        padding: 12px;
    }

    .product-title-row .product-name {
        font-size: 0.9rem;
    }

    .product-title-row .product-price {
        font-size: 0.85rem;
        padding: 3px 8px;
    }

    .cart-item-name {
        font-size: 13px;
    }

    .cart-item-price {
        font-size: 13px;
    }
}
