/* Стили для страницы всех товаров */
.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

.page-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.page-header h1 {
    color: #2c3e50;
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.page-header p {
    color: #7f8c8d;
    font-size: 1.1rem;
}

.content-wrapper {
    display: flex;
    gap: 30px;
    margin-bottom: 40px;
}

/* Стили для дерева категорий */
.categories-sidebar {
    flex: 0 0 300px;
    background: white;
    padding: 20px;
    height: fit-content;
}

.categories-header {
    font-size: 1.3rem;
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ecf0f1;
}

.brand-list {
    list-style: none;
    padding-left: 0;
}

.brand-item {
    margin-bottom: 10px;
    border-radius: 6px;
    overflow: hidden;
    width: 100%; /* Полная ширина внутри списка */
}

.brand-header-1 {
    padding: 12px 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.3s;
}

.brand-name {
    font-weight: bold;
    color: #34495e;
}

/* Стрелка как в меню автомобилей */
.toggle-arrow {
    position: relative;
    width: 8px; /* Увеличили с 6px */
    height: 8px; /* Увеличили с 6px */
    margin-left: 8px; /* Увеличили отступ */
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.toggle-arrow::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 7px; /* Увеличили с 5px */
    height: 7px; /* Увеличили с 5px */
    border-right: 2px solid #7f8c8d; /* Увеличили толщину с 1px */
    border-bottom: 2px solid #7f8c8d; /* Увеличили толщину с 1px */
    transform: translateY(-70%) rotate(45deg);
    transition: transform 0.3s ease;
}

.brand-header-1:hover .toggle-arrow::before {
    border-color: #2b6cb0;
}

.toggle-arrow.rotated {
    transform: rotate(180deg);
}

.model-list {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding-left: 20px;
}

.model-list.expanded {
    max-height: 500px;
}

.model-item {
    padding: 10px 15px 10px 15px;
    border-bottom: 1px solid #ecf0f1;
    transition: background-color 0.2s;
}

.model-item:last-child {
    border-bottom: none;
}

.model-link {
    text-decoration: none;
    color: #4a5568;
    display: block;
    transition: color 0.2s;
}

.model-link:hover {
    color: #2b6cb0;
}

/* Стили для товаров */
.products-section {
    flex: 1;
}

.products-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.products-count {
    color: #7f8c8d;
    font-size: 1rem;
}

.products-row {
    display: row;
    gap: 20px;
}

.product-card {
    background: white;
    border-radius: 2px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    margin-bottom: 20px;
}

.product-card:hover {
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
}

.product-card-inner {
    display: flex;
    align-items: center;
    padding: 15px;
    gap: 20px;
    min-height: 180px;
}

/* Левая часть - фото */
.product-image-container {
    flex: 0 0 150px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-image {
    width: 140px;
    height: 140px;
    object-fit: cover;
    border-radius: 6px;
}

/* Центральная часть - информация */
.product-info {
    flex: 1;
    padding: 0 15px;
}

.product-name {
    font-size: 1rem;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 8px;
    line-height: 1.3;
}

.product-name-link {
    text-decoration: none;
    color: #2c3e50;
    transition: color 0.2s;
}

.product-name-link:hover {
    color: #3498db;
    text-decoration: underline;
}

.product-category {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-bottom: 6px;
}

.product-car {
    color: #3498db;
    font-size: 0.9rem;
    margin-bottom: 6px;
}

.product-article {
    color: #95a5a6;
    font-size: 0.85rem;
    margin-bottom: 10px;
}

.product-stock {
    font-size: 0.9rem;
    margin-bottom: 0;
}

.in-stock {
    color: #27ae60;
}

.out-of-stock {
    color: #e74c3c;
}

.product-actions-container {
    flex: 0 0 180px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 15px;
}

.product-price {
    font-size: 1rem;
    font-weight: bold;
    text-align: right;
}

.product-actions-hover {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px; /* Увеличили отступ между элементами */
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    margin-top: 30px; /* Добавили отступ сверху */
}

.product-card:hover .product-actions-hover {
    opacity: 1;
    transform: translateY(0);
}

/* Стили для счетчика количества */

.quantity-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1.1rem;
    transition: all 0.2s;
    border-radius: 3px;
    padding: 0;
    line-height: 1;
}

/* Специфичные стили для выравнивания символов */
.quantity-btn.minus {
    font-size: 1.3rem; /* Немного увеличим минус */
    padding-bottom: 2px; /* Корректировка вертикального положения */
}

.quantity-btn.plus {
    font-size: 1.1rem;
    padding-top: 1px; /* Корректировка вертикального положения */
}

.quantity-btn:hover {
    background: #e9ecef;
}

.quantity-btn:active {
    background: #dee2e6;
    transform: scale(0.95);
}

.quantity-btn:disabled {
    color: #adb5bd;
    cursor: not-allowed;
    background: #f8f9fa;
}

.quantity-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px;
    border: 1px solid #dee2e6;
    background: white;
}

