.cart-container {
    max-width: 1200px; 
    width: 100%;
    margin: 40px auto;
    padding: 30px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

h1 {
    margin-bottom: 30px;
    font-size: 32px;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

/* === Таблиця === */
.cart-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 30px;
}

.cart-table th {
    text-align: left;
    padding: 15px;
    background-color: #f8f9fa;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 13px;
    border-bottom: 2px solid #e9ecef;
}

.cart-table td {
    padding: 20px 15px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

/* === Стилі колонок === */
.col-price, .col-total {
    text-align: right;
    font-weight: 600;
    font-size: 16px;
    color: #333;
    white-space: nowrap;
}
.col-total {
    color: #28a745;
}
.col-qty {
    text-align: center;
    width: 140px;
}
.col-remove {
    text-align: center;
    width: 50px;
}

/* === Товар (Фото + Назва) === */
.product-cell {
    display: flex;
    align-items: center;
    gap: 15px;
}
.cart-img {
    width: 180px;
    height: 180px;
    object-fit: contain;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 5px;
    background: #fff;
}
.product-name-link {
    text-decoration: none;
    color: #333;
    font-weight: 600;
    font-size: 15px;
    line-height: 1.4;
    transition: 0.2s;
}
.product-name-link:hover {
    color: #337ab7;
}

/* === Форма кількості === */
.qty-update-form {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
}
.qty-update-input {
    width: 50px;
    padding: 6px;
    text-align: center;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 15px;
}
.btn-update {
    background: #e9ecef;
    border: none;
    color: #495057;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}
.btn-update:hover {
    background: #337ab7;
    color: #fff;
}

/* === Кнопка видалення === */
.btn-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: #adb5bd;
    font-size: 24px;
    transition: 0.2s;
    line-height: 1;
}
.btn-remove:hover {
    color: #dc3545;
}

/* === Футер кошика (Разом) === */
.cart-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    flex-wrap: wrap;
    gap: 20px;
}

.continue-shopping {
    color: #666;
    text-decoration: none;
    font-weight: 500;
}
.continue-shopping:hover { color: #337ab7; }

.cart-total-box {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.total-label {
    font-size: 16px;
    color: #555;
    margin-right: 10px;
}
.total-price {
    font-size: 28px;
    font-weight: 700;
    color: #28a745;
}

.checkout-btn {
    display: inline-block;
    background: #28a745;
    color: #fff;
    padding: 12px 30px;
    text-decoration: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    margin-top: 10px;
    transition: 0.2s;
}
.checkout-btn:hover {
    background: #218838;
}

/* === Порожній кошик === */
.empty-cart {
    text-align: center;
    padding: 60px 20px;
}
.empty-cart p {
    font-size: 18px;
    color: #777;
    margin-bottom: 20px;
}
.btn-back {
    display: inline-block;
    background: #337ab7;
    color: #fff;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 4px;
}

/* === АДАПТИВНІСТЬ (Мобільна версія) === */
@media (max-width: 768px) {
    .cart-container {
        padding: 15px;
        margin: 20px auto;
    }

    /* Ховаємо шапку таблиці */
    .cart-table thead {
        display: none;
    }

    /* Рядок таблиці стає блоком (карткою) */
    .cart-table tr {
        display: block;
        margin-bottom: 20px;
        border: 1px solid #e1e1e1;
        border-radius: 8px;
        padding: 15px;
        background: #fff;
        box-shadow: 0 2px 5px rgba(0,0,0,0.03);
    }

    /* Комірки стають рядками всередині картки */
    .cart-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px solid #f0f0f0;
        padding: 10px 0;
        text-align: right;
    }
    
    .cart-table td:last-child {
        border-bottom: none;
    }

    /* Додаємо підписи (Ціна, Кількість...) через data-label */
    .cart-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #777;
        font-size: 14px;
        text-align: left;
    }

    /* Виняток для фото і назви */
    .cart-table td[data-label="Товар"] {
        display: block;
        text-align: center;
        border-bottom: 1px solid #eee;
        padding-bottom: 15px;
    }
    .cart-table td[data-label="Товар"]::before {
        display: none; /* Не показувати слово "Товар" */
    }

    .product-cell {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .product-name-link {
        font-size: 16px;
        margin-top: 10px;
    }

    /* Вирівнювання форми кількості */
    .qty-update-form {
        justify-content: flex-end;
    }
    .col-qty { width: 100%; }
    .col-remove { width: 100%; text-align: right; }
    
    /* Футер на мобільному */
    .cart-footer {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }
    .cart-total-box {
        width: 100%;
        align-items: center;
    }
    .checkout-btn {
        width: 100%;
        text-align: center;
        padding: 15px;
    }
}

/* --- ОФОРМЛЕННЯ ЗАМОВЛЕННЯ (CHECKOUT) --- */

.checkout-container {
    max-width: 1200px; /* Трохи вужче за кошик для кращого сприйняття форми */
    width: 100%;
    margin: 40px auto;
    padding: 0 20px;
    
    /* Grid-сітка для макета */
    display: grid;
    grid-template-columns: 1fr 380px; /* Основна частина + Сайдбар */
    grid-template-rows: auto auto; /* Заголовок + Контент */
    gap: 30px;
    align-items: start; 
}

.checkout-container h1 {
    grid-column: 1 / -1;
    margin-bottom: 20px;
    font-size: 32px;
    color: #333;
}

.order-summary {
    grid-column: 2; /* Ставимо у другу колонку */
    grid-row: 2;
    
    background: #f8f9fa; /* Світло-сірий фон */
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    padding: 25px;
    position: sticky; /* Липне при скролі */
    top: 20px;
}

.order-summary h3 {
    margin-top: 0;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #ddd;
    font-size: 20px;
    color: #333;
}

.order-summary ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.order-summary li {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 14px;
    color: #555;
    line-height: 1.4;
}

.order-summary li b {
    color: #333;
    white-space: nowrap;
    margin-left: 10px;
}

.total-line {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #ddd;
    font-size: 22px;
    font-weight: 800;
    text-align: right;
    color: #28a745;
}

/* 3. Форма (Основна частина ліворуч) */
.checkout-container form {
    grid-column: 1; /* Ставимо у першу колонку */
    grid-row: 2;
    
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border: 1px solid #e1e1e1;
}

/* Стилі полів */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #444;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.2s;
    box-sizing: border-box; /* Важливо для padding */
}

.form-control:focus {
    border-color: #337ab7;
    outline: none;
    box-shadow: 0 0 5px rgba(51, 122, 183, 0.2);
}

/* Радіо-кнопки (вибір доставки/оплати) */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.radio-group label {
    display: flex;
    align-items: center;
    padding: 12px;
    border: 1px solid #eee;
    border-radius: 5px;
    cursor: pointer;
    background: #fff;
    transition: 0.2s;
    font-weight: normal; /* Знімаємо жирність, яку дає .form-group label */
    margin-bottom: 0;
}

.radio-group label:hover {
    background-color: #f9f9f9;
    border-color: #ccc;
}

.radio-group input[type="radio"] {
    margin-right: 12px;
    transform: scale(1.2); /* Трохи збільшуємо кружечок */
}

/* Блок Нової Пошти */
#np-fields {
    display: none; /* Сховано за замовчуванням */
    margin-top: 15px;
    padding: 20px;
    background: #f0f8ff; /* Легкий блакитний відтінок */
    border-radius: 5px;
    border-left: 4px solid #337ab7;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Розділювач */
hr {
    border: 0;
    border-top: 1px solid #eee;
    margin: 30px 0;
}

/* Кнопка підтвердження */
.btn-submit {
    display: block;
    width: 100%;
    padding: 16px;
    background-color: #28a745;
    color: white;
    font-size: 18px;
    font-weight: bold;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: background 0.2s, transform 0.1s;
    margin-top: 10px;
}

.btn-submit:hover {
    background-color: #218838;
}

.btn-submit:active {
    transform: scale(0.99);
}

/* АДАПТАЦІЯ ПІД МОБІЛЬНІ */
@media (max-width: 992px) {
    .checkout-container {
        display: flex; /* Повертаємо звичайний потік */
        flex-direction: column;
        padding: 15px;
    }
    
    .checkout-container h1 {
        order: 1;
    }
    
    /* На мобільному спочатку "Ваше замовлення", потім форма */
    .order-summary {
        order: 2;
        position: static; /* Прибираємо липкість */
        margin-bottom: 20px;
    }
    
    .checkout-container form {
        order: 3;
    }
}