#headerSearchInput {
    font-size: 16px;
    font-family: inherit;
}

.tg-search {
    flex: 1;
    position: relative;
    max-width: 600px;
}

.tg-search__input {
    width: 100%;
    padding: 10px 45px 10px 16px;
    border: 2px solid #484f55;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: #fafafa;
    line-height: 20px;
    height: 44px;
}

.tg-search__input:focus {
    outline: none;
    border-color: #ebcc00;
    background: #fff;
}

.tg-search__btn {
    position: absolute;
    right: 2px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    padding: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    width: 40px;
}

.tg-search__btn svg {
    width: 20px;
    height: 20px;
    stroke: #666;
    stroke-width: 2;
    fill: none;
}

.tg-search__btn:hover svg {
    stroke: #ebcc00;
}

/* Мобильная кнопка поиска */
.tg-search__mobile-trigger {
    display: none;
    align-items: center;
    justify-content: left;
    border: none;
    color: #231f20;
    cursor: pointer;
    transition: color 0.2s;
    width: 100%;
    padding: 10px 45px 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    background: #f3f3f3;
    line-height: 20px;
    height: 44px;
}

.tg-search__mobile-trigger:hover {
    color: #ebcc00;
}

/* Search Results */
.tg-search__results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    max-height: 400px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.tg-search__results--active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.tg-search__loader {
    padding: 20px;
    text-align: center;
    color: #666;
}

.tg-search__error {
    padding: 20px;
    text-align: center;
    color: #e74c3c;
}

.tg-search__empty {
    padding: 40px 20px;
    text-align: center;
}

.tg-search__empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.tg-search__empty-text {
    color: #666;
    font-size: 14px;
}

/* Search Sections */
.tg-search__section {
    border-bottom: 1px solid #e8e8e8;
}

.tg-search__section:last-of-type {
    border-bottom: none;
}

.tg-search__section-title {
    padding: 12px 16px 8px;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #f5f5f5;
}

.tg-search__result-item {
    padding: 12px 16px;
    border-bottom: 1px solid #e8e8e8;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.tg-search__result-item:hover {
    background: #f5f5f5;
}

.tg-search__result-item:last-child {
    border-bottom: none;
}

.tg-search__result-img {
    width: 55px;
    height: 55px;
    background: #f5f5f5;
    border-radius: 6px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-size: 20px;
}

.tg-search__result-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.tg-search__result-info {
    flex: 1;
    min-width: 0;
}

.tg-search__result-info h4 {
    color: #231f20;
    font-size: 14px;
    line-height: 1.3;
    margin-bottom: 4px;
    font-weight: 400;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tg-search__result-info p {
    color: #666;
    font-size: 13px;
    font-weight: 600;
}

.tg-search__footer {
    padding: 12px 16px;
    background: #f5f5f5;
    border-top: 1px solid #e8e8e8;
}

.tg-search__show-all {
    display: block;
    text-align: center;
    color: #b2935a;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
}

.tg-search__show-all:hover {
    color: #231f20;
}

/* =================================================================
   МОБИЛЬНЫЙ ПОЛНОЭКРАННЫЙ ПОИСК
   ================================================================= */

.tg-mobile-search {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100vh;
    height: -webkit-fill-available;
    z-index: 99999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    will-change: opacity;
}

.tg-mobile-search.is-open {
    pointer-events: auto;
    opacity: 1;
}

.tg-mobile-search__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.tg-mobile-search.is-open .tg-mobile-search__overlay {
    opacity: 1;
}

.tg-mobile-search__content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.25s cubic-bezier(0.4, 0.0, 0.2, 1);
    z-index: 2;
}

.tg-mobile-search.is-open .tg-mobile-search__content {
    transform: translateX(0);
}

.tg-mobile-search__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
    flex-shrink: 0;
}

.tg-mobile-search__back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: none;
    border: none;
    color: #231f20;
    cursor: pointer;
    flex-shrink: 0;
    transition: color 0.2s;
    position: absolute;
    z-index: 2;
}

