/* ==================================================================
   CART.CSS — СТРАНИЦА КОРЗИНЫ АВТОСАЛОНА
   КРАСНО-БЕЛАЯ ТЕМА | ПРОФЕССИОНАЛЬНЫЙ ДИЗАЙН
   ================================================================== */

/* -------------------- RESET & БАЗА -------------------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Montserrat', sans-serif;
    background: #ffffff;
    color: #1a1a1a;
    line-height: 1.5;
}

.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 30px;
}

img {
    max-width: 100%;
    height: auto;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* -------------------- ЦВЕТОВАЯ СХЕМА -------------------- */
:root {
    --red: #dc2626;
    --red-dark: #b91c1c;
    --red-light: #fef2f2;
    --dark: #111111;
    --gray: #666666;
    --gray-light: #f5f5f5;
    --border: #e5e5e5;
    --shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 10px 30px rgba(220, 38, 38, 0.15);
}

/* -------------------- ШАПКА -------------------- */
.header {
    background: white;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 15px 30px;
    max-width: 1300px;
    margin: 0 auto;
}

.logo img {
    height: 70px;
    width: auto;
}

.nav-list {
    display: flex;
    gap: 35px;
}

.nav-link {
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 1px;
    color: var(--dark);
    padding-bottom: 5px;
    border-bottom: 2px solid transparent;
    transition: 0.2s;
}

.nav-link:hover {
    border-bottom-color: var(--red);
    color: var(--red);
}

.header-contacts {
    text-align: right;
}

.header-phone {
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.cart-icon {
    position: relative;
    font-size: 1.5rem;
    color: var(--dark);
}

.cart-count {
    position: absolute;
    top: -10px;
    right: -12px;
    background: var(--red);
    color: white;
    font-size: 0.65rem;
    font-weight: bold;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--red);
}

/* -------------------- ХЛЕБНЫЕ КРОШКИ -------------------- */
.page-header {
    background: linear-gradient(135deg, #fff 0%, var(--red-light) 100%);
    padding: 40px 0;
    border-bottom: 1px solid var(--border);
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--dark);
}

.page-header .accent-text {
    color: var(--red);
}

.breadcrumbs {
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--gray);
}

.breadcrumbs a:hover {
    color: var(--red);
}

/* -------------------- ОСНОВНАЯ СЕКЦИЯ -------------------- */
.cart-section {
    padding: 60px 0;
    background: white;
}

.cart-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 40px;
}

/* -------------------- ТОВАРЫ В КОРЗИНЕ -------------------- */
.cart-section-title {
    font-size: 1.3rem;
    font-weight: 800;
    margin-bottom: 25px;
    color: var(--dark);
}

.cart-count-badge {
    background: var(--red);
    color: white;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    margin-left: 10px;
}

/* Карточка товара в корзине */
.cart-item {
    display: flex;
    align-items: center;
    gap: 20px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 15px;
    transition: all 0.3s;
}

.cart-item:hover {
    box-shadow: var(--shadow);
    border-color: var(--red-light);
}

.cart-item-image {
    width: 100px;
    height: 100px;
    background: var(--gray-light);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 10px;
}

/* Разметка из cart.js */
.cart-item .item-image {
    width: 100px;
    height: 100px;
    min-width: 100px;
    flex-shrink: 0;
    background: var(--gray-light);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-item .item-image img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    padding: 8px;
}

.cart-item-details {
    flex: 1;
}

.cart-item-title {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 8px;
    color: var(--dark);
}

.cart-item-price {
    color: var(--red);
    font-weight: 800;
    font-size: 1.1rem;
}

.cart-item-old-price {
    font-size: 0.8rem;
    color: var(--gray);
    text-decoration: line-through;
    margin-left: 8px;
}

.cart-item-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.quantity-control {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--gray-light);
    border-radius: 40px;
    padding: 5px 10px;
}

.quantity-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    transition: 0.2s;
}

.quantity-btn:hover {
    background: var(--red);
    color: white;
}

.quantity-value {
    font-weight: 600;
    min-width: 30px;
    text-align: center;
}

.remove-btn {
    background: none;
    border: none;
    color: var(--gray);
    cursor: pointer;
    font-size: 1.2rem;
    transition: 0.2s;
}

.remove-btn:hover {
    color: var(--red);
}

.cart-item-total {
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--dark);
    min-width: 100px;
    text-align: right;
}

/* Пустая корзина */
.empty-cart {
    text-align: center;
    padding: 60px 20px;
    background: var(--red-light);
    border-radius: 20px;
}

.empty-cart i {
    font-size: 3rem;
    color: var(--red);
    margin-bottom: 15px;
}

.empty-cart h3 {
    font-size: 1.3rem;
    margin-bottom: 10px;
}

.empty-cart p {
    color: var(--gray);
    margin-bottom: 20px;
}

.empty-cart .btn {
    background: var(--red);
    color: white;
    padding: 12px 30px;
    border-radius: 40px;
    font-weight: 700;
    display: inline-block;
}

/* -------------------- БОКОВАЯ ПАНЕЛЬ -------------------- */
.cart-sidebar {
    position: sticky;
    top: 100px;
    height: fit-content;
}

/* Блок "Ваш заказ" */
.cart-total {
    background: var(--red-light);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 25px;
    border: 1px solid var(--border);
}

.total-title {
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--red);
    display: inline-block;
}

.total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 0.9rem;
    color: var(--gray);
}

.total-row.final {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--dark);
}

.total-row.final .final-price {
    color: var(--red);
}

