/**
 * Unified Cart & Checkout Styles
 * 
 * Стили для объединённой страницы корзины и оформления заказа
 */

/* =============================================================================
   ОСНОВНАЯ СТРУКТУРА
   ============================================================================= */

.bb-unified-checkout-page {
    padding: 20px 0;
    background: #fff;
}

body.bb-unified-checkout-template .woo-page-header.page-header-8,
body:has(.bb-unified-checkout-page) .woo-page-header.page-header-8 {
    display: none;
}

.bb-unified-container {
    max-width: 1504px;
    margin: 0 auto;
    padding: 0px;
}

.bb-unified-form {
    background: transparent;
}

/* Сетка: Desktop */
.bb-checkout-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 30px;
    align-items: start;
}

.bb-checkout-left {
    position: sticky;
    top: 100px;
    align-self: start;
}

/* =============================================================================
   СЕКЦИИ
   ============================================================================= */

.bb-checkout-section {
    background: #fafafa;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 32px;
    margin-bottom: 24px;
    position: relative;
}

.bb-checkout-right .bb-checkout-section {
    background: #fff;
    border: none;
    padding: 0;
}

.bb-section-title {
    font-family: 'als-hauss', sans-serif !important;
    font-size: 22px !important;
    margin: 0 0 28px 0 !important;
    padding-bottom: 0 !important;
    border-bottom: none !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    color: #000 !important;
}

.bb-subsection-title {
    font-family: 'gotham-medium', sans-serif;
    font-size: 14px;
    margin: 0 0 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #000;
}

/* =============================================================================
   ЛЕВАЯ КОЛОНКА: КОНТАКТНЫЕ ДАННЫЕ
   ============================================================================= */

.bb-form-fields .form-row {
    margin-bottom: 20px;
}

.bb-name-fields-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.bb-name-fields-row .form-row,
.bb-contact-fields-row .form-row,
.bb-telegram-fields-row .form-row {
    float: none !important;
    width: 100% !important;
    padding: 0 !important;
    margin-bottom: 0 !important;
}

.bb-contact-fields-row,
.bb-telegram-fields-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.bb-form-fields label {
    display: block;
    margin-bottom: 10px;
    font-family: 'gotham-medium', sans-serif;
    font-size: 13px;
    color: #000;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bb-form-fields label .required {
    color: #000;
}

.bb-form-fields input[type="text"],
.bb-form-fields input[type="email"],
.bb-form-fields input[type="tel"],
.bb-form-fields select,
.bb-form-fields textarea {
    width: 100%;
    padding: 14px 18px;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    font-family: 'gotham-light', sans-serif;
    font-size: 14px;
    color: #000;
    background: #fff;
    transition: border-color 0.2s ease;
}

.bb-form-fields input:focus,
.bb-form-fields select:focus,
.bb-form-fields textarea:focus {
    outline: none;
    border-color: #000;
    background: #fff;
}

.bb-form-fields .woocommerce-invalid input,
.bb-form-fields .woocommerce-invalid select {
    border-color: #e74c3c;
}

.bb-order-notes {
    margin-top: 20px;
}

/* =============================================================================
   СПОСОБЫ ОПЛАТЫ (КАРТОЧКИ)
   ============================================================================= */

.bb-payment-methods {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.payment-card {
    border: 1px solid #d0d0d0;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.payment-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.payment-card:hover {
    border-color: #000;
    background: #fff;
}

.payment-card.active {
    border-color: #000;
    background: #fff;
}

.payment-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 0px;
}

.payment-header::before {
    content: '';
    width: 18px;
    height: 18px;
    border: 2px solid #cfcfcf;
    border-radius: 50%;
    flex: 0 0 auto;
    box-shadow: inset 0 0 0 4px #fff;
}

.payment-card.active .payment-header::before {
    border-color: #000;
    background: #000;
}

.payment-title {
    font-family: 'gotham-medium', sans-serif;
    font-size: 15px;
    margin: 0;
    cursor: pointer;
    color: #000;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.payment-description,
.payment-card p {
    font-family: 'gotham-light', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
}

.payment-icons {
    display: flex;
    gap: 8px;
    margin: 12px 0;
    flex-wrap: wrap;
}

.payment-system-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 28px;
    background: #f5f5f5;
    border-radius: 4px;
    font-size: 18px;
}

