/* ==================== ТАББАР НА ВЕСЬ ЭКРАН ==================== */
/* По умолчанию скрываем таббар */
.bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--wpsc-white-bg);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 9999;
}

.tabbar {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 60px;
    padding: 0 5px;
}

.tabbar__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 100%;
}

.tabbar__link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--wpsc-text-light-color);
    width: 100%;
    height: 100%;
    transition: all 0.2s ease;
}

.tabbar__item--active .tabbar__link {
    color: var(--wpsc-primary-color);
}

.tabbar__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
}

.tabbar__icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

.tabbar__label {
    display: none;
}

/* ==================== СОСТОЯНИЯ ДЛЯ ВСЕХ ТЕМ ==================== */
/* Состояния наведения и нажатия для светлой темы */
.tabbar__link:hover {
    color: var(--wpsc-primary-color);
    opacity: 0.8;
}

.tabbar__link:active {
    color: var(--wpsc-primary-color);
    transform: scale(0.95);
    opacity: 0.6;
    transition: transform 0.1s ease;
}

/* Для активного элемента - убираем hover эффект, так как он уже активен */
.tabbar__item--active .tabbar__link:hover {
    opacity: 1;
}

/* ==================== МЕДИА-ЗАПРОСЫ ==================== */
/* Показываем таббар при ширине менее 1024px */
@media (max-width: 1023px) {
    .bar {
        display: block !important;
    }
    
    body {
        padding-bottom: 60px !important;
    }
}

/* Скрываем таббар при ширине 1024px и больше */
@media (min-width: 1024px) {
    .bar {
        display: none !important;
    }
}

/* ==================== АДАПТИВНОСТЬ ДЛЯ РАЗНЫХ УСТРОЙСТВ ==================== */
/* Для очень маленьких экранов */
@media (max-width: 360px) {
    .tabbar__icon {
        width: 20px;
        height: 20px;
    }
    
    .tabbar {
        height: 50px;
    }
}

/* Для планшетов и iPad */
@media (min-width: 768px) and (max-width: 1023px) {
    .tabbar__icon {
        width: 24px;
        height: 24px;
    }
}

/* ==================== ТЕМНАЯ ТЕМА ==================== */
/* Для системной темы */
@media (prefers-color-scheme: dark) {
    .bar {
        background-color: var(--wpsc-white-bg);
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
    }
    
    .tabbar__link {
        color: var(--wpsc-text-light-color);
    }
    
    .tabbar__item--active .tabbar__link {
        color: var(--wpsc-link-color);
    }
    
    /* Состояния для темной темы */
    .tabbar__link:hover {
        color: var(--wpsc-primary-color);
        opacity: 0.8;
    }
    
    .tabbar__link:active {
        color: var(--wpsc-primary-color);
        transform: scale(0.95);
        opacity: 0.6;
    }
    
    .tabbar__item--active .tabbar__link:hover {
        opacity: 1;
    }
}

/* Для темы с атрибутом theme=dark */
html[theme=dark] .bar {
    background-color: var(--wpsc-white-bg);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

html[theme=dark] .tabbar__link {
    color: var(--wpsc-text-light-color);
}

html[theme=dark] .tabbar__item--active .tabbar__link {
    color: var(--wpsc-link-color);
}

html[theme=dark] .tabbar__link:hover {
    color: var(--wpsc-primary-color);
    opacity: 0.8;
}

html[theme=dark] .tabbar__link:active {
    color: var(--wpsc-primary-color);
    transform: scale(0.95);
    opacity: 0.6;
}

html[theme=dark] .tabbar__item--active .tabbar__link:hover {
    opacity: 1;
}

/* ==================== ДОПОЛНИТЕЛЬНЫЕ СТИЛИ ДЛЯ ПОЛОСКИ ==================== */
/* Скрываем бургер меню темы */
.main-navigation--hamburger {
    display: none !important;
}

/* Стили для иконки поиска Font Awesome */
.tabbar__icon .fas.fa-search {
    font-size: 18px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Адаптивность для иконки поиска */
@media (max-width: 360px) {
    .tabbar__icon .fas.fa-search {
        font-size: 16px;
        width: 18px;
        height: 18px;
    }
}

/* ==================== МОДАЛЬНОЕ ОКНО ПРОФИЛЯ ==================== */
.profile-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
}

.profile-modal.active {
    display: block;
}

.profile-modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.profile-modal__content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--wpsc-white-bg);
    border-radius: 20px 20px 0 0;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

/* Заголовок */
.profile-modal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
}

.profile-modal__title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--wpsc-text-color);
}

/* Меню */
.profile-modal__menu {
    padding: 10px 20px;
}

.profile-modal__item {
    display: flex;
    align-items: center;
    padding: 11px 10px;
    text-decoration: none;
    color: var(--wpsc-text-color);
    border-radius: 10px;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin-bottom: 4px;
}

/* Убираем границы у последнего элемента */
.profile-modal__item:last-child {
    margin-bottom: 0;
}

/* Иконки */
.profile-modal__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    margin-right: 15px;
}

.profile-modal__icon svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.profile-modal__text {
    font-size: 16px;
    font-weight: 500;
}

