/**
 * CHECKOUT 2025 - Легкие улучшения формы без разлома
 * Мягкий фокус, понятные ошибки, но не переусложняем
 * Дата: 2025-10-18
 */

/* === INPUT & FORM ELEMENTS - Мягкие улучшения === */

/* Убираем красные border с инпутов - меняем на мягкие серые */
#simplecheckout_form input,
#simplecheckout_form textarea,
#simplecheckout_form select,
.checkout-form input,
.checkout-form textarea,
.checkout-form select {
    border: 1px solid #e2e2e2 !important;
    border-radius: 6px !important;
    box-shadow: 0 1px 2px rgba(0,0,0,.04) !important;
    transition: border-color 0.2s, box-shadow 0.2s !important;
}

/* Мягкий focus - розовая тень вместо красной рамки */
#simplecheckout_form input:focus,
#simplecheckout_form textarea:focus,
#simplecheckout_form select:focus,
.checkout-form input:focus,
.checkout-form textarea:focus,
.checkout-form select:focus {
    outline: none !important;
    border-color: #c0153b !important;
    box-shadow: 0 0 0 3px rgba(192,21,59,.15) !important;
}

/* === ОШИБКИ ФОРМЫ - Человечные, не кричащие === */

/* Input с ошибкой - светло-розовый фон */
#simplecheckout_form input.error,
#simplecheckout_form textarea.error,
.checkout-form input.error,
.checkout-form textarea.error {
    border-color: #e57373 !important;
    background: #fff7f7 !important;
}

/* Текст ошибки - темный красный, не кричащий */
.error-text,
.form-error,
.error-message {
    color: #c62828 !important;
    font-size: 13px !important;
    margin-top: 4px !important;
    display: block !important;
}

/* === ВЫРАВНИВАНИЕ БЛОКОВ === */

/* Две колонки на одной высоте - основное улучшение */
.checkout-sections,
#simplecheckout_sections {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 40px !important;
    align-items: start !important;
}

@media (max-width: 1200px) {
    .checkout-sections,
    #simplecheckout_sections {
        grid-template-columns: 1fr !important;
        gap: 24px !important;
    }
}

/* === ИТОГОВЫЙ БЛОК - Выделяем центр внимания === */

/* Картшка с итогом - лёгкий розовый фон */
.checkout-summary,
#simplecheckout_summary {
    background: #fff9fa !important;
    border-radius: 8px !important;
    padding: 20px 24px !important;
    grid-column: 2 !important;
    position: sticky !important;
    top: 20px !important;
}

@media (max-width: 1200px) {
    .checkout-summary,
    #simplecheckout_summary {
        grid-column: auto !important;
        position: static !important;
    }
}

/* Итоговая сумма - крупнее и красивше */
.checkout-summary .total,
#simplecheckout_summary .total,
.checkout-summary strong,
#simplecheckout_summary strong {
    color: #c0153b !important;
    font-size: 18px !important;
    font-weight: 600 !important;
}

/* === КНОПКИ === */

/* Основная кнопка - заполненная красная */
.btn-primary,
#simplecheckout_btn_order,
.checkout-btn-submit {
    background: #c0153b !important;
    color: #fff !important;
    border: 1px solid #c0153b !important;
    padding: 14px 48px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    min-width: 180px !important;
}

.btn-primary:hover,
#simplecheckout_btn_order:hover,
.checkout-btn-submit:hover {
    background: #9a0031 !important;
    border-color: #9a0031 !important;
    transform: translateY(-1px) !important;
}

/* Вторичная кнопка - прозрачная с рамкой */
.btn-secondary,
.checkout-btn-continue {
    background: transparent !important;
    color: #c0153b !important;
    border: 1px solid #c0153b !important;
    padding: 14px 36px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    min-width: 180px !important;
}

.btn-secondary:hover,
.checkout-btn-continue:hover {
    background: #c0153b !important;
    color: #fff !important;
    transform: translateY(-1px) !important;
}

/* === ТАБЛИЦА ТОВАРОВ В CHECKOUT === */

/* Заголовок таблицы */
.checkout-section__title,
#simplecheckout .bx_ordercart h2,
.bx_ordercart h2 {
    font-size: 18px !important;
    font-weight: 600 !important;
    color: #0f0f0f !important;
    margin: 0 0 20px 0 !important;
    padding: 0 0 16px 0 !important;
    border-bottom: 2px solid #e2e2e2 !important;
    line-height: 1.4 !important;
    text-align: center !important;
}

/* Контейнер таблицы */
.bx_ordercart_order_table_container {
    border: 1px solid #e2e2e2 !important;
    border-radius: 6px !important;
    overflow: hidden !important;
    margin: 20px 0 !important;
}

/* МАКСИМАЛЬНАЯ СПЕЦИФИЧНОСТЬ - переосилить все конфликты h2 */
div.bx_ordercart h2.checkout-section__title,
#simplecheckout div.bx_ordercart h2,
form div.bx_ordercart h2,
.bx_ordercart > h2 {
    font-size: 18px !important;
    font-weight: 600 !important;
    color: #0f0f0f !important;
    margin: 0 0 20px 0 !important;
    padding: 0 0 16px 0 !important;
    border-bottom: 2px solid #e2e2e2 !important;
    line-height: 1.4 !important;
    text-align: center !important;
    display: block !important;
}

