body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #f5f5f5;
    color: #333;
}
header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.header-container {
    position: relative;
}
.header-meta {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 10px;
    flex-wrap: wrap;
}
.auth-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.auth-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}
.auth-btn:hover {
    background: #5a6268;
}
.cart-btn {
    background: #ffc107;
    color: #212529;
}
.cart-btn:hover {
    background: #e0a800;
}
.feedback-btn {
    background: #4361ee;
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}
.feedback-btn:hover {
    background: #3a56e0;
}
#partner-name {
    font-weight: bold;
    color: #4361ee;
    margin-right: 10px;
}
h1 {
    color: #4361ee;
    font-size: 2.5rem;
}
/* Главный контейнер с сеткой */
.main-container {
    display: grid;
    grid-template-columns: 250px 1fr; /* Левая колонка 250px, правая — растягивается */
    gap: 20px;
    margin-bottom: 30px;
}
/* Правая колонка с товарами */
#products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 25px;
}
/* Группа товаров с одинаковым названием */
.product-group {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s;
    position: relative;
}
.product-group:hover {
    transform: translateY(-5px);
}
.product-group .size-item.out-of-stock::after {
    content: " (под заказ)";
    color: #ff9800;
    font-size: 0.8em;
    margin-left: 5px;
}
/* Контейнер для изображения с поддержкой placeholder */
.image-container {
    position: relative;
    width: 100%;
    height: 180px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.product-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 15px;
    cursor: pointer;
}
.placeholder-image {
    position: absolute;
    width: 100%;
    height: 100%;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    font-weight: bold;
    cursor: pointer;
}
.product-group h3 {
    padding: 15px;
    margin: 0;
    font-size: 1.2rem;
    border-bottom: 1px solid #eee;
}
.price {
    padding: 0 15px;
    font-size: 1.4rem;
    font-weight: bold;
    color: #4361ee;
    margin: 10px 0;
}
/* Визуальная индикация кликабельных карточек */
.product-group.clickable-product {
    cursor: pointer;
    transition: all 0.3s;
}
.product-group.clickable-product:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}
.product-group.clickable-product::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 3px;
    background: #4361ee;
    opacity: 0;
    transition: opacity 0.3s;
}
.product-group.clickable-product:hover::after {
    opacity: 1;
}
/* Контейнер для размеров и остатков */
.sizes-container {
    padding: 10px 15px;
    border-top: 1px solid #eee;
    background-color: #f8f9fa;
}
.size-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    align-items: center;
}
.size-item:last-child {
    border-bottom: none;
}
.size-label {
    font-weight: 500;
}
.stock-quantity {
    font-weight: 500;
    margin-left: 10px;
}
.stock-quantity.available {
    color: #38b000;
}
.stock-quantity.unavailable {
    color: #d90429;
}
/* Кнопки действий */
.action-btn {
    background: #e9ecef;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.action-btn:hover {
    background: #dee2e6;
}
.action-btn.active, .action-btn.active:hover {
    background: #ffc107;
    color: #212529;
}
.action-btn.add-to-cart-btn {
    background: #28a745;
    color: white;
}
.action-btn.add-to-cart-btn:hover {
    background: #218838;
}
.action-btn.add-to-cart-btn.active {
    background: #1e7e34;
}
.add-to-cart-btn {
    font-size: 18px;
}
/* Режим списка */
#products.list-view {
    display: block;
    gap: 0;
}
.product-list-item {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto;
    gap: 10px;
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    align-items: center;
    transition: background 0.2s;
}
.product-list-item:hover {
    background: #f8f9fa;
}
/* Строки с разным фоном в зависимости от stockProgram */
.product-list-item.on-balance-row {
    background-color: #e9ecef; /* Темно-серый для остатка (stockProgram = 0) */
}
.product-list-item.category-header {
    background: #f0f5ff;
    font-weight: bold;
    padding: 10px 15px;
    margin-top: 15px;
    border-radius: 4px 4px 0 0;
    grid-column: span 6;
}
.product-list-item.category-header:first-child {
    margin-top: 0;
}
.product-list-item .model-name {
    font-weight: bold;
}
.product-list-item .size-info {
    color: #6c757d;
}
.product-list-item .price-info {
    color: #4361ee;
    font-weight: bold;
}
.product-list-item .stock-info {
    font-weight: 500;
}
.product-list-item .stock-info.available {
    color: #38b000;
}
.product-list-item .stock-info.unavailable {
    color: #d90429;
}
.list-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.cart-control {
    display: flex;
    align-items: center;
    gap: 8px;
}
.quantity-input.list-quantity {
    width: 60px;
    padding: 4px 6px;
    text-align: center;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
}
/* Ленточка остатка/склада на карточке товара */
.stock-status {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    color: white;
    z-index: 2;
}
.stock-status.in-stock {
    background-color: #28a745; /* Зеленый для склада */
}
.stock-status.on-balance {
    background-color: #6c757d; /* Серый для остатка */
}
/* Статус избранного */
.favorite-status {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 20px;
    cursor: pointer;
    z-index: 2;
    transition: transform 0.2s;
}
.favorite-status:hover {
    transform: scale(1.2);
}
/* Стили для управления количеством */
.action-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.3s;
}
.size-item:hover .action-buttons {
    opacity: 1;
}
.quantity-input {
    width: 50px;
    padding: 5px;
    text-align: center;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
}
.decrease-btn, .increase-btn {
    width: 30px;
    height: 30px;
    font-size: 18px;
    font-weight: bold;
    background: #e9ecef;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}
.decrease-btn:hover {
    background: #dc3545;
    color: white;
}
.increase-btn:hover {
    background: #28a745;
    color: white;
}
/* Кнопка "Купить" в выпадающем окне */
.buy-btn {
    background: #4361ee;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s;
    font-size: 14px;
    width: 70px;
    height: 30px;
}

.buy-btn:hover {
    background: #3a56e0;
}

.buy-btn.added {
    background: #28a745;
    cursor: default;
}
.buy-btn.added:hover {
    background: #218838;
}
/* Стили для выпадающего попапа корзины */
.cart-control-container {
    position: relative;
    display: inline-block;
}
.cart-popup {
    position: absolute;
    right: 0;
    bottom: 100%;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 100;
    display: flex;
    gap: 5px;
    white-space: nowrap;
}
.cart-popup.hidden {
    display: none;
}
.quantity-btn {
    width: 30px;
    height: 30px;
    background: #e9ecef;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}
.quantity-btn:hover {
    background: #dee2e6;
}
.quantity-input {
    width: 40px;
    padding: 3px 5px;
    text-align: center;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
}
/* Пагинация внизу */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 30px 0;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.pagination-container button {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: #f8f9fa;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s;
}
.pagination-container button:hover {
    background: #e9ecef;
}
.pagination-container button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.pagination-container #page-info {
    font-weight: bold;
    min-width: 200px;
    text-align: center;
}
footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    color: #6c757d;
    font-size: 0.9rem;
}
.footer-links {
    margin-top: 10px;
}
.footer-links a {
    color: #4361ee;
    text-decoration: none;
}
.footer-links a:hover {
    text-decoration: underline;
}
/* Модальное окно обратной связи */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal.hidden {
    display: none;
}
.modal-content {
    background-color: white;
    padding: 25px;
    border-radius: 8px;
    width: 500px;
    max-width: 90%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}
