﻿/* ============================================
   СТИЛИ ДЛЯ СТРАНИЦЫ КОРЗИНЫ
   ============================================ */

/* Основной контейнер страницы */
.cart-page {
    padding: 60px 0;
    background-color: #f5f5f7;
    min-height: calc(100vh - 300px);
}

.cart-page h1 {
    text-align: center;
    margin-bottom: 40px;
    color: var(--dark-text);
}

/* Хлебные крошки */
.breadcrumb-section {
    font-size: 14px;
    color: var(--gray-text);
    margin-bottom: 20px;
}

.breadcrumb-section a {
    color: var(--primary-color);
    text-decoration: none;
}

.breadcrumb-section a:hover {
    text-decoration: underline;
}

/* Контейнер корзины: две колонки */
.cart-container {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 30px;
    align-items: start;
}

/* ========== ЛЕВАЯ КОЛОНКА: ТОВАРЫ ========== */

.cart-items-section {
    background: var(--white);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow);
}

/* Товар в корзине */
.cart-item {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    border: 1px solid #e0e6ed;
    border-radius: var(--radius);
    background: #fafafa;
    margin-bottom: 20px;
    position: relative;
    transition: var(--transition);
}

.cart-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* Изображение товара */
.cart-item-image {
    width: 100px;
    height: 100px;
    flex-shrink: 0;
    background: var(--white);
    border-radius: var(--radius);
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-item-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Детали товара */
.cart-item-details {
    flex-grow: 1;
    min-width: 0;
}

.cart-item-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--dark-text);
    margin-bottom: 8px;
    line-height: 1.3;
}

.cart-item-price {
    font-size: 16px;
    color: var(--gray-text);
    margin: 0;
}

.item-price {
    font-weight: 700;
    color: var(--primary-color);
}

/* Селектор количества */
.cart-item-controls {
    display: flex;
    align-items: center;
}

.quantity-selector {
    display: flex;
    align-items: center;
    border: 2px solid #e0e6ed;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--white);
}

.qty-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--white);
    color: var(--primary-color);
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.qty-btn:hover {
    background: var(--light-blue);
}

.qty-btn:active {
    transform: scale(0.95);
}

.qty-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.qty-input {
    width: 60px;
    height: 40px;
    border: none;
    border-left: 1px solid #e0e6ed;
    border-right: 1px solid #e0e6ed;
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    color: var(--dark-text);
    background: var(--white);
    -moz-appearance: textfield;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Итоговая цена товара */
.cart-item-total {
    font-size: 22px;
    font-weight: 800;
    color: var(--dark-text);
    min-width: 140px;
    text-align: right;
}

/* Кнопка удаления */
.cart-item-remove {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: #dc3545;
    font-size: 18px;
    cursor: pointer;
    border-radius: 50%;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-item-remove:hover {
    background: #fff5f5;
    transform: scale(1.1);
}

/* Пустая корзина */
.empty-cart-message {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-text);
}

.empty-cart-message i {
    font-size: 80px;
    color: #e0e6ed;
    margin-bottom: 20px;
}

.empty-cart-message h3 {
    font-size: 24px;
    color: var(--dark-text);
    margin-bottom: 10px;
}

.empty-cart-message p {
    margin-bottom: 30px;
}

/* ========== СПОСОБЫ ОПЛАТЫ ========== */

.payment-methods-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #e0e6ed;
}

.payment-methods-section h3 {
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--dark-text);
}

.payment-option {
    margin-bottom: 15px;
}

.payment-option input[type="radio"] {
    display: none;
}

.payment-option label {
    display: block;
    padding: 18px 20px;
    border: 2px solid #e0e6ed;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    background: var(--white);
}

.payment-option label:hover {
    border-color: var(--secondary-color);
    background: #f8f9fa;
}

.payment-option input[type="radio"]:checked + label {
    border-color: var(--primary-color);
    background: var(--light-blue);
    box-shadow: 0 2px 8px rgba(0, 85, 164, 0.15);
}

.payment-option label strong {
    display: block;
    font-size: 16px;
    margin-bottom: 4px;
    color: var(--dark-text);
}

.payment-description {
    font-size: 14px;
    color: var(--gray-text);
}

/* ========== ПРАВАЯ КОЛОНКА: ИТОГО ========== */

.cart-summary-section {
    position: sticky;
    top: 120px;
}

.cart-summary {
    background: var(--white);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow);
    border: 2px solid var(--primary-color);
}

.cart-summary h3 {
    font-size: 24px;
    margin-bottom: 20px;
    color: var(--dark-text);
    text-align: center;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 16px;
    color: var(--dark-text);
}

.summary-row span:last-child {
    font-weight: 700;
}

