/* Универсальный конфигуратор - стили */

*, *::before, *::after {
    box-sizing: border-box;
}

.order-form {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow-x: hidden;
}

.order-form__header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #007bff;
}

.order-form__header h2 {
    color: #007bff;
    margin-bottom: 15px;
    font-size: 28px;
    font-weight: 600;
}

.order-form__top-input-wrapper {
    display: flex;
    justify-content: center;
    gap: 20px;
    align-items: center;
}

.order-form__top-input {
    text-align: center;
    font-weight: bold;
    color: #007bff;
}

.step-container {
    margin-bottom: 30px;
    /* padding: 25px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #f9f9f9; */
}

.step-container h3 {
    color: #333;
    margin-bottom: 20px;
    font-size: 22px;
    font-weight: 600;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
}

.order-form__row {
    margin-bottom: 20px;
    align-items: start;
}

.order-form__label {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
    display: block;
}

.order-form__label-wrapper {
    display: flex;
    flex-direction: column;
}

.order-form__required {
    color: #dc3545;
    font-size: 12px;
    font-weight: normal;
    margin-top: 2px;
}

.form-control {
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 14px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    border-color: #007bff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.step-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

.btn {
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s ease-in-out;
}

.btn-primary {
    color: #fff;
    background-color: #007bff;
    border-color: #007bff;
}

.btn-primary:hover {
    background-color: #0056b3;
    border-color: #004085;
}

.btn-secondary {
    color: #fff;
    background-color: #6c757d;
    border-color: #6c757d;
}

.btn-secondary:hover {
    background-color: #545b62;
    border-color: #4e555b;
}

.btn-success {
    color: #fff;
    background-color: #28a745;
    border-color: #28a745;
}

.btn-success:hover {
    background-color: #1e7e34;
    border-color: #1c7430;
}

/* Модальные окна */
.order-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Bootstrap модальные окна */
.modal {
    display: none;
}

.modal.show {
    display: block;
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    width: 100vw;
    height: 100vh;
    background-color: #000;
    opacity: 0.5;
}

.order-modal_bg {
    background-color: rgba(0, 0, 0, 0.5);
}

.order-modal__content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    text-align: center;
}

.order-modal__title {
    color: #333;
    margin-bottom: 20px;
    font-size: 20px;
    font-weight: 600;
}

.order-modal__list {
    text-align: left;
    margin-bottom: 25px;
    padding-left: 20px;
}

.order-modal__list li {
    margin-bottom: 8px;
    color: #555;
}

.order-modal__button-wrapper {
    margin-top: 20px;
}