.yookassa-icons {
    display: flex;
    gap: 6px;
}

.payment-desc {
    font-family: 'gotham-light', sans-serif;
    font-size: 13px;
    color: #000;
    margin-top: 10px;
    line-height: 1.5;
}

.payment-box {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #f0f0f0;
}

/* =============================================================================
   ПРАВАЯ КОЛОНКА: ТОВАРЫ
   ============================================================================= */

.bb-cart-items {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 24px;
}

.bb-cart-section--compact {
    display: none;
}

.bb-cart-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    padding: 28px;
    background: #fff;
    border: 1px solid #d0d0d0;
    border-radius: 12px;
    position: relative;
}

.bb-cart-section--expanded .bb-cart-item {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
}

.bb-cart-section--expanded .bb-item-details {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.bb-item-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: start;
    max-width: calc(100% - 50px);
}


.bb-item-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 100%;
}

.bb-item-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.bb-item-name {
    font-family: 'als-hauss', sans-serif;
    font-size: 20px;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bb-item-name a {
    color: #000;
    text-decoration: none;
}

.bb-item-name a:hover {
    opacity: 0.7;
    text-decoration: none;
}

/* Кнопка Изменить скрыта - см. комментарий в PHP */
.bb-item-edit {
    display: none;
}

.bb-item-epo {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 100%;
}

.epo-option {
    font-family: 'gotham-light', sans-serif;
    font-size: 13px;
    color: #000;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    line-height: 1.4;
}

.epo-label-value {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.epo-label {
    font-family: 'gotham-medium', sans-serif;
    color: #000;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.epo-value {
    color: #000;
    font-family: 'gotham-light', sans-serif;
    font-size: 13px;
}

.epo-price {
    font-family: 'gotham-medium', sans-serif;
    color: #000;
    margin-left: auto;
    flex-shrink: 0;
}

.bb-item-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 8px;
}

.bb-item-quantity {
    display: inline-flex;
    width: fit-content; 
    align-items: center;
    gap: 0;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    background: #fff;
    margin-top: 0;
    overflow: hidden;
    height: 42px;
}

.bb-qty-label {
    font-family: 'gotham-medium', sans-serif;
    width: max-content;
    font-size: 11px;
    color: #000;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0 14px;
    border-right: 1px solid #d0d0d0;
}

.bb-qty-input {
    display: none;
}

.bb-qty-value {
    min-width: 40px;
    text-align: center;
    color: #000;
    font-family: 'gotham-medium', sans-serif;
    font-size: 14px;
    padding: 12px 8px;
}

.bb-qty-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-left: 1px solid #d0d0d0;
    background: #fff;
    color: #000;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 0;
    transition: background 0.2s ease;
}

.bb-qty-btn:first-of-type {
    border-left: none;
    border-right: 1px solid #d0d0d0;
}

.bb-qty-btn:hover {
    background: #f5f5f5;
}

.bb-qty-btn:active {
    background: #e8e8e8;
}

.bb-item-price {
    font-family: 'als-hauss', sans-serif;
    font-size: 22px;
    color: #000;
    white-space: nowrap;
    letter-spacing: 0.5px;
    min-width: 120px;
    text-align: right;
}

.bb-remove-item {
    position: absolute;
    top: 20px;
    right: 16px;
    width: 36px;
    height: 36px;
    border: 1px solid #d0d0d0;
    background: #fff;
    color: #000;
    border-radius: 8px;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.bb-remove-item svg {
    width: 18px;
    height: 18px;
}

.bb-remove-item:hover {
    background: #f44336;
    color: #fff;
    border-color: #f44336;
}

/* =============================================================================
   ПРОМОКОД
   ============================================================================= */

.bb-coupon-section {
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    margin: 0;
}

.bb-coupon-input-wrap {
    display: flex;
    gap: 12px;
}

.bb-coupon-input {
    flex: 1;
    padding: 14px 18px;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    font-family: 'gotham-light', sans-serif;
    font-size: 14px;
    color: #000;
    background: #fff;
}

.bb-apply-coupon {
    padding: 14px 28px;
    background: #000;
    color: #fff;
    border: 1px solid #000;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'gotham-medium', sans-serif;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
}

.bb-apply-coupon:hover {
    background: #fff;
    color: #000;
}

.bb-update-cart-wrap {
    margin: 0;
    margin-bottom: 24px;
}

.bb-update-cart {
    width: 100%;
    padding: 16px 28px;
    background: transparent;
    color: #000;
    border: 1px solid #000;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'gotham-medium', sans-serif;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
}

.bb-update-cart:hover {
    background: #000;
    color: #fff;
}

.bb-applied-coupons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.bb-coupon-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 13px;
}

