/* Оптовые заказы на сайте — стили фронта */

.wswo-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding-bottom: 30px; /* место под закреплённый снизу блок */
}

.wswo-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.wswo-btn {
    border: 1px solid #ccc;
    background: #f7f7f7;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.wswo-btn:hover {
    background: #eee;
}

.wswo-btn-toggle-selected[data-active="1"] {
    background: #007cba;
    border-color: #007cba;
    color: #fff;
}

.wswo-btn--loading {
    position: relative;
    opacity: 0.9;
    cursor: wait;
    padding-left: 30px;
    background: #007cba;
    border-color: #007cba;
    color: #fff;
}


/* Круглый спиннер слева в кнопке */
.wswo-btn--loading::before {
    content: "";
    position: absolute;
    left: 10px;
    top: 50%;
    width: 14px;
    height: 14px;
    margin-top: -7px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-top-color: transparent;
    border-right-color: transparent;
    animation: wswoBtnSpin 0.6s linear infinite;
}

@keyframes wswoBtnSpin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.wswo-toc {
    margin-bottom: 20px;
}

.wswo-toc a {
    text-decoration: none;
    border-bottom: 1px dotted #666;
}

.wswo-toc-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    margin-bottom: 5px;
}

.wswo-toc-title {
    margin: 0;
    font-size: 18px;
    flex: 0 0 auto;
}

