/* ============================================== */
/* MODERN SIMPLE CSS (FINAL V2 - FIXED MOBILE)    */
/* ============================================== */

/* 1. ГЛОБАЛЬНЫЕ СТИЛИ */
.simple-content {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #333;
}

/* Оформление блоков */
.simplecheckout-block {
    background: #fff;
    border: 1px solid #f0f0f0;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    padding: 25px;
    margin-bottom: 20px;
    transition: box-shadow 0.3s;
}

.simplecheckout-block:hover {
    box-shadow: 0 8px 25px rgba(0,0,0,0.05);
}

.simplecheckout-block-content {
    padding: 0;
}

.checkout-heading.panel-heading {
    background: transparent;
    border: none;
    border-bottom: 2px solid #f8f8f8;
    color: #111;
    font-size: 18px;
    font-weight: 700;
    padding: 0 0 15px 0;
    margin-bottom: 20px;
}

/* 2. ЛЭЙАУТ (Float + Sticky Block) */
.simplecheckout:before, .simplecheckout:after { content: " "; display: table; }
.simplecheckout:after { clear: both; }

@media (min-width: 1024px) {
    /* Левая колонка */
    .simplecheckout-left-column {
        width: 68% !important;
        float: left !important;
        margin-right: 2% !important;
        max-width: none !important;
    }

    /* Правая колонка (контейнер) */
    .simplecheckout-right-column {
        width: 30% !important;
        float: right !important;
        max-width: none !important;
    }

    /* ЛИПКИЙ БЛОК SUMMARY */
    div#simplecheckout_summary {
        position: -webkit-sticky;
        position: sticky;
        top: 94px;
        z-index: 100;
    }
}

@media (max-width: 1023px) {
    .simplecheckout-left-column, 
    .simplecheckout-right-column { 
        width: 100% !important; 
        float: none !important; 
        margin-bottom: 20px;
    }
}

/* 3. СЕТКА ПОЛЕЙ (2 колонки) */
.simple-fieldset-grid {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px;
}

.simple-field-wrapper {
    width: 50%;
    padding: 0 10px;
    margin-bottom: 15px;
    box-sizing: border-box;
}

/* ИСКЛЮЧЕНИЯ: Поля на всю ширину */
.simple-field-wrapper[class*="address_1"], 
.simple-field-wrapper[class*="comment"] {
    width: 100%;
}

@media (max-width: 600px) {
    .simple-field-wrapper { width: 100%; }
}

/* Инпуты */
.simple-content input.form-control,
.simple-content select.form-control,
.simple-content textarea.form-control {
    height: 48px;
    border: 1px solid #e1e1e1;
    background: #fafafa;
    border-radius: 6px;
    padding: 0 15px;
    width: 100%;
    box-shadow: none;
}
.simple-content textarea.form-control {
    height: auto; min-height: 100px; padding-top: 10px;
}
.simple-content input.form-control:focus {
    background: #fff; border-color: #666;
}
.simple-field-wrapper label.control-label {
    display: block; margin-bottom: 6px; font-weight: 600; font-size: 13px; color: #555; text-align: left;
}

/* 4. КОРЗИНА (ФИКС ДЛЯ ПК + АДАПТИВ) */

/* Убираем лишний бордер темы */
.simple-content .table-responsive {
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    margin-bottom: 0 !important;
    overflow: visible !important;
}

/* --- ПК ВЕРСИЯ (Фиксированные колонки) --- */
.simplecheckout-cart {
    border: none !important;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 15px;
    table-layout: fixed; /* ВАЖНО для ПК */
}

.simplecheckout-cart tbody td {
    border-bottom: 1px solid #f8f8f8 !important;
    padding: 10px;
    vertical-align: middle;
    background: #fff;
}

/* 1. Картинка */
.simplecheckout-cart td.image {
    width: 90px;
    text-align: center;
}
.simplecheckout-cart td.image img {
    border-radius: 8px;
    width: 60px;
    height: 60px;
    object-fit: cover;
    border: 1px solid #f0f0f0;
}