.cod-commission {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.cart-summary hr {
    border: none;
    border-top: 2px solid #e0e6ed;
    margin: 20px 0;
}

.summary-total {
    font-size: 22px;
    font-weight: 800;
    color: var(--primary-color);
}

.btn-checkout {
    margin-top: 20px;
    font-size: 18px;
    padding: 16px;
}

.btn-checkout:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-checkout:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* ========== ИНФОРМАЦИОННЫЕ БЛОКИ ========== */

.info-box {
    margin-top: 20px;
    padding: 15px;
    border-radius: var(--radius);
    font-size: 14px;
    line-height: 1.5;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.info-box i {
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 2px;
}

.warning-notice {
    background: #fff9e6;
    border: 1px solid #ffcc80;
    color: #663c00;
}

.warning-notice i {
    color: #ff9800;
}

.error-notice {
    background: #fff5f5;
    border: 2px solid #dc3545;
    color: #721c24;
    animation: shake 0.4s ease;
}

.error-notice i {
    color: #dc3545;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ========== МОДАЛЬНЫЕ ОКНА ========== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
    overflow-y: auto;
    padding: 20px;
}

.modal-content {
    background: var(--white);
    border-radius: 12px;
    padding: 40px;
    max-width: 550px;
    width: 100%;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.4s ease;
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Кнопка закрытия */
.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--gray-text);
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    transition: var(--transition);
    border-radius: 50%;
}

.modal-close:hover {
    background: #f5f5f7;
    color: var(--dark-text);
    transform: rotate(90deg);
}

/* Модальное окно оформления заказа */
.checkout-modal h2 {
    font-size: 26px;
    margin-bottom: 10px;
    color: var(--dark-text);
    text-align: center;
}

.modal-subtitle {
    text-align: center;
    color: var(--gray-text);
    font-size: 14px;
    margin-bottom: 30px;
    line-height: 1.5;
}

.checkout-modal .form-group {
    margin-bottom: 20px;
    text-align: left;
}

.checkout-modal .form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--dark-text);
    font-size: 15px;
}

.checkout-modal .form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e6ed;
    border-radius: var(--radius);
    font-size: 16px;
    transition: var(--transition);
    font-family: inherit;
}

.checkout-modal .form-group input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 85, 164, 0.1);
}

.checkout-modal .form-group input::placeholder {
    color: #aaa;
}

.checkout-modal .btn-block {
    margin-top: 10px;
    font-size: 18px;
    padding: 16px;
}

/* Модальное окно успеха */
.success-modal {
    text-align: center;
}

.modal-icon {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    margin: 0 auto 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: scaleIn 0.5s ease;
}

@keyframes scaleIn {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

.modal-icon.success {
    background: #e6f6f0;
}

.modal-icon.success i {
    font-size: 45px;
    color: var(--green);
}

.success-modal h3 {
    font-size: 26px;
    margin-bottom: 15px;
    color: var(--dark-text);
}

.success-modal p {
    font-size: 16px;
    color: var(--gray-text);
    margin-bottom: 25px;
    line-height: 1.6;
}

.order-summary {
    background: var(--light-gray);
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 25px;
    text-align: left;
}

.order-summary .summary-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 15px;
}

.order-summary .summary-item:last-child {
    margin-bottom: 0;
    padding-top: 10px;
    border-top: 2px solid #ddd;
    font-weight: 700;
    font-size: 18px;
    color: var(--primary-color);
}

.btn-secondary {
    background: #f5f5f7;
    color: var(--dark-text);
    border: 1px solid #ddd;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

/* ========== АДАПТИВНОСТЬ ========== */

@media (max-width: 992px) {
    .cart-container {
        grid-template-columns: 1fr;
    }

    .cart-summary-section {
        position: static;
        order: -1; /* Сводка сверху на планшетах */
    }

    .cart-item {
        flex-wrap: wrap;
        gap: 15px;
    }

    .cart-item-image {
        width: 80px;
        height: 80px;
    }

    .cart-item-details {
        flex-basis: 100%;
    }

    .cart-item-total {
        min-width: auto;
    }
}

@media (max-width: 768px) {
    .cart-page {
        padding: 40px 0;
    }

    .cart-items-section,
    .cart-summary {
        padding: 20px;
    }

    .cart-item {
        padding: 15px;
        gap: 10px;
    }

    .cart-item-image {
        width: 70px;
        height: 70px;
    }

    .cart-item-title {
        font-size: 16px;
    }

    .cart-item-price {
        font-size: 14px;
    }

    .cart-item-total {
        font-size: 18px;
        text-align: left;
        width: 100%;
    }

    .cart-item-controls {
        width: 100%;
        justify-content: space-between;
    }

    .quantity-selector {
        width: 100%;
        max-width: 200px;
    }

    .cart-item-remove {
        top: 10px;
        right: 10px;
        width: 32px;
        height: 32px;
        font-size: 16px;
    }

    .payment-option label {
        padding: 15px;
    }

    /* Модальные окна на мобильных */
    .modal-overlay {
        padding: 10px;
    }

    .modal-content {
        padding: 30px 20px;
        max-height: 95vh;
    }

    .checkout-modal h2 {
        font-size: 22px;
    }

    .modal-subtitle {
        font-size: 13px;
    }

    .checkout-modal .form-group input {
        font-size: 16px; /* Для предотвращения зума на iOS */
    }

    .modal-icon {
        width: 75px;
        height: 75px;
    }

    .modal-icon.success i {
        font-size: 38px;
    }

    .success-modal h3 {
        font-size: 22px;
    }

    .order-summary {
        padding: 15px;
    }

    .order-summary .summary-item {
        font-size: 14px;
    }
}