.close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #6c757d;
}
.close:hover {
    color: #d90429;
}
#feedback-form textarea {
    width: 100%;
    height: 150px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 15px;
    resize: vertical;
}
.form-row {
    display: flex;
    gap: 10px;
}
.form-row input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}
.form-row button {
    padding: 10px 20px;
    background: #4361ee;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}
.form-row button:hover {
    background: #3a56e0;
}
.message {
    padding: 10px;
    border-radius: 4px;
    margin-top: 10px;
}
.message.hidden {
    display: none;
}
.message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}
.message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}
/* Модальное окно корзины */
#cart-items .cart-item {
    display: flex;
    justify-content: space-between;
    padding: 15px;
    border-bottom: 1px solid #eee;
    align-items: center;
}
.cart-item-info {
    flex: 1;
}
.cart-item-name {
    font-weight: bold;
    margin-bottom: 5px;
}
.cart-item-price {
    color: #4361ee;
    font-weight: 500;
}
.cart-item-actions {
    display: flex;
    align-items: center;
    gap: 5px;
}
.cart-quantity {
    width: 50px;
    padding: 5px;
    text-align: center;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
}
.cart-item .remove-btn {
    background: #dc3545;
    color: white;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    font-weight: bold;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: all 0.2s;
}

.cart-item .remove-btn:hover {
    background: #c82333;
    transform: scale(1.1);
}
.empty-cart, .empty-favorites {
    text-align: center;
    padding: 20px;
    color: #6c757d;
}
.cart-total {
    font-size: 1.2rem;
    font-weight: bold;
    margin: 20px 0;
    text-align: right;
    padding: 15px;
    border-top: 2px solid #4361ee;
}
.checkout-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: bold;
    display: block;
    margin: 0 auto;
    transition: background 0.3s;
}
.checkout-btn:hover {
    background: #218838;
}
/* Модальное окно избранного */
#favorites-items .favorite-item {
    display: flex;
    justify-content: space-between;
    padding: 15px;
    border-bottom: 1px solid #eee;
    align-items: center;
}
.favorite-item-info {
    flex: 1;
}
.favorite-item-name {
    font-weight: bold;
    margin-bottom: 5px;
}
.favorite-item-price {
    color: #ffc107;
    font-weight: 500;
}
.favorite-item-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.remove-favorite-btn {
    background: #dc3545;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    font-weight: bold;
    cursor: pointer;
}
.favorite-add-to-cart {
    background: #4361ee;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
}
.favorite-add-to-cart.active {
    background: #28a745;
}
/* Модальное окно оформления заказа */
.form-group {
    margin-bottom: 15px;
}
.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}
.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}
.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