/* ==================== МОДАЛЬНОЕ ОКНО ПОИСКА ==================== */
.search-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
}

.search-modal.active {
    display: block;
}

.search-modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.search-modal__content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--wpsc-white-bg);
    border-radius: 20px 20px 0 0;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

.search-modal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
}

.search-modal__title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--wpsc-text-color);
}

.search-modal__form {
    padding: 20px;
}

.search-form {
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-form__label {
    flex: 1;
}

.search-field {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--wpsc-border-color);
    border-radius: 10px;
    font-size: 16px;
    background: var(--wpsc-white-bg);
    color: var(--wpsc-text-color);
    transition: border-color 0.2s ease;
}

.search-field:focus {
    outline: none;
    border-color: var(--wpsc-primary-color);
}

.search-form__submit {
    background: var(--wpsc-primary-color);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.2s ease;
}

.search-form__submit:hover {
    background: var(--wpsc-link-hover-color);
}

/* ==================== КНОПКИ ЗАКРЫТИЯ МОДАЛЬНЫХ ОКОН ==================== */
/* Основные стили кнопок закрытия - цвет крестика как у текста */
.profile-modal__close,
.search-modal__close {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--wpsc-text-color); /* Цвет крестика как у текста */
    border-radius: 10px;
    transition: background-color 0.2s ease;
}

/* Выделение при наведении - тот же фон что и у пунктов меню */
.profile-modal__item:hover {
    background-color: var(--wpsc-body-bg);
}

.profile-modal__close:hover,
.search-modal__close:hover {
    background-color: var(--wpsc-body-bg); /* Тот же фон что и у пунктов меню */
    color: var(--wpsc-text-color); /* Цвет крестика остается как у текста */
}

/* ==================== ДЛЯ ДЕСКТОПОВ ==================== */
@media (min-width: 768px) {
    .profile-modal__content,
    .search-modal__content {
        top: 50%;
        left: 50%;
        bottom: auto;
        transform: translate(-50%, -50%);
        width: 400px;
        max-height: 80vh;
        border-radius: 20px;
        animation: fadeIn 0.3s ease;
    }
    
    @keyframes fadeIn {
        from {
            opacity: 0;
            transform: translate(-50%, -40%);
        }
        to {
            opacity: 1;
            transform: translate(-50%, -50%);
        }
    }
    
    .profile-modal__menu {
        padding: 10px 20px;
    }
    
    .search-modal__content {
        width: 500px;
    }
    
    .search-form__submit {
        padding: 12px 25px;
    }
}

/* ==================== АДАПТИВНОСТЬ ==================== */
@media (max-width: 767px) {
    .profile-modal__header,
    .search-modal__header {
        padding: 16px 20px;
    }
    
    .profile-modal__menu,
    .search-modal__form {
        padding: 10px 15px;
    }
    
    .profile-modal__item {
        padding: 11px 10px;
    }
}

@media (max-width: 360px) {
    .profile-modal__header,
    .search-modal__header {
        padding: 14px 16px;
    }
    
    .profile-modal__menu,
    .search-modal__form {
        padding: 10px 12px;
    }
    
    .profile-modal__item {
        padding: 10px 8px;
    }
    
    .profile-modal__icon {
        margin-right: 12px;
    }
    
    .search-field {
        padding: 10px 12px;
        font-size: 15px;
    }
    
    .search-form__submit {
        padding: 10px 15px;
    }
}

/* ==================== ТЕМНАЯ ТЕМА ДЛЯ МОДАЛЬНЫХ ОКОН ==================== */
@media (prefers-color-scheme: dark) {
    .profile-modal__content,
    .search-modal__content {
        background: var(--wpsc-white-bg);
    }
    
    .profile-modal__title,
    .search-modal__title {
        color: var(--wpsc-text-color);
    }
    
    .profile-modal__item,
    .profile-modal__close,
    .search-modal__close {
        color: var(--wpsc-text-color);
    }
    
    .profile-modal__item:hover,
    .profile-modal__close:hover,
    .search-modal__close:hover {
        background-color: var(--wpsc-body-bg);
    }
    
    .search-field {
        background: var(--wpsc-white-bg);
        color: var(--wpsc-text-color);
        border-color: var(--wpsc-border-color);
    }
}

html[theme=dark] .profile-modal__content,
html[theme=dark] .search-modal__content {
    background: var(--wpsc-white-bg);
}

html[theme=dark] .profile-modal__title,
html[theme=dark] .search-modal__title {
    color: var(--wpsc-text-color);
}

html[theme=dark] .profile-modal__item,
html[theme=dark] .profile-modal__close,
html[theme=dark] .search-modal__close {
    color: var(--wpsc-text-color);
}

html[theme=dark] .profile-modal__item:hover,
html[theme=dark] .profile-modal__close:hover,
html[theme=dark] .search-modal__close:hover {
    background-color: var(--wpsc-body-bg);
}

html[theme=dark] .search-field {
    background: var(--wpsc-white-bg);
    color: var(--wpsc-text-color);
    border-color: var(--wpsc-border-color);
}

/* ==================== УТИЛИТЫ ==================== */
/* Предотвращаем скролл body когда модальное окно открыто */
body.modal-open {
    overflow: hidden;
}