.bb-remove-coupon {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 0;
    width: 16px;
    height: 16px;
}

/* =============================================================================
   ИТОГИ ЗАКАЗА
   ============================================================================= */

.bb-order-totals {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 28px;
    background: transparent;
    border: 1px solid #d0d0d0;
    border-radius: 12px;
    margin-bottom: 24px;
}

.bb-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 15px;
}

.bb-total-label {
    font-family: 'gotham-light', sans-serif;
    color: #000;
    font-size: 14px;
}

.bb-total-value {
    font-family: 'gotham-medium', sans-serif;
    color: #000;
    font-size: 14px;
}

.bb-grand-total {
    padding-top: 12px;
    border-top: 2px solid #ddd;
    font-size: 18px;
}

.bb-grand-total .bb-total-label,
.bb-grand-total .bb-total-value {
    font-family: 'als-hauss', sans-serif;
    color: #000;
    font-size: 18px;
}

/* =============================================================================
   КНОПКА ОФОРМЛЕНИЯ
   ============================================================================= */

.bb-place-order {
    margin-top: 24px;
}

.bb-checkout-submit-btn {
    width: 100% !important;
    padding: 20px 32px !important;
    background: #4caf50 !important;
    color: #fff !important;
    border: 1px solid #4caf50 !important;
    outline: none !important;
    box-shadow: none !important;
    border-radius: 8px !important;
    font-family: 'gotham-medium', sans-serif !important;
    font-size: 14px !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    line-height: 1.4 !important;
    min-height: auto !important;
}

.bb-checkout-submit-btn:hover {
    background: #45a049 !important;
    color: #fff !important;
    border: 1px solid #45a049 !important;
    outline: none !important;
    box-shadow: none !important;
}

.bb-checkout-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* =============================================================================
   УВЕДОМЛЕНИЯ WOOCOMMERCE
   ============================================================================= */

.woocommerce-notices-wrapper {
    max-width: 1504px;
    margin: 0 auto;
    padding: 0px;
}

.woocommerce-message,
.woocommerce-info,
.woocommerce-error {
    padding: 18px 24px !important;
    margin-bottom: 24px !important;
    border-radius: 12px !important;
    border: 1px solid !important;
    font-family: 'gotham-light', sans-serif !important;
    font-size: 14px !important;
    color: #000 !important;
    list-style: none !important;
}

.woocommerce-message {
    border-color: #4caf50 !important;
    background: #f1f8f4 !important;
}

.woocommerce-info {
    border-color: #2196f3 !important;
    background: #e3f2fd !important;
}

.woocommerce-error {
    border-color: #f44336 !important;
    background: #ffebee !important;
}

.woocommerce-message li,
.woocommerce-info li,
.woocommerce-error li {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.woocommerce-message::before,
.woocommerce-info::before,
.woocommerce-error::before {
    display: none !important;
}

/* =============================================================================
   УСЛОВИЯ И ПОЛИТИКА
   ============================================================================= */

.woocommerce-terms-and-conditions-wrapper {
    margin: 24px 0;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e5e5e5;
}

.woocommerce-privacy-policy-text {
    font-family: 'gotham-light', sans-serif;
    font-size: 13px;
    line-height: 1.6;
    color: #000;
    margin-bottom: 16px;
}

.woocommerce-privacy-policy-text p {
    margin: 0 0 12px;
}

.woocommerce-privacy-policy-text a {
    color: #000;
    text-decoration: underline;
}

.woocommerce-privacy-policy-text a:hover {
    text-decoration: none;
}

.woocommerce-terms-and-conditions-wrapper .form-row {
    margin: 0;
}

.woocommerce-terms-and-conditions-wrapper label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-family: 'gotham-light', sans-serif;
    font-size: 13px;
    color: #000;
    cursor: pointer;
}

.woocommerce-terms-and-conditions-wrapper input[type="checkbox"] {
    margin: 3px 0 0;
    flex-shrink: 0;
}