/* Уведомления */
#notifications-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 300px;
}
.notification {
    background: white;
    border-left: 4px solid #28a745;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 15px;
    border-radius: 4px;
    position: relative;
    animation: slideIn 0.3s ease-out;
    transform: translateX(100%);
    animation-fill-mode: forwards;
}
.notification.success {
    background: #28a745;
    border-left-color: #28a745;
    color: white;
}
.notification.error {
    border-left-color: #dc3545;
}
@keyframes slideIn {
    to {
        transform: translateX(0);
    }
}
.notification-content {
    display: flex;
    align-items: center;
    gap: 10px;
}
.notification-icon {
    font-size: 20px;
}
.notification-message {
    flex: 1;
}
.notification-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #6c757d;
    font-weight: bold;
    font-size: 18px;
    line-height: 1;
    padding: 0 5px;
}
.notification-close:hover {
    color: #343a40;
}
/* Добавленные стили для уведомлений о товарах под заказ */
.out-of-stock-notice {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #00ff15;
    padding: 10px;
    margin: 10px 0;
    border-radius: 4px;
    font-size: 0.9rem;
}
.out-of-stock-notice p {
    margin: 0;
    padding: 0;
}
.out-of-stock-tag {
    display: inline-block;
    background-color: #ff9800;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.8rem;
    margin-left: 5px;
}
.add-to-cart-btn.out-of-stock {
    background-color: #ff9800 !important;
    color: white !important;
}
.cart-item-stock {
    color: #28a745;
    font-weight: bold;
    font-size: 0.9rem;
    margin: 3px 0;
}
.stock-warning {
    color: #FF9900;
    font-weight: bold;
}
.cart-notice {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #FF9900;
    padding: 10px;
    margin: 10px 0;
    border-radius: 4px;
    font-size: 0.9rem;
}
.notice-warning {
    margin: 5px 0;
    font-weight:normal;
}
.form-notice {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 10px;
    margin: 15px 0;
    border-radius: 4px;
    font-size: 0.9rem;
}
.form-notice p {
    margin: 0;
}
.order-notice {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 10px;
    margin: 10px 0;
    border-radius: 4px;
    font-size: 0.9rem;
}
/* Стили для улучшения отображения уведомлений */
.notification.info {
    border-left-color: #17a2b8;
}
.notification.warning {
    border-left-color: #ffc107;
    color: #856404;
    background-color: #fff3cd;
}
/* Стили для компактного отображения карточек */
.product-group.compact-view {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.product-group.compact-view .image-container {
    height: 220px;
    flex-shrink: 0;
}

.product-group.compact-view .image-container.full-height {
    height: 380px; /* Больше места для изображения */
    flex-grow: 1;
    flex-shrink: 1;
}

.product-group.compact-view .sizes-container {
    display: none;
}

.product-group.compact-view .product-info {
    padding: 12px;
    text-align: center;
    margin-top: auto;
}

.product-group.compact-view h3 {
    font-size: 1.1rem;
    margin: 5px 0 8px;
    height: 42px; /* Фиксированная высота для одинакового отображения */
    overflow: hidden; /* ЭТО ВАЖНО! */
    display: -webkit-box; /* ЭТО ВАЖНО! */
    -webkit-box-orient: vertical; /* ЭТО ВАЖНО! */
    -webkit-line-clamp: 2;
    text-overflow: ellipsis;
}

.product-group.compact-view .price {
    font-size: 1.3rem;
    margin: 0;
}

/* Сохранение размера карточек как в подробном режиме */
#products.tile-view .product-group {
    min-height: 380px; /* Фиксированная высота для одинакового отображения */
    display: flex;
    flex-direction: column;
}

/* Стили для плавного перехода между режимами */
.product-group {
    transition: all 0.3s ease;
}