.tg-mobile-search__back:hover {
    color: #ebcc00;
}

.tg-mobile-search__input-wrapper {
    flex: 1;
    position: relative;
}

.tg-mobile-search__input {
    width: 100%;
    height: 48px;
    padding: 0 35px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
    background: #f9fafb;
}

.tg-mobile-search__input:focus {
    border-color: #ebcc00;
    background: #fff;
}

.tg-mobile-search__clear {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    flex-shrink: 0;
    transition: color 0.2s;
    position: absolute;
    z-index: 123;
    right: 18px;
}

.tg-mobile-search__clear:hover {
    color: #231f20;
}

.tg-mobile-search__results {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Адаптация стилей результатов для мобильного попапа */
.tg-mobile-search__results .tg-search__section {
    border-bottom: 1px solid #e8e8e8;
}

.tg-mobile-search__results .tg-search__section:last-of-type {
    border-bottom: none;
}
button#mobileSearchBack svg, .tg-mobile-search__clear svg {
    width: 30px;
    height: 40px;
}
.tg-mobile-search__results .tg-search__section-title {
    padding: 12px 16px 8px;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #f5f5f5;
}

.tg-mobile-search__results .tg-search__result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #e8e8e8;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.2s;
}

.tg-mobile-search__results .tg-search__result-item:hover {
    background-color: #f9fafb;
}

.tg-mobile-search__results .tg-search__result-item:last-child {
    border-bottom: none;
}

.tg-mobile-search__results .tg-search__result-img {
    width: 55px;
    height: 55px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.tg-mobile-search__results .tg-search__result-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.tg-mobile-search__results .tg-search__result-info {
    flex: 1;
    min-width: 0;
}

.tg-mobile-search__results .tg-search__result-info h4 {
    color: #231f20;
    font-size: 14px;
    line-height: 1.3;
    margin-bottom: 4px;
    font-weight: 400;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tg-mobile-search__results .tg-search__result-info p {
    color: #666;
    font-size: 13px;
    font-weight: 600;
}

.tg-mobile-search__results .tg-search__empty {
    text-align: center;
    padding: 60px 20px;
}

.tg-mobile-search__results .tg-search__empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.tg-mobile-search__results .tg-search__empty-text {
    font-size: 16px;
    color: #666;
}

.tg-mobile-search__results .tg-search__loader {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.tg-mobile-search__results .tg-search__error {
    text-align: center;
    padding: 40px 20px;
    color: #e74c3c;
}

.tg-mobile-search__results .tg-search__footer {
    padding: 12px 16px;
    background: #f5f5f5;
    border-top: 1px solid #e8e8e8;
}

.tg-mobile-search__results .tg-search__show-all {
    display: block;
    text-align: center;
    color: #b2935a;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: color 0.2s;
}

.tg-mobile-search__results .tg-search__show-all:hover {
    color: #231f20;
}

/* Блокировка скролла при открытом поиске */
body.mobile-search-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* Переопределяем z-index других элементов при открытом поиске */
body.mobile-search-open .tg-mobile-catalog {
    z-index: 9998 !important;
}

body.mobile-search-open .tg-sticky-menu {
    z-index: 999 !important;
}

body.mobile-search-open .tg-topbar {
    z-index: 998 !important;
}

/* =================================================================
   МЕДИА-ЗАПРОСЫ
   ================================================================= */

@media (max-width: 768px) {
    /* Скрываем десктопный поиск */
    .tg-search--desktop {
        display: none;
    }

    /* Показываем мобильную кнопку */
    .tg-search__mobile-trigger {
        display: flex;
    }

    /* Показываем мобильный попап */
    .tg-mobile-search {
        display: block;
    }
}

@media (min-width: 769px) {
    /* Показываем десктопный поиск */
    .tg-search--desktop {
        display: block;
    }

    /* Скрываем мобильную кнопку и попап */
    .tg-search__mobile-trigger {
        display: none;
    }

    .tg-mobile-search {
        display: none !important;
    }
}