/* ==================== ФОРМА ЗАКАЗА ==================== */

.order-wrap {
    background: var(--color-white);
    padding: 32px;
    border-radius: var(--radius-xl);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--color-border);
    margin-top: 30px;
}

.order-wrap a {
    color: var(--color-primary);
    transition: color 0.3s ease;
}

.form-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #142f3c;
    margin: 0 0 8px;
}

.form-sub {
    color: var(--color-text-muted);
    margin: 0 0 24px;
    font-size: 0.95rem;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #334155;
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.95rem;
    background: #f8fafc;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-secondary);
    background: var(--color-white);
    box-shadow: 0 0 0 3px rgba(243, 179, 61, 0.15);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* Кнопки */
.btn-submit {
    background: var(--color-secondary);
    color: var(--color-primary);
    border: none;
    padding: 14px 28px;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s ease;
    margin-top: 8px;
}

.btn-submit:hover {
    background: #ffc857;
    transform: scale(0.98);
}

/* Статусы формы */
.form-status {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 0.95rem;
    font-weight: 500;
}

.form-status.success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.form-status.error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Material UI стиль input */
.input-group {
    position: relative;
    margin-top: 16px;
    margin-bottom: 8px;
}

.input-mui {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.4375em;
    color: rgba(0, 0, 0, 0.87);
    background-color: transparent;
    border: 1px solid rgba(0, 0, 0, 0.23);
    border-radius: 16px;
    outline: none;
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.label-mui {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: rgba(0, 0, 0, 0.6);
    background-color: transparent;
    padding: 0 4px;
    pointer-events: none;
    transition: 0.2s ease all;
    transform-origin: left top;
}

.input-mui:focus {
    border-color: var(--color-secondary);
    border-width: 2px;
    padding: 15.5px 13px;
}

.input-mui:focus + .label-mui,
.input-mui:not(:placeholder-shown) + .label-mui {
    top: 0;
    transform: translateY(-50%) scale(0.75);
    color: var(--color-secondary);
    background-color: var(--color-white);
}

.input-mui:not(:placeholder-shown) + .label-mui {
    top: 0;
    transform: translateY(-50%) scale(0.75);
    color: rgba(0, 0, 0, 0.6);
}

/* Состояние ошибки */
.input-mui.error {
    border-color: #d32f2f;
}

.input-mui.error:focus {
    border-color: #d32f2f;
}

.input-mui.error + .label-mui {
    color: #d32f2f;
}

/* Отключённое состояние */
.input-mui:disabled {
    border-color: rgba(0, 0, 0, 0.12);
    color: rgba(0, 0, 0, 0.38);
}

.input-mui:disabled + .label-mui {
    color: rgba(0, 0, 0, 0.38);
}

/* ==================== АДАПТИВНОСТЬ ==================== */

@media (max-width: 768px) {
    .order-wrap {
        padding: 24px 20px;
    }
}






/* ==================== БЛОК КОМПЛЕКТУЮЩИХ В ФОРМЕ ==================== */

.accessories-block-title {
    font-weight: 600;
    color: #334155;
    font-size: 0.95rem;
    margin-bottom: 12px;
    display: block;
}

.accessories-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: visible;
}

/* Главный контейнер строки комплектующего */
.accessory-item {
    display: flex; /* Выстраивает всё в одну строку */
    flex-wrap: wrap; /* Разрешает перенос только на очень маленьких экранах */
    align-items: center; /* Выравнивает всё по вертикальному центру */
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    transition: all 0.2s ease;
    overflow: visible;
}

.accessory-item.has-preview {
    position: relative;
    cursor: help;
}

.accessory-item.active {
    background: #fef3c7;
    border-color: #f59e0b;
}

/* Обертка для чекбокса, названия и цены */
.accessory-checkbox-label {
    display: inline-flex; /* Гарантирует одну строку */
    align-items: center;
    gap: 10px;
    cursor: pointer;
    flex: 1;
    min-width: 200px;
    margin: 0; /* Сброс возможных внешних отступов */
}

/* Сам чекбокс */
.accessory-checkbox {
    width: 18px;
    height: 18px;
    accent-color: #f3b33d;
    cursor: pointer;
    margin: 0 !important; /* Убираем стандартные отступы браузера */
    flex-shrink: 0; /* Запрещаем чекбоксу сжиматься */
}

.accessory-name {
    font-weight: 500;
    color: #1e293b;
    white-space: nowrap; /* Запрещаем перенос названия, если возможно */
}

.accessory-price {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 600;
    white-space: nowrap; /* Цена всегда в одну строку */
}

.accessory-price.free {
    color: #10b981;
    font-style: italic;
}

/* Поле количества */
.accessory-qty-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.accessory-qty-wrap label {
    font-size: 0.85rem;
    color: #64748b;
    margin: 0;
    white-space: nowrap;
}

.accessory-qty {
    width: 50px !important;
    padding: 4px 6px !important;
    font-size: 0.9rem !important;
    text-align: center;
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    background: #f8fafc !important;
}

.accessory-qty-unit {
    font-size: 0.85rem;
    color: #64748b;
}

/* Сумма по позиции */
.accessory-subtotal {
    font-weight: 700;
    color: #d97706;
    font-size: 1rem;
    min-width: 80px;
    text-align: right;
    flex-shrink: 0;
}

/* Итоговая сумма */
.accessories-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding: 14px 18px;
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 2px solid #fbbf24;
    border-radius: 12px;
}

.total-label {
    font-weight: 600;
    color: #92400e;
    font-size: 1rem;
}

.total-amount {
    font-size: 1.3rem;
    font-weight: 700;
    color: #d97706;
}

/* Превью фото комплектующего при наведении */
.accessory-preview {
    display: none;
    position: absolute;
    right: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    padding: 8px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
    pointer-events: none;
}

.accessory-item.has-preview:hover .accessory-preview {
    display: block;
}

.accessory-preview-img {
    display: block;
    width: 600px;
    max-width: min(600px, 40vw);
    height: auto;
    max-height: 600px;
    object-fit: contain;
    border-radius: 8px;
}

/* Адаптивность: на мобильных разрешаем перенос для удобства нажатия */
@media (max-width: 600px) {
    .accessory-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .accessory-checkbox-label {
        width: 100%;
        min-width: auto;
    }
    .accessory-name {
        white-space: normal; /* На мобильных название может переноситься */
    }
    .accessory-qty-wrap {
        width: 100%;
        justify-content: space-between;
    }
    .accessory-subtotal {
        width: 100%;
        text-align: left;
        border-top: 1px solid #e2e8f0;
        padding-top: 8px;
    }

    .accessory-preview {
        right: auto;
        left: 0;
        top: 100%;
        transform: translateY(8px);
    }
}