/* ===== МОДАЛКА ===== */
.qbapps-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 300;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.qbapps-modal__overlay {
    min-height: 100%;
    background: rgba(0, 0, 0, 0.5);
    padding: 60px 16px 80px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.qbapps-modal__content {
    background: #fff;
    border-radius: 12px;
    width: 960px;
    max-width: 100%;
    position: relative;
    z-index: 5;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    margin: 0;
    align-self: center;
}

.qbapps-modal__close {
    position: absolute;
    top: 12px;
    right: 16px;
    border: none;
    background: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #999;
    z-index: 6;
    padding: 4px 8px;
    border-radius: 4px;
}

.qbapps-modal__close:hover {
    color: #333;
    background: #f5f5f5;
}

.qbapps-modal__header {
    padding: 20px 24px 12px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
    background: #fff;
    border-radius: 12px 12px 0 0;
}

.qbapps-modal__body {
    flex: 1;
    padding: 20px 24px 24px;
    max-height: 70vh;
    overflow-y: auto;
    min-height: 200px;
    background: #fff;
    border-radius: 0 0 12px 12px;
}

/* Товар в хедере */
.qbapps-product {
    display: flex;
    align-items: center;
    gap: 16px;
}

.qbapps-product__image img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 8px;
}

.qbapps-product__name {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.qbapps-product__sku {
    font-size: 13px;
    color: #999;
    margin-top: 2px;
}

.qbapps-product__price {
    font-size: 18px;
    font-weight: 700;
    color: #e74c3c;
    margin-top: 4px;
}

/* Лоадер */
.qbapps-loader {
    text-align: center;
    padding: 60px 0;
}

.qbapps-loader__spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e0e0e0;
    border-top-color: #3498db;
    border-radius: 50%;
    animation: qbapps-spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes qbapps-spin {
    to { transform: rotate(360deg); }
}

.qbapps-loader__text {
    font-size: 14px;
    color: #999;
}

/* ===== СТИЛИ ЧЕКАУТА В МОДАЛКЕ ===== */

/* Сбрасываем наследуемые стили темы Site */
.qbapps-checkout {
    all: initial;
    display: block;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    background: #fff;
}

.qbapps-checkout * {
    box-sizing: border-box;
}

.qbapps-checkout .wa-order-cart-wrapper,
.qbapps-checkout .wa-order-form-wrapper {
    border: none;
    padding: 0;
    margin: 0;
    background: transparent;
    color: #333;
}

.qbapps-checkout .wa-order-cart-wrapper .wa-cart-body,
.qbapps-checkout .wa-order-form-wrapper .wa-form-body {
    padding: 0;
    color: #333;
}

.qbapps-checkout .wa-order-form-wrapper .wa-form-content {
    background: transparent !important;
    color: #333 !important;
}

/* Заголовки */
.qbapps-checkout h3,
.qbapps-checkout .wa-header,
.qbapps-checkout .wa-section-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #222 !important;
    background: transparent !important;
    margin: 0 0 12px 0;
    padding: 0;
}

/* Поля ввода */
.qbapps-checkout select,
.qbapps-checkout input[type="text"],
.qbapps-checkout input[type="tel"],
.qbapps-checkout input[type="email"],
.qbapps-checkout input[type="password"],
.qbapps-checkout textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc !important;
    border-radius: 6px;
    font-size: 14px;
    color: #333 !important;
    background: #fff !important;
    box-sizing: border-box;
    min-height: 40px;
}

.qbapps-checkout .wa-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #555 !important;
    margin-bottom: 4px;
}

/* Таблица корзины */
.qbapps-checkout table {
    width: 100%;
    border-collapse: collapse;
    color: #333;
    background: transparent;
}

.qbapps-checkout td,
.qbapps-checkout th {
    padding: 8px;
    border-bottom: 1px solid #eee;
    text-align: left;
    font-size: 14px;
    color: #333 !important;
    background: transparent !important;
}

.qbapps-checkout th {
    font-weight: 600;
    color: #555 !important;
    font-size: 13px;
}

