/* ========== Стили для страницы корзины ========== */

/* Заголовок корзины */
.cart-header {
    padding: 160px 0 80px;
    background: var(--secondary-dark);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.cart-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(255, 23, 68, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.cart-header h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.cart-header p {
    color: var(--text-secondary);
    font-size: 1.2rem;
    margin-bottom: 30px;
    position: relative;
    z-index: 1;
}

.cart-header .back-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    text-decoration: none;
    padding: 12px 25px;
    border: 1px solid var(--accent-red);
    border-radius: 8px;
    transition: var(--transition);
    position: relative;
    z-index: 1;
}

.cart-header .back-link:hover {
    background: var(--accent-red);
    box-shadow: 0 0 20px var(--accent-red-glow);
}

/* Содержимое корзины */
.cart-content {
    padding: 80px 0;
    min-height: 400px;
    background: var(--primary-dark);
}

/* Пустая корзина */
.cart-empty {
    text-align: center;
    padding: 80px 20px;
}

.cart-empty i {
    font-size: 5rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.cart-empty h2 {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.cart-empty p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* Товары в корзине */
.cart-items {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 40px;
}

.cart-products {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.cart-item {
    display: flex;
    gap: 25px;
    padding: 25px;
    background: var(--secondary-dark);
    border-radius: 15px;
    border: 1px solid transparent;
    transition: var(--transition);
}

.cart-item:hover {
    border-color: var(--accent-red);
    box-shadow: 0 0 30px var(--accent-red-glow);
}

.cart-item-image {
    width: 160px;
    height: 160px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--primary-dark);
}

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

.cart-item-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.cart-item-details h3 {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.cart-item-price {
    color: var(--accent-red);
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

/* Управление количеством */
.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1rem;
}

.quantity-btn {
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: transparent;
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quantity-btn:hover {
    background: var(--accent-red);
    border-color: var(--accent-red);
    box-shadow: 0 0 15px var(--accent-red-glow);
}

.quantity-value {
    min-width: 40px;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.cart-item-remove {
    padding: 10px 20px;
    border: 2px solid var(--accent-red);
    background: transparent;
    color: var(--accent-red);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    align-self: flex-start;
}

.cart-item-remove:hover {
    background: var(--accent-red);
    color: white;
    box-shadow: 0 0 20px var(--accent-red-glow);
}

/* Итого */
.cart-summary {
    background: var(--secondary-dark);
    padding: 35px;
    border-radius: 15px;
    height: fit-content;
    position: sticky;
    top: 100px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.cart-summary h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.summary-row span:last-child {
    color: var(--text-primary);
    font-weight: 600;
}

.checkout-btn {
    width: 100%;
    padding: 16px;
    margin-top: 20px;
    background: var(--accent-red);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 0 20px var(--accent-red-glow);
}

.checkout-btn:hover {
    background: transparent;
    border: 2px solid var(--accent-red);
    box-shadow: 0 0 40px var(--accent-red-glow);
    transform: translateY(-2px);
}

.continue-link {
    display: block;
    text-align: center;
    margin-top: 15px;
    color: var(--accent-red);
    text-decoration: none;
    transition: var(--transition);
}

.continue-link:hover {
    text-shadow: 0 0 10px var(--accent-red-glow);
}

/* Кнопка в пустой корзине */
.cart-empty .product-cta {
    display: inline-block;
    padding: 12px 35px;
    background: transparent;
    border: 2px solid var(--accent-red);
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    border-radius: 8px;
    transition: var(--transition);
    box-shadow: 0 0 15px var(--accent-red-glow);
}

.cart-empty .product-cta:hover {
    background: var(--accent-red);
    box-shadow: 0 0 30px var(--accent-red-glow);
    transform: translateY(-2px);
}

/* Адаптивность */
@media (max-width: 900px) {
    .cart-items {
        grid-template-columns: 1fr;
    }

    .cart-summary {
        position: static;
    }

    .cart-item {
        flex-direction: column;
    }

    .cart-item-image {
        width: 100%;
        height: 200px;
    }
}

@media (max-width: 600px) {
    .cart-header {
        padding: 140px 0 60px;
    }

    .cart-item {
        padding: 20px;
    }

    .cart-summary {
        padding: 25px 20px;
    }
}

/* ========== Модальное окно оформления заказа ========== */
.checkout-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.checkout-modal.active {
    display: flex;
}

.checkout-modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.checkout-modal__content {
    position: relative;
    background: var(--secondary-dark);
    border-radius: 20px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid rgba(255, 23, 68, 0.3);
    box-shadow: 0 0 60px var(--accent-red-glow);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.checkout-modal__close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.checkout-modal__close:hover {
    background: rgba(255, 23, 68, 0.2);
    color: var(--accent-red);
}

.checkout-modal__header {
    margin-bottom: 30px;
    text-align: center;
}

.checkout-modal__header h2 {
    font-size: 1.8rem;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.checkout-modal__header p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Форма оформления заказа */
.checkout-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.checkout-form__field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.checkout-form__field label {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.95rem;
}

.checkout-form__field input {
    padding: 14px 18px;
    background: var(--primary-dark);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
}

.checkout-form__field input:focus {
    outline: none;
    border-color: var(--accent-red);
    box-shadow: 0 0 15px rgba(255, 23, 68, 0.3);
}

.checkout-form__field input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.checkout-form__summary {
    background: var(--primary-dark);
    padding: 20px;
    border-radius: 12px;
    margin-top: 10px;
}

.checkout-form__summary h3 {
    color: var(--text-primary);
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.checkout-form__items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkout-form__item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}

.checkout-form__item-name {
    color: var(--text-primary);
    font-size: 0.95rem;
}

.checkout-form__item-price {
    color: var(--accent-red);
    font-weight: 600;
}

.checkout-form__actions {
    margin-top: 10px;
}

.checkout-form__submit {
    width: 100%;
    padding: 16px;
    background: var(--accent-red);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 0 20px var(--accent-red-glow);
}

.checkout-form__submit:hover {
    background: transparent;
    border: 2px solid var(--accent-red);
    transform: translateY(-2px);
}

.checkout-form__submit:disabled {
    background: var(--text-secondary);
    cursor: not-allowed;
    transform: none;
}

.checkout-form__error,
.checkout-form__success {
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    font-size: 0.95rem;
    display: none;
}

.checkout-form__error {
    background: rgba(255, 23, 68, 0.2);
    color: #ff6b6b;
    border: 1px solid rgba(255, 23, 68, 0.5);
}

.checkout-form__success {
    background: rgba(76, 175, 80, 0.2);
    color: #81c784;
    border: 1px solid rgba(76, 175, 80, 0.5);
}

.checkout-form__error.show,
.checkout-form__success.show {
    display: block;
}

/* Адаптивность для модального окна */
@media (max-width: 600px) {
    .checkout-modal__content {
        padding: 30px 25px;
        width: 95%;
    }

    .checkout-modal__header h2 {
        font-size: 1.5rem;
    }
}

/* ========== Модальное окно "Товар добавлен в корзину" ========== */
.added-to-cart-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.added-to-cart-modal.show {
    opacity: 1;
}

.added-to-cart-modal.closing {
    opacity: 0;
}

.added-to-cart-modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
}

.added-to-cart-modal__content {
    position: relative;
    background: var(--secondary-dark);
    border-radius: 24px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    border: 2px solid rgba(255, 23, 68, 0.3);
    box-shadow: 0 0 80px rgba(255, 23, 68, 0.4);
    animation: addedModalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes addedModalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-100px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.added-to-cart-modal__close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.added-to-cart-modal__close:hover {
    background: rgba(255, 23, 68, 0.2);
    color: var(--accent-red);
    transform: rotate(90deg);
}

.added-to-cart-modal__icon {
    text-align: center;
    margin-bottom: 25px;
}

.added-to-cart-modal__icon i {
    font-size: 4.5rem;
    color: var(--accent-red);
    animation: iconPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-shadow: 0 0 40px var(--accent-red-glow);
}

@keyframes iconPop {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.added-to-cart-modal__title {
    text-align: center;
    font-size: 1.6rem;
    color: var(--text-primary);
    margin-bottom: 30px;
    font-weight: 700;
}

.added-to-cart-modal__product {
    display: flex;
    gap: 20px;
    padding: 25px;
    background: var(--primary-dark);
    border-radius: 16px;
    margin-bottom: 30px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.added-to-cart-modal__product-image {
    width: 120px;
    height: 120px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--secondary-dark);
}

.added-to-cart-modal__product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.added-to-cart-modal__product-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.added-to-cart-modal__product-info h3 {
    font-size: 1.15rem;
    color: var(--text-primary);
    margin-bottom: 10px;
    line-height: 1.4;
}

.added-to-cart-modal__product-price {
    font-size: 1.4rem;
    color: var(--accent-red);
    font-weight: 700;
    text-shadow: 0 0 20px var(--accent-red-glow);
}

.added-to-cart-modal__product-quantity {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-top: 8px;
}

.added-to-cart-modal__actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 25px;
}

.added-to-cart-modal__btn-primary,
.added-to-cart-modal__btn-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 18px 30px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.added-to-cart-modal__btn-primary {
    background: var(--accent-red);
    color: var(--text-primary);
    border: none;
    box-shadow: 0 0 25px var(--accent-red-glow);
}

.added-to-cart-modal__btn-primary:hover {
    background: transparent;
    border: 2px solid var(--accent-red);
    box-shadow: 0 0 40px var(--accent-red-glow);
    transform: translateY(-2px);
}

.added-to-cart-modal__btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.added-to-cart-modal__btn-secondary:hover {
    border-color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
}

.added-to-cart-modal__cart-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 18px 30px;
    background: transparent;
    color: var(--text-primary);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.added-to-cart-modal__cart-info:hover {
    border-color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
}

.added-to-cart-modal__cart-info span {
    color: var(--text-primary);
    font-size: 1rem;
}

.added-to-cart-modal__cart-info strong {
    color: var(--accent-red);
    font-size: 1rem;
    text-shadow: 0 0 15px var(--accent-red-glow);
}

/* Адаптивность для модального окна добавления */
@media (max-width: 600px) {
    .added-to-cart-modal__content {
        padding: 30px 25px;
        width: 95%;
    }

    .added-to-cart-modal__title {
        font-size: 1.3rem;
    }

    .added-to-cart-modal__product {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .added-to-cart-modal__product-image {
        width: 150px;
        height: 150px;
    }

    .added-to-cart-modal__icon i {
        font-size: 3.5rem;
    }
}