/* Сама таблица */
.bx_ordercart_order_table_container table {
    width: 100% !important;
    border-collapse: collapse !important;
    background: #fff !important;
}

/* Заголовок таблицы (thead) */
.bx_ordercart_order_table_container thead {
    background: #f9fafb !important;
}

.bx_ordercart_order_table_container thead tr {
    border-bottom: 2px solid #e2e2e2 !important;
}

.bx_ordercart_order_table_container thead td {
    padding: 16px 12px !important;
    font-weight: 600 !important;
    color: #606060 !important;
    font-size: 13px !important;
    text-align: left !important;
    text-transform: uppercase !important;
    letter-spacing: 0.025em !important;
}

/* Строки таблицы */
.bx_ordercart_order_table_container tbody tr {
    border-bottom: 1px solid #e2e2e2 !important;
    transition: background-color 0.2s !important;
}

.bx_ordercart_order_table_container tbody tr:hover {
    background: #f9fafb !important;
}

/* Ячейки таблицы */
.bx_ordercart_order_table_container tbody td {
    padding: 16px 12px !important;
    vertical-align: middle !important;
    border: none !important;
}

.bx_ordercart_order_table_container td.margin {
    width: 0 !important;
    padding: 0 !important;
}

.bx_ordercart_order_table_container td.item {
    font-weight: 500 !important;
    color: #0f0f0f !important;
}

.bx_ordercart_order_table_container td.price {
    text-align: right !important;
    font-weight: 600 !important;
    color: #c0153b !important;
}

.bx_ordercart_order_table_container td.custom {
    text-align: center !important;
}

/* Фото товара */
.bx_ordercart_photo_container {
    width: 80px !important;
    height: 80px !important;
    min-width: 80px !important;
    min-height: 80px !important;
    border-radius: 6px !important;
    overflow: hidden !important;
    background: #f9fafb !important;
    border: 1px solid #e2e2e2 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Переосилить конфликты с cart-modern */
.bx_ordercart .bx_ordercart_order_table_container .bx_ordercart_photo_container,
#simplecheckout .bx_ordercart_photo_container {
    width: 80px !important;
    height: 80px !important;
    min-width: 80px !important;
    min-height: 80px !important;
}

.bx_ordercart_photo {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
    background-size: contain !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-color: transparent !important;
}

/* Убедиться что фото видно - явно показать размер */
.bx_ordercart_order_table_container td.itemphoto .bx_ordercart_photo_container .bx_ordercart_photo {
    width: 80px !important;
    height: 80px !important;
    min-width: 80px !important;
    min-height: 80px !important;
}

/* Название товара */
.bx_ordercart_itemtitle {
    font-size: 15px !important;
    font-weight: 600 !important;
    margin: 0 !important;
}

.bx_ordercart_itemtitle a {
    color: #0f0f0f !important;
    text-decoration: none !important;
    transition: color 0.2s !important;
}

.bx_ordercart_itemtitle a:hover {
    color: #c0153b !important;
}

/* Итоговая таблица */
.bx_ordercart_order_sum {
    border: 1px solid #e2e2e2 !important;
    border-radius: 6px !important;
    background: #fff9fa !important;
    padding: 16px !important;
    margin-top: 20px !important;
}

.bx_ordercart_order_sum tr td {
    padding: 8px 0 !important;
    border: none !important;
}

.bx_ordercart_order_sum tr:last-child td {
    padding-top: 12px !important;
    padding-bottom: 0 !important;
    border-top: 2px solid #e2e2e2 !important;
    font-weight: 700 !important;
    font-size: 16px !important;
    color: #c0153b !important;
}

.bx_ordercart_order_sum .custom_t1 {
    color: #606060 !important;
    font-weight: 500 !important;
    text-align: left !important;
}

.bx_ordercart_order_sum .custom_t2 {
    color: #0f0f0f !important;
    font-weight: 600 !important;
    text-align: right !important;
}

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

@media (max-width: 768px) {
    #simplecheckout_form input,
    #simplecheckout_form textarea,
    .checkout-form input,
    .checkout-form textarea {
        font-size: 16px !important; /* Предотвращает zoom на iOS */
    }

    .btn-primary,
    .btn-secondary,
    #simplecheckout_btn_order {
        min-width: 100% !important;
        width: 100% !important;
        padding: 12px 20px !important;
    }

    /* Таблица на мобилях */
    .bx_ordercart_order_table_container {
        margin: 16px 0 !important;
    }

    .bx_ordercart_order_table_container thead td {
        padding: 12px 8px !important;
        font-size: 12px !important;
    }

    .bx_ordercart_order_table_container tbody td {
        padding: 12px 8px !important;
        font-size: 14px !important;
    }

    .bx_ordercart_photo_container {
        width: 60px !important;
        height: 60px !important;
    }

    .bx_ordercart_itemtitle {
        font-size: 13px !important;
    }
}