.woocommerce-terms-and-conditions-checkbox-text a {
    color: #000;
    text-decoration: underline;
}

.woocommerce-terms-and-conditions-checkbox-text a:hover {
    text-decoration: none;
}

.required {
    color: #f44336;
}

/* =============================================================================
   БЛОК ДОСТАВКИ
   ============================================================================= */

.Dostavk {
    margin-bottom: 24px;
    padding: 16px 20px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e5e5e5;
}

.Dostavk p {
    margin: 0;
    font-family: 'gotham-light', sans-serif;
    font-size: 13px;
    line-height: 1.6;
    color: #000;
}

.Dostavk p strong {
    font-family: 'gotham-medium', sans-serif;
}

/* =============================================================================
   ИЗОБРАЖЕНИЯ ТОВАРА
   ============================================================================= */

.bb-item-image {
    width: 100%;
    aspect-ratio: 1.48 / 1;
    overflow: hidden;
    border-radius: 12px;
    background: #f5f5f5;
}

.bb-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* =============================================================================
   АДАПТИВНОСТЬ: TABLET
   ============================================================================= */

@media (max-width: 991px) {
    .bb-checkout-grid {
        display: flex;
        flex-direction: column;
    }
    
    .bb-checkout-left {
        display: contents;
        position: static;
    }
    
    .bb-checkout-right {
        display: contents;
    }
    
    
    .bb-cart-section--expanded {
        order: 1;
    }

    .bb-contact-section {
        width: 100%;
        order: 2;
    }

    .bb-cart-section--compact {
        width: 100%;
        display: block;
        order: 3;
    }

    .bb-payment-section {
        width: 100%;
        order: 4;
    }

    .bb-cart-section--expanded {
        margin-bottom: 20px;
    }

}

/* =============================================================================
   АДАПТИВНОСТЬ: MOBILE
   ============================================================================= */

@media (max-width: 767px) {

    .bb-total-row {
    display: flex;
    align-items: flex-start;
    flex-direction: column;
}
    
    .bb-item-price {
        text-align: left;
}

    .bb-item-name {
        font-size: 14px;
    }

    .bb-unified-checkout-page {
        padding: 20px 0;
    }
    
    .bb-unified-container {
        padding: 0px;
    }
    
    .bb-checkout-section {
        padding: 20px;
        border-radius: 8px;
    }
    
    .bb-section-title {
        font-size: 18px;
        margin-bottom: 20px;
    }
    
    .bb-cart-item {
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
        padding: 16px;
    }
    
    .bb-item-info {
        max-width: 100%;
    }
    
    .bb-remove-item {
        width: 32px;
        height: 32px;
        top: 12px;
        right: 12px;
    }

    .bb-cart-section--expanded .bb-cart-item {
        grid-template-columns: minmax(0, 1fr);
        align-items: start;
    }

    .bb-name-fields-row,
    .bb-contact-fields-row,
    .bb-telegram-fields-row {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .bb-item-top {
        grid-template-columns: minmax(0, 1fr);
        max-width: 100%;
    }

    .bb-cart-section--compact .bb-cart-item {
        align-items: center;
        grid-template-columns: 56px 1fr;
        padding: 12px;
    }
    
    .bb-cart-section--compact .bb-item-image {
        width: 56px;
        height: 56px;
        aspect-ratio: 1 / 1;
    }
    
    .bb-remove-item {
        margin-top: 0;
    }
    
    .bb-item-meta {
        flex-direction: row;
        align-items: flex-start;
        gap: 8px;
    }
    
    .bb-coupon-input-wrap {
        flex-direction: column;
    }
    
    .bb-apply-coupon {
        width: 100%;
    }
    
    .payment-card {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .bb-checkout-section {
        padding: 16px;
    }
    
    .bb-section-title {
        font-size: 16px;
    }
    
    .bb-form-fields input,
    .bb-form-fields select,
    .bb-form-fields textarea {
        font-size: 16px; /* Предотвращает zoom на iOS */
    }
}

/* =============================================================================
   ЗАГРУЗКА / СОСТОЯНИЯ
   ============================================================================= */

.bb-unified-checkout-page.loading {
    pointer-events: none;
    opacity: 0.6;
}

.bb-unified-checkout-page.loading::after {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 9999;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