.quantity-input {
    width: 50px;
    height: 30px;
    text-align: center;
    font-size: 0.9rem;
    background: white;
    border: none;
    border-radius: 3px;
    -moz-appearance: textfield;
    -webkit-appearance: none;
    appearance: textfield;
    padding: 0;
    margin: 0;
}

.quantity-selector {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px;
    border: 1px solid #dee2e6;
    background: white;
    height: 30px; /* Фиксированная высота для выравнивания */
}

/* Убираем стрелки у всех числовых полей */
input[type="number"] {
    -moz-appearance: textfield;
    -webkit-appearance: none;
    appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.quantity-input:focus {
    outline: none;
    border-color: #667eea;
}
/* Кнопки */
.btn {
    padding: 10px 15px;
    border: none;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.2s;
    text-decoration: none;
    text-align: center;
    font-size: 0.9rem;
    min-width: 136px;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary-2 {
    background: white;
    color: #3498db;
}

.btn-primary:hover:not(:disabled) {
    background: #2980b9;
}

.btn-secondary {
    background: #ecf0f1;
    color: #34495e;
    width: 100%;
}

.btn-secondary:hover {
    background: #bdc3c7;
}

.btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

.details-btn {
    margin-top: auto;
}

/* Пагинация */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 40px;
    gap: 5px;
}

.pagination-btn {
    display: block;
    padding: 8px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #3498db;
    transition: background-color 0.2s;
    font-size: 0.9rem;
}

.pagination-btn:hover {
    background: #ecf0f1;
}

.pagination-btn.current {
    background: #3498db;
    color: white;
    border-color: #3498db;
}
/* Стили для уведомлений об ошибках */
.error-notifications {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    max-width: 400px;
}

.error-notification {
    background: #e74c3c;
    color: white;
    padding: 15px 20px;
    border-radius: 6px;
    margin-bottom: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideIn 0.3s ease;
}

.error-notification.success {
    background: #27ae60;
}

.error-notification.warning {
    background: #f39c12;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.close-error {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    margin-left: 15px;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-error:hover {
    opacity: 0.8;
}

/* Сообщение об отсутствии товаров */
.no-products {
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.no-products p {
    font-size: 1.2rem;
    color: #7f8c8d;
}

/* Адаптивность */
@media (max-width: 768px) {
    .content-wrapper {
        flex-direction: column;
    }

    .categories-sidebar {
        flex: none;
        width: 100%;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }

    .products-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .container {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
    }

    .page-header h1 {
        font-size: 2rem;
    }

    .product-actions {
        flex-direction: column;
    }

    .btn {
        padding: 10px 15px;
    }
}

/* Мобильное меню категорий */
@media (max-width: 768px) {
    .categories-sidebar {
        width: 100%;
        order: 2;
        margin-top: 20px;
    }
    .categories-header {
        cursor: pointer;
        position: relative;
    }
    .categories-header::after {
        content: '▼';
        position: absolute;
        right: 10px;
        top: 50%;
        transform: translateY(-50%);
        transition: transform 0.3s ease;
    }
    .categories-header.active::after {
        transform: translateY(-50%) rotate(180deg);
    }
    .brand-list {
        display: none;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.4s ease;
    }
    .brand-list.open {
        display: block;
        max-height: 500px;
    }
}

/* Адаптация карточек товаров */
@media (max-width: 768px) {
    .product-card-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .product-image-container {
        flex: none;
        width: 100%;
        display: flex;
        justify-content: center;
    }
    .product-image {
        width: 100%;
        height: auto;
        max-width: 260px;
    }
    .product-actions-container {
        width: 100%;
        align-items: center;
        text-align: center;
    }
    .product-price {
        font-size: 1.1rem;
    }
    .quantity-selector {
        justify-content: center;
    }
    .btn {
        width: 100%;
    }
    .products-row {
        flex-direction: column;
        gap: 15px;
    }
}

/* Очень маленькие экраны */
@media (max-width: 480px) {
    .product-name {
        font-size: 0.95rem;
    }
    .categories-header {
        font-size: 1.1rem;
    }
    .product-price {
        font-size: 1rem;
    }
}
