* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: 'Georgia', 'Times New Roman', serif;
    background: #fdf6ed;
    color: #3e2e23;
}
header {
    background: #8b3a1f;
    color: #fff;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}
.logo img { height: 60px; }
.cart-btn {
    background: #f7c35c;
    border: none;
    padding: 10px 20px;
    border-radius: 30px;
    font-weight: bold;
    font-size: 1.1rem;
    cursor: pointer;
}
/* Слайдер */
.slider-container {
    position: relative;
    max-width: 100%;
    overflow: hidden;
    background: #fff;
}
.slider .slide {
    display: none;
}
.slider .slide.active {
    display: block;
}
.slide img {
    width: 100%;
    height: 300px;
    object-fit: cover;
}
.caption {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(0,0,0,0.5);
    color: #fff;
    padding: 10px 20px;
    border-radius: 10px;
}
.prev, .next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.3);
    color: #fff;
    border: none;
    padding: 10px 15px;
    font-size: 2rem;
    cursor: pointer;
}
.prev { left: 10px; }
.next { right: 10px; }

/* Меню */
.menu-container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 15px;
}
.category-title {
    border-bottom: 2px solid #c97d3b;
    padding-bottom: 10px;
    margin: 30px 0 20px;
}
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 25px;
}
.product-card {
    background: #fff;
    border-radius: 20px;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transition: transform 0.2s;
    text-align: center;
}
.product-card:hover {
    transform: translateY(-5px);
}
.product-card img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 12px;
}
.product-card h3 {
    font-size: 1.2rem;
    margin: 10px 0 5px;
}
.product-card .price {
    display: block;
    font-weight: bold;
    color: #8b3a1f;
    font-size: 1.3rem;
    margin: 8px 0;
}
.add-to-cart {
    background: #8b3a1f;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 1rem;
}
.add-to-cart:hover {
    background: #b54a2a;
}

/* Корзина */
.cart-panel {
    position: fixed;
    top: 0;
    right: -420px;
    width: 380px;
    max-width: 100%;
    height: 100%;
    background: #fff;
    box-shadow: -5px 0 20px rgba(0,0,0,0.2);
    padding: 20px;
    overflow-y: auto;
    transition: right 0.3s;
    z-index: 1000;
}
.cart-panel.open {
    right: 0;
}
#cartClose {
    float: right;
    font-size: 2rem;
    background: none;
    border: none;
    cursor: pointer;
}
.cart-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}
.cart-item input[type="number"] {
    width: 50px;
    padding: 5px;
}
.cart-remove {
    background: #c0392b;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
}
#orderForm input {
    display: block;
    width: 100%;
    padding: 10px;
    margin: 8px 0;
    border: 1px solid #ddd;
    border-radius: 20px;
}
#orderForm button {
    width: 100%;
    padding: 12px;
    background: #8b3a1f;
    color: #fff;
    border: none;
    border-radius: 30px;
    font-size: 1.2rem;
    cursor: pointer;
}
.success-modal {
    background: #d4edda;
    padding: 15px;
    border-radius: 10px;
    margin-top: 15px;
}
.success-modal ul {
    padding-left: 20px;
}

/* Адаптив */
@media (max-width: 600px) {
    .products-grid {
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }
    .cart-panel {
        width: 100%;
        right: -100%;
    }
    .slide img {
        height: 200px;
    }
    header {
        flex-direction: column;
        align-items: flex-start;
    }
    .logo img { height: 40px; }
    .cart-btn { margin-top: 10px; }
}

/* ---------- Кнопка корзины в шапке ---------- */
.cart-btn {
    background: #f7c35c;
    border: none;
    padding: 10px 16px;
    border-radius: 50px;
    font-size: 1.4rem;
    position: relative;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}
.cart-btn:hover {
    transform: scale(1.05);
}
.cart-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #c0392b;
    color: #fff;
    border-radius: 50%;
    padding: 2px 8px;
    font-size: 0.8rem;
    font-weight: bold;
    min-width: 22px;
    text-align: center;
}

/* ---------- Затемнение и панель корзины ---------- */
.cart-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    backdrop-filter: blur(4px);
}
.cart-overlay.active {
    display: block;
}

.cart-panel {
    position: fixed;
    top: 0;
    right: -480px;
    width: 420px;
    max-width: 100%;
    height: 100%;
    background: #fff;
    box-shadow: -8px 0 30px rgba(0,0,0,0.15);
    z-index: 1000;
    transition: right 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    display: flex;
    flex-direction: column;
}
.cart-panel.open {
    right: 0;
}

/* Шапка корзины */
.cart-header {
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.cart-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #3e2e23;
}
.cart-close {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: #999;
    transition: color 0.2s;
}
.cart-close:hover {
    color: #c0392b;
}