/* Кнопки */
.qbapps-checkout button,
.qbapps-checkout input[type="submit"],
.qbapps-checkout .wa-button {
    background: #3b82f6 !important;
    color: #fff !important;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
    font-weight: 600;
    text-shadow: none;
    box-shadow: none;
}

.qbapps-checkout button:hover,
.qbapps-checkout input[type="submit"]:hover {
    background: #2563eb !important;
}

/* Поля для радио и чекбоксов */
.qbapps-checkout input[type="radio"],
.qbapps-checkout input[type="checkbox"] {
    margin-right: 6px;
}

/* Блоки доставки */
.qbapps-checkout .wa-step-section {
    margin-bottom: 20px;
    padding: 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
}

.qbapps-checkout .wa-step-section header {
    background: transparent;
    border: none;
    padding: 0 0 12px 0;
    margin: 0;
}

/* shipping methods - варианты доставки */
.qbapps-checkout .wa-shipping-method,
.qbapps-checkout .wa-shipping-rate {
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 8px;
    background: #fafafa;
    color: #333;
}

.qbapps-checkout .wa-shipping-method:hover {
    background: #f0f0f0;
}

.qbapps-checkout .wa-shipping-method.selected,
.qbapps-checkout .wa-shipping-rate.selected {
    background: #e8f0fe;
    border-color: #3b82f6;
}

/* Ссылка "Войти" */
.qbapps-checkout a,
.qbapps-checkout .wa-login-link {
    color: #3b82f6 !important;
    text-decoration: underline;
    background: transparent;
}

/* Карта Яндекса — не трогаем её z-index, она выше модалки */

/* ошибки */
.qbapps-checkout .wa-error-text {
    color: #dc2626 !important;
    font-size: 13px;
    margin-top: 4px;
}

.qbapps-checkout .wa-success-text {
    color: #16a34a !important;
}

/* Плагин addressmap */
.ya-map {
    max-width: 100% !important;
}

/* ===== УСПЕШНОЕ ОФОРМЛЕНИЕ (в хедере) ===== */
.qbapps-success {
    text-align: center;
    padding: 10px 20px 0;
}

.qbapps-success__icon {
    width: 80px;
    height: 80px;
    line-height: 80px;
    border-radius: 50%;
    background: #27ae60;
    color: #fff;
    font-size: 36px;
    margin: 0 auto 20px;
    animation: qbapps-success-pop 0.4s ease-out;
}

@keyframes qbapps-success-pop {
    0% { transform: scale(0); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

.qbapps-success__body {
    max-width: 400px;
    margin: 0 auto;
}

.qbapps-success__title {
    font-size: 24px;
    font-weight: 700;
    color: #222;
    margin: 0 0 12px;
}

.qbapps-success__number {
    font-size: 16px;
    color: #444;
    margin: 0 0 8px;
}

.qbapps-success__number strong {
    color: #222;
}

.qbapps-success__amount {
    font-size: 18px;
    font-weight: 600;
    color: #222;
    margin: 0 0 12px;
}

.qbapps-success__amount strong {
    font-size: 22px;
    color: #e74c3c;
}

.qbapps-success__text {
    font-size: 15px;
    color: #888;
    margin: 0 0 20px;
    line-height: 1.5;
}

/* Кнопки действий */
.qbapps-success__actions {
    margin-top: 16px;
}

.qbapps-btn-success {
    display: inline-block;
    padding: 12px 32px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
}

.qbapps-btn-success.button.blue {
    background: #3b82f6;
    color: #fff;
}

.qbapps-btn-success.button.blue:hover {
    background: #2563eb;
}

.qbapps-btn-success.button.light-gray {
    background: #f0f0f0;
    color: #555;
}

.qbapps-btn-success.button.light-gray:hover {
    background: #e0e0e0;
    color: #333;
}

/* Мобильная адаптация */
@media (max-width: 768px) {
    .qbapps-modal__overlay {
        padding: 0;
        align-items: flex-end;
    }

    .qbapps-modal__content {
        width: 100%;
        max-width: 100%;
        border-radius: 12px 12px 0 0;
        max-height: 95vh;
    }

    .qbapps-modal__header {
        padding: 16px;
    }

    .qbapps-modal__body {
        padding: 12px 16px 100px;
        max-height: 80vh;
    }
}