.wswo-toc-toggle {
    border: 1px solid #ccc;
    background: #f7f7f7;
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.wswo-toc-list {
    margin: 0;
    padding-left: 20px;
}

.wswo-toc-item {
    margin-bottom: 3px;
}

.wswo-toc.wswo-toc--collapsed .wswo-toc-list {
    display: none;
}

.wswo-category {
    margin-bottom: 30px;
}

.wswo-category-title {
    font-size: 20px;
    margin: 0 0 10px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
}

.wswo-category-table-wrapper {
    overflow-x: auto;
}

.wswo-products-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

/* Строка с выбранным количеством — красим все ячейки */
.wswo-row-selected > td {
    background-color: #e7f8e7 !important;
}

/* Категория, в которой есть выбранные товары */
.wswo-category--has-selected .wswo-category-toggle {
    background-color: #e8f7e8; /* поставь здесь тот же цвет, что у строки выбранного товара */
/*    border-color: #e8f7e8;     опционально */
}


/* Вспышка при изменении цены */
@keyframes wswoPriceFlash {
    0% {
        background-color: #fff7c2;
    }
    100% {
        background-color: transparent;
    }
}

.wswo-price-flash {
    animation: wswoPriceFlash 0.4s ease-out;
}

.wswo-products-table th,
.wswo-products-table td {
    border: 1px solid #ddd;
    padding: 6px 8px;
    vertical-align: middle !important;
}

.wswo-products-table thead {
    background: #f5f5f5;
}

.wswo-col-product {
    width: 60%;
}

.wswo-product-main {
    display: flex;
    gap: 10px;
    align-items: center;
}

.wswo-product-image img {
    max-width: 60px;
    max-height: 60px;
    display: block;
}

.wswo-product-title {
    font-weight: 600;
}

.wswo-product-price-current {
    font-weight: 600;
}

.wswo-product-price-old {
    margin-left: 6px;
    text-decoration: line-through;
    color: #999;
    display: none;
}

.wswo-product-price-old.wswo-price-old--visible {
    display: inline;
}

.wswo-col-price,
.wswo-col-stock,
.wswo-col-qty,
.wswo-col-sum {
    text-align: center;
    white-space: nowrap;
}

.wswo-qty-control {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.wswo-qty-btn {
    border: 1px solid #ccc;
    background: #f7f7f7;
    padding: 2px 6px;
    cursor: pointer;
    border-radius: 3px;
    font-size: 14px;
}

.wswo-qty-btn:hover {
    background: #eee;
}

.wswo-qty-input {
    width: 60px;
    text-align: center;
}

.wswo-product-link-arrow {
    margin-left: 4px;
    text-decoration: none;
    font-size: 14px;
}

.wswo-product-link-arrow:hover {
    text-decoration: underline;
}

.wswo-row-hidden {
    display: none;
}

.wswo-btn-active,
.wswo-btn-toggle-selected[data-active="1"] {
    background: #007cba;
    border-color: #007cba;
    color: #fff;
}

/* Скрываем колонку "Запас" визуально, но оставляем HTML для JS */
.wswo-col-stock {
    display: none;
}

/* Скрытая колонка "Артикул" на фронте (используется только для PDF/JS) */
.wswo-products-table .wswo-col-sku {
    display: none;
}

/* Скрываем спиннеры у количества */
.wswo-qty-input::-webkit-outer-spin-button,
.wswo-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.wswo-qty-input[type=number] {
    -moz-appearance: textfield;
}

/* Закреплённый снизу блок */

.wswo-summary-bar {
    position: static;
    margin-top: 20px;
    padding: 10px 15px;
    background: #ffffff;
    border-top: 1px solid #ddd;
    box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px;
    z-index: 10;
}

.wswo-summary-bar.wswo-summary-bar--fixed {
    position: fixed;
    bottom: 0;
    z-index: 50;
    max-width: 100%;
}

.wswo-summary-main {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: 8px;
}

.wswo-summary-total-label {
    font-weight: 600;
}

.wswo-summary-total-value {
    font-size: 18px;
    font-weight: 700;
}

.wswo-summary-meta {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 14px;
}

.wswo-summary-stock--ok {
    color: #2e7d32;
}

.wswo-summary-stock--warn {
    color: #c62828;
}

/* Адаптив */

@media (max-width: 768px) {
    .wswo-col-product {
        width: 50%;
    }

    .wswo-summary-meta {
        max-width: 100%;
    }

    .wswo-summary-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .wswo-summary-bar.wswo-summary-bar--fixed {
        bottom: 60px;
    }

    .wswo-wrapper {
        padding-bottom: 80px;
    }
}

/* Мобильная карточная раскладка таблицы */
@media (max-width: 768px) {

    .wswo-products-table,
    .wswo-products-table thead,
    .wswo-products-table tbody,
    .wswo-products-table th,
    .wswo-products-table td,
    .wswo-products-table tr {
        display: block;
        width: 100%;
    }

    .wswo-products-table thead {
        display: none;
    }

    .wswo-products-table tr {
        margin-bottom: 15px;
        border: 1px solid #ddd;
        border-radius: 4px;
        overflow: hidden;
        background: #fff;
    }

    .wswo-products-table td {
        border: none;
        border-bottom: 1px solid #eee;
        padding: 6px 10px;
    }

    .wswo-products-table td:last-child {
        border-bottom: none;
    }

    .wswo-col-price,
    .wswo-col-qty,
    .wswo-col-sum {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .wswo-col-price::before,
    .wswo-col-qty::before,
    .wswo-col-sum::before {
        content: attr(data-label);
        font-weight: 600;
        margin-right: 10px;
        white-space: nowrap;
    }

    .wswo-col-product {
        display: block;
    }

    .wswo-col-product::before {
        content: '';
    }

    .wswo-product-main {
        align-items: flex-start;
    }

    .wswo-product-image img {
        max-width: 70px;
        max-height: 70px;
    }

    .wswo-product-title {
        font-size: 14px;
        line-height: 1.3;
    }

    .wswo-col-price,
    .wswo-col-qty,
    .wswo-col-sum {
        text-align: left;
        white-space: normal;
    }

    .wswo-col-stock {
        display: none !important;
    }

    .wswo-row-hidden {
        display: none !important;
    }

    .wswo-row-selected > td {
        background-color: #e7f8e7 !important;
    }
}

/* Стили для сообщений и формы */
.wswo-notice {
    margin-bottom: 15px;
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 14px;
}

.wswo-notice--success {
    background: #e6f4ea;
    border: 1px solid #a5d6a7;
    color: #2e7d32;
}

.wswo-notice--error {
    background: #ffebee;
    border: 1px solid #ef9a9a;
    color: #c62828;
}

.wswo-order-form {
    margin-top: 20px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fafafa;
}

.wswo-order-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px 20px;
    margin-top: 10px;
}

.wswo-order-form-field label {
    display: block;
    font-size: 13px;
    margin-bottom: 4px;
}

.wswo-order-form-field input[type="text"],
.wswo-order-form-field input[type="email"],
.wswo-order-form-field textarea {
    width: 100%;
    padding: 6px 8px;
    border-radius: 3px;
    border: 1px solid #ccc;
    font-size: 14px;
}

.wswo-order-form-field textarea {
    min-height: 80px;
    resize: vertical;
}

.wswo-order-form-submit {
    margin-top: 15px;
}

.wswo-btn-submit {
    font-weight: 600;
}

/* Заголовок категории + кнопка сворачивания */

.wswo-category-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.wswo-category-toggle {
    border: 1px solid #ccc;
    background: #f7f7f7;
    border-radius: 4px;
    padding: 3px 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 26px;
}

.wswo-category-toggle:hover {
    background: #eee;
}

.wswo-category-toggle-icon {
    display: inline-block;
    transition: transform 0.15s ease-in-out;
}

.wswo-category.wswo-category--collapsed .wswo-category-toggle-icon {
    transform: rotate(-90deg);
}

.wswo-category-title {
    margin: 0;
    font-size: 20px;
}

/* Инструкция */

.wswo-instructions {
    margin-bottom: 20px;
}

.wswo-instructions-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.wswo-instructions-toggle {
    border: 1px solid #ccc;
    background: #f7f7f7;
    border-radius: 4px;
    padding: 3px 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 26px;
}

.wswo-instructions-toggle:hover {
    background: #eee;
}

.wswo-instructions-toggle-icon {
    display: inline-block;
    transition: transform 0.15s ease-in-out;
}

.wswo-instructions-title {
    margin: 0;
    font-size: 18px;
}

.wswo-instructions-content {
    padding-left: 32px;
}

.wswo-instructions.wswo-instructions--collapsed .wswo-instructions-content {
    display: none;
}

/* Прогресс-загрузка категорий — по центру экрана */

.wswo-loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.6);
    z-index: 999999;
    pointer-events: none;
}

.wswo-loader-inner {
    min-width: 260px;
    max-width: 320px;
    padding: 10px 16px 12px;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.wswo-loader-text {
    font-size: 13px;
    margin-bottom: 6px;
    text-align: center;
    color: #333;
}

.wswo-loader-bar {
    height: 6px;
    width: 0;
    background: #007cba;
    border-radius: 999px;
    box-shadow: 0 0 8px rgba(0, 124, 186, 0.5);
    transition: width 0.25s ease-out;
}

/* Галочка "Каталог загружен" — над центром */

.wswo-loader-done {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -40px);
    background: #2e7d32;
    color: #ffffff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    z-index: 1000000;
}