/* Тело корзины (список) */
.cart-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}
.cart-empty {
    text-align: center;
    color: #aaa;
    font-size: 1.2rem;
    padding: 40px 0;
}
.cart-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}
.cart-item img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 8px;
}
.cart-item-info {
    flex: 1;
}
.cart-item-name {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 4px;
}
.cart-item-price {
    color: #8b3a1f;
    font-weight: bold;
}
.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}
.cart-item-controls button {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: #f1f1f1;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cart-item-controls button:hover {
    background: #ddd;
}
.cart-item-controls .qty-btn-minus {
    background: #f8e0d4;
    color: #8b3a1f;
}
.cart-item-controls .qty-btn-plus {
    background: #8b3a1f;
    color: #fff;
}
.cart-item-controls .qty-btn-plus:hover {
    background: #b54a2a;
}
.cart-item-controls .qty-value {
    min-width: 24px;
    text-align: center;
    font-weight: bold;
}
.cart-item-controls .remove-btn {
    background: none;
    color: #c0392b;
    font-size: 1.2rem;
    width: 30px;
    height: 30px;
}
.cart-item-controls .remove-btn:hover {
    background: #fdd;
}

/* Подвал корзины (итог + форма) */
.cart-footer {
    padding: 20px 24px;
    border-top: 1px solid #eee;
    background: #fafaf5;
}
.cart-total {
    font-size: 1.4rem;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
    color: #3e2e23;
}
.cart-total span:last-child {
    color: #8b3a1f;
}
.order-form input {
    display: block;
    width: 100%;
    padding: 10px 16px;
    margin: 6px 0;
    border: 1px solid #ddd;
    border-radius: 30px;
    font-size: 1rem;
    transition: border-color 0.2s;
}
.order-form input:focus {
    border-color: #8b3a1f;
    outline: none;
}
.btn-order {
    width: 100%;
    padding: 14px;
    background: #8b3a1f;
    color: #fff;
    border: none;
    border-radius: 30px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    margin-top: 8px;
    transition: background 0.2s;
}
.btn-order:hover {
    background: #b54a2a;
}

/* Успешное сообщение */
.success-modal {
    background: #d4edda;
    padding: 16px;
    border-radius: 12px;
    margin-top: 12px;
    border-left: 4px solid #28a745;
}
.success-modal h3 {
    margin-top: 0;
    color: #155724;
}
.success-modal ul {
    padding-left: 20px;
}
.success-modal .btn-close {
    background: #28a745;
    color: #fff;
    border: none;
    padding: 8px 24px;
    border-radius: 30px;
    font-weight: bold;
    cursor: pointer;
}

/* Адаптив для мобильных */
@media (max-width: 600px) {
    .cart-panel {
        width: 100%;
        right: -100%;
    }
    .cart-item img {
        width: 40px;
        height: 40px;
    }
    .cart-header h2 {
        font-size: 1.2rem;
    }
    .cart-total {
        font-size: 1.2rem;
    }
}

/* Плавающая кнопка корзины */
.floating-cart-btn {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 999;
    background: #8b3a1f;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 1.8rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.floating-cart-btn:hover {
    transform: scale(1.05);
    background: #b54a2a;
}
.floating-cart-btn .cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #c0392b;
    color: #fff;
    border-radius: 50%;
    padding: 2px 8px;
    font-size: 0.8rem;
    font-weight: bold;
    min-width: 22px;
    text-align: center;
}


/* Анимация бейджа корзины */
.floating-cart-btn.pulse .cart-badge {
    animation: badgePulse 0.3s ease;
}
@keyframes badgePulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.5); background: #e74c3c; }
    100% { transform: scale(1); }
}

/* Анимация обновления товара в корзине */
.cart-item.updated {
    animation: itemFlash 0.3s ease;
}
@keyframes itemFlash {
    0% { background: rgba(139, 58, 31, 0.2); }
    100% { background: transparent; }
}

.fly-item {
    position: fixed;
    font-size: 2rem;
    z-index: 9999;
    pointer-events: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    will-change: transform, left, top;
    opacity: 0;
}

/* Анимация удаления */
.cart-item {
    transition: all 0.4s ease;
    overflow: hidden;
}
.cart-item.removing {
    transform: translateX(-100%);
    opacity: 0;
    max-height: 0;
    padding: 0;
    margin: 0;
    transition: all 0.4s ease;
}
.cart-item.removing * {
    pointer-events: none;
}

/* Анимация появления новой позиции */
.cart-item.appearing {
    animation: slideIn 0.3s ease forwards;
}
@keyframes slideIn {
    0% { opacity: 0; transform: translateX(50px); }
    100% { opacity: 1; transform: translateX(0); }
}

/* Стили для временных цифр при анимации */
.qty-value.old,
.qty-value.new {
    font-weight: bold;
    font-size: inherit;
    background: #f5ede4;
    padding: 0 4px;
    border-radius: 4px;
}

/* Удаление вверх */
.cart-item {
    transition: all 0.4s ease;
    overflow: hidden;
    max-height: 150px; /* чтобы анимация схлопывания работала */
}
.cart-item.removing {
    transform: translateY(-100%);
    opacity: 0;
    max-height: 0;
    padding: 0;
    margin: 0;
    transition: all 0.4s ease;
}

/* Летящий элемент */
.fly-item {
    position: fixed;
    font-size: 2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    z-index: 9999;
    pointer-events: none;
    will-change: transform, left, top;
    opacity: 0;
    color: #fff;
}

/* Анимация бейджа */
.floating-cart-btn.pulse .cart-badge {
    animation: badgePulse 0.3s ease;
}
@keyframes badgePulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.5); background: #e74c3c; }
    100% { transform: scale(1); }
    
}


.slider-container {
    width: 100%;
    overflow: hidden;
    background: #000;
}
.slide {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
}
.slide img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}