.delivery-free {
    color: #10b981;
    font-weight: 600;
}

.bonus-info {
    background: white;
    border-radius: 12px;
    padding: 12px 15px;
    margin-top: 15px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.bonus-info i {
    color: #f59e0b;
    font-size: 1rem;
}

/* Блок оформления */
.checkout-block {
    margin-bottom: 20px;
}

.checkout-btn {
    width: 100%;
    background: var(--red);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 50px;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s;
}

.checkout-btn:hover {
    background: var(--red-dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(220, 38, 38, 0.3);
}

.checkout-info {
    margin-top: 15px;
    text-align: center;
}

.checkout-info p {
    font-size: 0.75rem;
    color: var(--gray);
    margin-bottom: 8px;
}

.checkout-info i {
    color: var(--red);
    width: 20px;
}

.continue-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--gray);
    transition: 0.2s;
}

.continue-link:hover {
    color: var(--red);
}

/* -------------------- МОДАЛЬНОЕ ОКНО -------------------- */
.checkout-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    background: white;
    border-radius: 24px;
    overflow-y: auto;
    z-index: 1001;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--gray);
    transition: 0.2s;
}

.modal-close:hover {
    color: var(--red);
}

.modal-header {
    text-align: center;
    padding: 30px 30px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header img {
    height: 60px;
    margin-bottom: 15px;
}

.modal-header h2 {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--dark);
}

.modal-header .accent-text {
    color: var(--red);
}

.modal-body {
    padding: 25px 30px 35px;
}

/* Прогресс-бар */
.checkout-progress {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    position: relative;
}

.checkout-progress::before {
    content: '';
    position: absolute;
    top: 15px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--border);
    z-index: 0;
}

.progress-step {
    text-align: center;
    z-index: 1;
    background: white;
    padding: 0 10px;
}

.step-number {
    width: 30px;
    height: 30px;
    background: var(--border);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.progress-step.active .step-number {
    background: var(--red);
    color: white;
}

.step-label {
    font-size: 0.7rem;
    color: var(--gray);
}

.progress-step.active .step-label {
    color: var(--red);
    font-weight: 600;
}

/* Форма */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--dark);
}

.checkout-input,
.checkout-select,
.checkout-textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.checkout-input:focus,
.checkout-select:focus,
.checkout-textarea:focus {
    outline: none;
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.checkout-textarea {
    min-height: 80px;
    resize: vertical;
}

/* Чекбокс согласия */
.agreement-group {
    margin: 20px 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.checkbox-label input {
    width: 18px;
    height: 18px;
    accent-color: var(--red);
    cursor: pointer;
}

.checkbox-label span {
    font-size: 0.8rem;
    color: var(--gray);
}

.agreement-link {
    color: var(--red);
    text-decoration: underline;
}

/* Кнопка отправки */
.submit-order-btn {
    width: 100%;
    background: var(--red);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s;
}

.submit-order-btn:hover {
    background: var(--red-dark);
    transform: translateY(-2px);
}

/* -------------------- ПОДВАЛ -------------------- */
.footer {
    background: var(--dark);
    color: #ccc;
    padding: 50px 0 25px;
    margin-top: 0;
}

.footer-content {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    justify-content: space-between;
    margin-bottom: 40px;
}

.footer-col {
    flex: 1;
    min-width: 180px;
}

.footer-logo img {
    height: 60px;
}

.footer h4 {
    color: white;
    font-size: 0.9rem;
    font-weight: 800;
    margin-bottom: 20px;
    letter-spacing: 1px;
}

.footer-links li,
.footer-contacts li {
    margin-bottom: 10px;
}

.footer-links a,
.footer-contacts a {
    color: #ccc;
    font-size: 0.85rem;
    transition: 0.2s;
}

.footer-links a:hover,
.footer-contacts a:hover {
    color: var(--red);
}

.footer-bottom {
    border-top: 1px solid #2a2a2a;
    padding-top: 25px;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 0.8rem;
}

.footer-social {
    display: flex;
    gap: 12px;
}

.footer-social a {
    width: 35px;
    height: 35px;
    background: #2a2a2a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: 0.2s;
}

.footer-social a:hover {
    background: var(--red);
    transform: translateY(-3px);
}

/* -------------------- АДАПТИВНОСТЬ -------------------- */
@media (max-width: 1000px) {
    .cart-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .cart-sidebar {
        position: static;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 20px;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .main-nav {
        position: fixed;
        top: 80px;
        left: -100%;
        width: 260px;
        height: 100%;
        background: white;
        box-shadow: 2px 0 15px rgba(0, 0, 0, 0.1);
        transition: left 0.3s;
        z-index: 99;
        padding: 30px 25px;
    }
    
    .main-nav.open {
        left: 0;
    }
    
    .nav-list {
        flex-direction: column;
        gap: 20px;
    }
    
    .header-contacts {
        display: none;
    }
    
    .page-header h1 {
        font-size: 1.6rem;
    }
    
    .cart-item {
        flex-wrap: wrap;
    }
    
    .cart-item-total {
        text-align: left;
        width: 100%;
        padding-left: 120px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .modal-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 30px;
    }
    
    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }
    
    .footer-social {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .cart-item-image,
    .cart-item .item-image {
        width: 80px;
        height: 80px;
        min-width: 80px;
    }
    
    .cart-item-actions {
        flex-wrap: wrap;
    }
    
    .cart-section-title {
        font-size: 1.1rem;
    }
}

/* -------------------- АНИМАЦИИ -------------------- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cart-item {
    animation: fadeInUp 0.3s ease forwards;
}