.order-modal__button-closse {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.order-modal__button-closse:hover {
    background-color: #0056b3;
}

.display-n {
    display: none !important;
}

/* Параметры узла */
.node-parameters {
    background: #fff;
    padding: 20px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    margin-top: 15px;
}

.parameter-group {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.parameter-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.parameter-group h4 {
    color: #007bff;
    font-size: 16px;
    margin-bottom: 10px;
    font-weight: 600;
}

/* Схема узла */
.node-scheme {
    text-align: center;
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
}

.node-scheme img {
    max-width: 100%;
    height: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Таблица спецификации */
.specification-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    background: #fff;
}

.specification-table th,
.specification-table td {
    border: 1px solid #ddd;
    padding: 8px 12px;
    text-align: left;
}

.specification-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.specification-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

/* Список добавленных узлов */
.added-nodes {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.added-nodes h4 {
    color: #007bff;
    margin-bottom: 15px;
    font-size: 18px;
}

.added-node {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: box-shadow 0.2s ease;
}

.added-node:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.added-node-info {
    flex-grow: 1;
}

.added-node-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 16px;
}

.added-node-details {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}

.added-node-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.edit-node {
    background-color: #ffc107;
    color: #212529;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
}

.edit-node:hover {
    background-color: #e0a800;
    color: #212529;
}

.remove-node {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
}

.remove-node:hover {
    background-color: #c82333;
}

/* Схема узла */
.node-scheme {
    text-align: center;
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    width: 100%;
    overflow: auto; /* Добавляем прокрутку для больших схем */
    max-height: 80vh; /* Ограничиваем высоту */
}

.node-scheme img {
    width: 100%;
    max-width: 100%;
    height: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.node-scheme p {
    margin: 10px 0 0 0;
    color: #666;
    font-style: italic;
}

/* Контейнер схемы */
.scheme-container {
    width: 100%;
    margin: 20px 0;
    text-align: center;
    overflow: auto;
}

.scheme-image {
    max-width: 100%;
    height: auto;
    border: 1px solid #ddd;
    border-radius: 8px;
    display: block;
    margin: 0 auto;
    /* Убираем фиксированную ширину, чтобы сохранить пропорции */
}

/* Контейнер для canvas схемы */
.scheme-canvas-container {
    width: 100%;
    margin: 20px 0;
    text-align: center;
    overflow: auto;
}

.scheme-placeholder {
    width: 100%;
    height: 300px;
    background: #f8f9fa;
    border: 2px dashed #ddd;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

.display-y {
    display: block !important;
}

/* Radio кнопки */
.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.btn-check {
    position: absolute;
    clip: rect(0, 0, 0, 0);
    pointer-events: none;
}

.btn-check:checked + .btn-outline-primary {
    background-color: #007bff;
    border-color: #007bff;
    color: #fff;
}

.btn-outline-primary {
    color: #007bff;
    border-color: #007bff;
    background-color: transparent;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    font-size: 14px;
    border: 1px solid;
}

.btn-outline-primary:hover {
    background-color: #007bff;
    border-color: #007bff;
    color: #fff;
}


/* Анимации */
.step-container {
    transition: all 0.3s ease-in-out;
}

.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nodes-list .node-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 12px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    background-color: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.nodes-list .node-item__info {
    flex: 1 1 auto;
    min-width: 0;
}

.nodes-list .node-item__actions {
    flex: 0 0 auto;
    display: flex;
    gap: 8px;
}

/* Строка: количество + кнопки в одну линию */
.node-item__actions-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

/* Кнопки действий шага 3 */
.step3-action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 4px;
}

/* Анимация для кнопки загрузки PDF */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.rotating {
    animation: spin 1s linear infinite;
}

/* Стили для кнопок скачивания */
#downloadSchemeBtn, #downloadSchemePDFBtn {
    transition: all 0.3s ease;
    position: relative;
}

#downloadSchemeBtn:hover, #downloadSchemePDFBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

#downloadSchemePDFBtn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Улучшенные стили для схемы */
.scheme-image {
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin: 10px 0;
}


/* Адаптивность */

@media (min-width: 832px) {
    .container {
        width: 90%!important;
        margin-left: auto;
        margin-right: auto;
    }
}

@media (max-width: 768px) {
    /* Общий контейнер */
    .order-form {
        padding: 12px;
        box-shadow: none;
        border-radius: 0;
    }

    /* Заголовок */
    .order-form__header h2 {
        font-size: 16px;
    }

    .order-form__top-input-wrapper {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .order-form__top-left {
        white-space: normal;
        width: 100%;
    }

    /* Ширина инпутов шапки */
    .order-form__top-input-wrapper .form-control {
        min-width: 0;
        width: 100%;
    }

    /* Заголовки шагов */
    .step-container h3 {
        font-size: 15px;
    }

    /* Кнопки навигации */
    .step-buttons {
        flex-direction: column;
        gap: 10px;
    }

    .step-buttons .btn {
        width: 100%;
    }

    /* Сетка параметров — одна колонка */
    .params-compact-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    /* Блок параметра */
    .param-block {
        padding: 8px 10px;
    }

    /* Строка артикула — перенос */
    .articul-compact-row {
        flex-wrap: wrap;
        gap: 6px;
    }

    .articul-compact-row label {
        flex: 0 0 auto;
    }

    .articul-compact-row input {
        flex: 1 1 100%;
        min-width: 0;
    }

    /* Узлы в списке — карточка на всю ширину */
    .nodes-list .node-item {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px;
    }

    .nodes-list .node-item__info {
        width: 100%;
    }

    .nodes-list .node-item__actions {
        width: 100%;
    }

    /* На мобильном: количество сверху, кнопки снизу */
    .node-item__actions-row {
        width: 100%;
        flex-wrap: wrap;
        gap: 8px;
    }

    /* Строка с количеством занимает полную ширину */
    .node-item__actions-row .node-quantity-wrapper {
        flex: 0 0 100%;
    }

    /* Кнопки делят строку поровну */
    .node-item__actions-row .btn {
        flex: 1 1 calc(50% - 4px);
        text-align: center;
        white-space: nowrap;
    }

    /* Кнопки шага 3 — каждая на всю ширину */
    .step3-action-buttons {
        flex-direction: column;
        gap: 8px;
    }

    .step3-action-buttons .btn {
        width: 100%;
    }

    /* Схема */
    .node-scheme {
        padding: 8px;
    }

    /* Модальное окно */
    .order-modal__content {
        padding: 16px;
        width: 95%;
    }

    /* Bootstrap col-md-6 — полная ширина */
    .order-form__row.row > [class*="col-md"] {
        padding-left: 6px;
        padding-right: 6px;
    }

    .header {
        padding: 20px;
    }
}