/* --- Шапка сайта --- */
.header {
    width: 100%;
    height: 80px;
    background-color: #818181;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px; /* Отступ с краев */
    box-sizing: border-box;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
}

.header a{
    text-decoration: none;
}

/* Блоки внутри шапки */
.header-left,
.header-center,
.header-right {
    display: flex;
    align-items: center;
}

/* --- Поиск в шапке --- */
.search-container {
    display: flex;
    align-items: center;
}

.search-input {
    width: 0;
    opacity: 0;
    padding: 0;              /* убираем padding когда скрыто */
    margin-left: 0;          /* нет лишнего отступа */
    border: none;
    border-radius: 20px;
    outline: none;

    transition: 
        width 0.3s ease,
        opacity 0.2s ease,
        padding 0.2s ease,
        margin 0.2s ease;

    pointer-events: none;
}

.search-container.active .search-input {
    width: 180px;
    opacity: 1;
    padding: 6px 10px;
    margin-left: 10px;       /* отступ от лупы появляется только при раскрытии */
    pointer-events: auto;
}

/* Иконка лупы */
.search-toggle i {
    cursor: pointer;
    font-size: 28px;
    color: #ffffff;
    transition: transform 0.2s, opacity 0.2s;
}

.search-toggle:hover i {
    transform: scale(1.1);
    opacity: 0.8;
}

/* Выпадающий список поисковых вариантов */
.search-container {
    position: relative; /* Для позиционирования списка */
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 40px; /* Смещение, чтобы быть под инпутом */
    width: 200px;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    max-height: 250px;
    overflow-y: auto;
    display: none; /* Скрыт по умолчанию */
    z-index: 1001;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.suggestion-item {
    padding: 10px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    border-bottom: 1px solid #eee;
}

.suggestion-item:hover {
    background-color: #f5f5f5;
}

.suggestion-item:last-child {
    border-bottom: none;
}

/* Контейнер для позиционирования */
.cart-wrapper {
    position: relative;
    display: inline-block;
}

/* Стили счётчика */
.badge {
    position: absolute;
    /* Сдвигаем вправо и вверх */
    top: -5px;
    right: -8px;
    
    background-color: #ff0000; /* Красный цвет */
    color: white;
    font-size: 12px;
    font-weight: bold;
    min-width: 16px;
    height: 16px;
    border-radius: 50%; /* Делаем круглым */
    
    /* Центрируем текст внутри кружка */
    display: flex;
    align-items: center;
    justify-content: center;
    
    padding: 1px;
    border: 1px solid white; /* Небольшая обводка, чтобы не сливалось */
    z-index: 10;
}

/* Адаптивно */
@media (max-width: 600px) {
    .search-container.active .search-input {
        width: 120px;
    }
}

.header-center {
    position: absolute;
    left: 50%;    
    transform: translateX(-50%);
    flex: 1;
    justify-content: center;
}

/* Стили для иконок (Boxicons) */
.header-icon i {
    font-size: 32px;
    color: #ffffff;
    display: block;
    transition: transform 0.2s, opacity 0.2s;
}

/* Эффект при наведении на иконку */
.header-icon:hover i {
    transform: scale(1.1); /* Легкое увеличение */
    opacity: 0.8;          /* Небольшая прозрачность */
}

/* Иконки в правой части (отступы между ними) */
.header-right .header-icon {
    margin-left: 20px;
}

.header-logout-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 15px;
    background-color: red;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    transition: background-color 0.2s;
    margin-left: 15px; /* Отступ от строки поиска */
}

/* --- Адаптивность (Мобильные устройства) --- */
@media (max-width: 600px) {
    .header {
        height: 60px;
        padding: 0 10px;
    }

    .header-icon i {
        font-size: 26px;  /* Уменьшаем иконки */
    }

    .header-right .header-icon {
        margin-left: 12px;
    }
}

/* Отступ для контента, чтобы шапка его не перекрывала */
main {
    padding-top: 80px; 
}
@media (max-width: 600px) {
    main {
        padding-top: 60px;
    }
}

