* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #f7f3ef 0%, #e8d5c9 100%);
    color: #2b2b2b;
    padding: 15px;
    line-height: 1.6;
}

.container {
    max-width: 400px;
    margin: 0 auto;
}

/* Заголовок */
.header {
    text-align: center;
    margin-bottom: 25px;
    padding: 20px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(140, 74, 47, 0.1);
}

.header h1 {
    color: #8c4a2f;
    margin-bottom: 8px;
    font-size: 1.5em;
}

.subtitle {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 5px;
}

.hint {
    color: #8c4a2f;
    font-size: 0.8em;
    font-style: italic;
}

/* Сетка продуктов */
.products-grid-section {
    margin-bottom: 25px;
}

.products-grid-section h2 {
    color: #8c4a2f;
    margin-bottom: 15px;
    font-size: 1.2em;
    text-align: center;
}

.products-grid-wrapper {
    background: transparent;
    border-radius: 16px;
    box-shadow: none;
    overflow: hidden;
    width: fit-content;
    margin: 0 auto;
    max-width: calc(100vw - 30px); /* Ограничение по ширине экрана с учетом padding */
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    background: transparent;
    padding: 0;
    margin: 0;
    max-width: 100%; /* Ограничение ширины */
}

.product-card {
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin: 0;
    line-height: 0;
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.product-card:hover {
    transform: scale(0.95);
}

.product-image {
    width: auto;
    height: 100%;
    object-fit: contain; /* Сохраняет пропорции изображения */
    display: block;
    margin: 0;
    padding: 0;
    border: none;
    outline: none;
    background: transparent;
    max-width: 100%;
    max-height: 100%;
}

/* Детальное описание */
.product-details {
    background: white;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 4px 20px rgba(140, 74, 47, 0.1);
}

.back-btn {
    background: none;
    border: none;
    color: #8c4a2f;
    cursor: pointer;
    margin-bottom: 20px;
    font-size: 1em;
    padding: 5px 0;
    font-weight: 500;
}

.product-details-container {
    margin-bottom: 25px;
}

.product-detail-content {
    text-align: center;
}

.product-detail-image {
    height: 350px;
    object-fit: contain;
    border-radius: 12px;
    margin: 0 auto 25px;
}

.product-detail-content h3 {
    color: #8c4a2f;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.product-description {
    text-align: left;
    color: #555;
    line-height: 1.8;
    margin-bottom: 20px;
}

.product-description p {
    margin-bottom: 8px;
}

.add-to-cart-btn {
    background: #8c4a2f;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    width: 100%;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.add-to-cart-btn:hover {
    background: #6d3924;
    transform: translateY(-2px);
}

/* Анимации */
@keyframes buttonSuccess {
    0% {
        background: #8c4a2f;
    }
    50% {
        background: #2e8b57;
    }
    100% {
        background: #8c4a2f;
    }
}

.button-success {
    animation: buttonSuccess 0.6s ease-in-out;
}

/* Корзина */
.cart-section {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(140, 74, 47, 0.1);
    margin-bottom: 20px;
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.cart-header h2 {
    color: #8c4a2f;
    font-size: 1.2em;
}

.cart-count {
    background: #8c4a2f;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
}

.cart-list {
    list-style: none;
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 15px;
}

.cart-list li {
    padding: 10px;
    margin: 5px 0;
    background: #f8f4f0;
    border-radius: 8px;
    border-left: 3px solid #8c4a2f;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.remove-btn {
    background: #dc3545;
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.8em;
}

.cart-total {
    border-top: 1px solid #e8d5c9;
    padding-top: 15px;
}

.cart-total p {
    margin-bottom: 10px;
    text-align: center;
    color: #666;
}

.order-btn {
    background: #8c4a2f;
    color: white;
    border: none;
    padding: 15px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 600;
    width: 100%;
    transition: all 0.3s ease;
}

.order-btn:hover:not(:disabled) {
    background: #6d3924;
    transform: translateY(-2px);
}

.order-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Специальные стили для скролла */
.cart-list::-webkit-scrollbar {
    width: 6px;
}

.cart-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.cart-list::-webkit-scrollbar-thumb {
    background: #8c4a2f;
    border-radius: 3px;
}

.cart-list::-webkit-scrollbar-thumb:hover {
    background: #6d3924;
}

/* Анимация появления элементов */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-card {
    animation: fadeInUp 0.5s ease-out;
}

/* Улучшение фокуса для доступности */
button:focus,
.product-card:focus {
    outline: 2px solid #8c4a2f;
    outline-offset: 2px;
}

/* Состояние загрузки */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Улучшение читаемости текста */
.product-description {
    font-size: 0.95em;
}

/* Контрастные цвета для лучшей доступности */
.header h1,
.products-grid-section h2,
.cart-header h2 {
    color: #8c4a2f;
}

/* Плавные переходы для всех интерактивных элементов */
button,
.product-card {
    transition: all 0.3s ease;
}

/* Улучшение визуальной иерархии */
.subtitle {
    color: #666;
}

.hint {
    color: #8c4a2f;
}