/* 2. Название */
.simplecheckout-cart td.name {
    width: auto;
    padding-left: 15px;
}
.simplecheckout-cart td.name a.product-name-link {
    font-weight: 500; font-size: 14px; color: #222; text-decoration: none; display: block; margin-bottom: 4px;
}
.simplecheckout-cart td.name .options small { color: #888; font-size: 11px; }

/* 3. Количество */
.simplecheckout-cart td.quantity {
    width: 140px;
    min-width: 140px;
    text-align: center;
}
.qty-switcher {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    background: #f5f5f5;
    border-radius: 20px;
    padding: 2px 4px;
    width: 100px;
    height: 32px;
}
.qty-switcher .qty-btn {
    width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: #333; border-radius: 50%; font-size: 12px;
}
.qty-switcher .qty-btn:hover { background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.qty-switcher .qty-input {
    width: 30px !important; height: 28px; border: none !important; background: transparent !important; text-align: center; font-weight: 600; font-size: 14px; padding: 0 !important; margin: 0 !important; box-shadow: none !important;
}

/* 4. Цены и Итог */
.simplecheckout-cart td.price, 
.simplecheckout-cart td.total {
    width: 110px;
    min-width: 110px;
    font-size: 15px;
    color: #333;
    white-space: nowrap;
    text-align: right;
    padding-right: 20px;
}
.simplecheckout-cart td.total {
    font-weight: 700;
}

/* 5. Удаление */
.simplecheckout-cart td.remove {
    width: 60px;
    text-align: right;
    padding-right: 10px;
}
.remove-btn {
    background: #fff; border: 1px solid #e0e0e0; width: 32px; height: 32px; border-radius: 4px; color: #555; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.remove-btn:hover { color: #fff; border-color: #ff4d4d; background: #ff4d4d; }

/* --- МОБИЛЬНАЯ ВЕРСИЯ (ПОЛНЫЙ СБРОС ТАБЛИЦЫ) --- */
@media (max-width: 768px) {
    /* СБРОС ТАБЛИЧНОГО ПОВЕДЕНИЯ */
    .simplecheckout-cart, 
    .simplecheckout-cart tbody, 
    .simplecheckout-cart tr, 
    .simplecheckout-cart td {
        display: block !important;
        width: 100% !important;
        box-sizing: border-box;
    }
    
    .simplecheckout-cart thead { display: none !important; }

    /* Превращаем строку в Flex-контейнер */
    .simplecheckout-cart tr.cart-item-row {
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: flex-start !important;
        background: #fff;
        border: 1px solid #e5e5e5 !important;
        border-radius: 12px;
        padding: 15px;
        margin-bottom: 15px;
        position: relative;
    }
    
    /* 1. Картинка (Лево) */
    .simplecheckout-cart td.image {
        width: 70px !important; 
        flex: 0 0 70px !important; /* Жесткий размер */
        margin-right: 15px !important; 
        padding: 0 !important;
        border: none !important;
        order: 1;
    }
    
    /* 2. Название (Право) */
    .simplecheckout-cart td.name {
        width: calc(100% - 120px) !important; /* Оставляем место под крестик */
        padding: 0 !important;
        border: none !important;
        margin-bottom: 15px !important; 
        order: 2;
    }
    
    /* 3. Количество (Новая строка, Слева) */
    .simplecheckout-cart td.quantity {
        order: 3; 
        width: auto !important; 
        margin-right: auto !important; /* Толкает цену вправо */
        padding: 0 !important;
        border: none !important;
        display: flex !important;
        align-items: center !important;
    }
    
    /* 4. Итого (Новая строка, Справа) */
    .simplecheckout-cart td.total {
        order: 4; 
        width: auto !important; 
        margin-left: auto !important; /* Толкает себя вправо */
        text-align: right !important;
        padding: 0 !important;
        border: none !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-end !important;
        
        font-size: 16px; font-weight: 700; color: #000;
    }
    
    /* Крестик (Абсолют) */
    .simplecheckout-cart td.remove {
        position: absolute !important; 
        top: 10px !important; 
        right: 10px !important; 
        width: 30px !important;
        height: 30px !important;
        padding: 0 !important;
        border: none !important;
        z-index: 5;
    }
    .remove-btn { border: none; background: transparent; width: 24px; height: 24px; color: #ccc; }
    
    /* Скрываем лишнее */
    .price-label.mobile-only { display: block; font-size: 10px; color: #999; text-transform: uppercase; margin-bottom: 2px; }
    .simplecheckout-cart td.price { display: none !important; }
    .hidden-xs { display: none !important; }
}

/* Купон */
.cart-coupon-row {
    margin-top: 15px; padding-top: 15px; border-top: 1px dashed #eee;
}
.coupon-wrapper {
    display: flex; max-width: 350px; gap: 10px;
}
.coupon-input {
    height: 42px !important; border-radius: 20px !important; border: 1px solid #e0e0e0 !important; padding-left: 20px !important; background: #f9f9f9 !important; flex-grow: 1;
}
.coupon-input:focus { background: #fff !important; border-color: #333 !important; }
.coupon-btn {
    height: 42px; border-radius: 20px; padding: 0 25px; background: #fff; border: 1px solid #e0e0e0; color: #333; font-weight: 600; text-transform: uppercase; font-size: 12px; cursor: pointer;
}
.coupon-btn:hover { background: #333; color: #fff; border-color: #333; }

/* 5. ПРАВЫЙ БЛОК (SUMMARY) */
#simplecheckout_summary .simplecheckout-cart-total {
    display: flex; justify-content: space-between; padding: 12px 0; font-size: 14px; border-bottom: 1px dashed #eee;
}
#simplecheckout_summary .simplecheckout-cart-total:last-child { border-bottom: none; }
#simplecheckout_summary #total_total {
    font-size: 20px; font-weight: 800; color: #000; margin-top: 15px; padding-top: 15px;
}

/* Кнопка оформления */
#simplecheckout_button_confirm {
    width: 100%;
    padding: 15px;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 8px;
    display: block;
    text-align: center;
    cursor: pointer;
}
#simplecheckout_summary #simplecheckout_button_confirm {
    display: block !important;
}

/* Скрываем дубликаты кнопок */
.simplecheckout-button-block,
#simplecheckout_payment_form .buttons,
#buttons,
.simplecheckout-button-block #simplecheckout_button_confirm,
#simplecheckout_payment_form #simplecheckout_button_confirm {
    display: none !important;
}

/* 6. БЛОК ПОКУПАТЕЛЯ (Checkbox Style) */
.customer-heading-flex {
    display: flex; justify-content: space-between; align-items: center;
}
.login-link-btn {
    font-size: 14px; color: #38B0E3; font-weight: 600; text-decoration: none; border-bottom: 1px dashed #38B0E3;
}
.simple-field-wrapper.row-customer_register {
    width: 100% !important; order: 100; margin-top: 15px; padding-top: 15px; border-top: 1px solid #f0f0f0; padding-left: 10px; padding-right: 10px;
}
.custom-register-container .checkbox {
    margin-top: 0; margin-bottom: 0; padding-left: 0;
}
.custom-register-container .checkbox label {
    display: flex; align-items: center; font-size: 15px; color: #333; cursor: pointer; padding-left: 0 !important;
}
.custom-register-container .checkbox input[type="checkbox"] {
    position: static !important; margin-left: 0 !important; margin-right: 10px !important; width: 18px; height: 18px; margin-top: 0; cursor: pointer; vertical-align: middle;
}

/* 7. СТИЛИ ОШИБОК (Fixed Visibility) */
div.simplecheckout-warning-block,
div.simplecheckout-warning-block.alert-danger {
    display: flex; 
    align-items: center;
    justify-content: flex-start;
    flex-wrap: nowrap;
    background-color: #ffebeb !important;
    color: #d63031 !important;
    border: 1px solid #ffcccc !important;
    border-radius: 8px !important;
    padding: 15px 20px !important;
    margin-bottom: 20px !important;
    height: auto !important;
    min-height: auto !important;
}

div.simplecheckout-warning-block[style*="display:none"],
div.simplecheckout-warning-block[style*="display: none"] {
    display: none !important;
}

div.simplecheckout-warning-block:before,
div.simplecheckout-warning-block.alert-danger:before {
    content: "!" !important;
    flex: 0 0 24px !important; 
    width: 24px !important; height: 24px !important;
    display: flex !important; align-items: center !important; justify-content: center !important;
    background-color: #ff3b30 !important; color: #fff !important;
    border-radius: 50% !important; font-weight: bold !important; font-family: Arial, sans-serif !important; font-size: 14px !important;
    margin: 0 15px 0 0 !important; padding: 0 !important;
    position: static !important;
}

.simplecheckout-error-text {
    color: #ff3b30; font-size: 12px; font-weight: 500; margin-top: 5px; display: block; animation: fadeInError 0.3s ease-out forwards;
}
.simple-field-wrapper[data-error="true"] input,
.simple-field-wrapper[data-error="true"] select,
.form-group.has-error input.form-control {
    border-color: #ff3b30 !important; background-color: #fffbfb !important; box-shadow: 0 0 0 1px rgba(255, 59, 48, 0.1);
}
.simple-field-wrapper[data-error="true"] .control-label,
.form-group.has-error .control-label {
    color: #ff3b30 !important;
}
@keyframes fadeInError {
    from { opacity: 0; transform: translateY(-3px); }
    to { opacity: 1; transform: translateY(0); }
}