.custom-search {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

.custom-search__form {
    width: 100%;
}

.custom-search__input-wrapper {
    /*position: relative;
    display: flex;
    align-items: center;
	border-right: 1px solid #e7e1db;*/
	display: block;
    right: 0rem;
    margin-right: 40px;
}

.custom-search__input {
    width: 500px;
    padding: 20px 56px 20px 16px;
    border: 0;
    font-family: 'Styrene A Web', sans-serif;
    font-size: 1.6rem;
    font-weight: 500;
    letter-spacing: -0.64px;
    box-shadow: 0 1px 0 0 #e7e1db;   
}

.custom-search__input:focus {
    border-color: #3b82f6;
}

.custom-search__submit {
    /*background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
    transition: color 0.3s ease;
    z-index: 2;*/
    padding-right: 30px;
    position: relative;
    padding: 16px;
}

.custom-search__submit:hover {
    color: #3b82f6;
}

.custom-search__suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    min-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 4px;
    display: none;
	min-width: 50vw;
	max-height: calc(100vh - var(--header-height, 80px) - 20px);
}

/* Стили для десктопной версии (по умолчанию) */
.search-suggestions__section {
    border-bottom: 1px solid #f3f4f6;
    padding: 8px 0;
}

.search-suggestions__section:last-child {
    border-bottom: none;
}

.search-suggestions__title {
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.search-suggestions__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.search-suggestions__item:hover {
    background-color: #f9fafb;
}

.search-suggestions__text {
    flex: 1;
    color: #374151;
}

.search-suggestions__count {
    font-size: 12px;
    color: #9ca3af;
    margin-left: 8px;
}

.search-suggestions__item--product {
    align-items: flex-start;
    gap: 12px;
}

.search-suggestions__product-image {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.search-suggestions__product-info {
    flex: 1;
    min-width: 0;
}

.search-suggestions__product-name {
    font-size: 12px;
	color: #939393;
}

.search-suggestions__product-price {
    font-family: "Styrene A Web", sans-serif;
    font-size: 1.2rem;
    letter-spacing: -0.24px;
}

.search-suggestions__product-brand {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
}
.search-suggestions__product-info {
    width: 100%;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
}
/* Стили для тегов */
.search-suggestions__tags {
    position: relative;
    padding: 0 5px 5px;
}
.search-suggestions__tags-list {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    padding: 8px 0 16px 0;
    margin: 0 -16px;
    padding-left: 16px;
    padding-right: 16px;
    -webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	width: 100%;
}
.search-suggestions__tag {
    display: inline-block;
    padding: 6px 12px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    font-size: 12px;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
	margin: 0 5px 0px 5px;
        flex: 0 0 auto;
        margin-bottom: 0;
        white-space: nowrap;
}
.search-suggestions__tag.search-suggestions__tag--link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-right: 8px;
}
.search-suggestions__icon {
    opacity: 0.6;
    margin-left: 8px;
    transition: opacity 0.2s;
}
.search-suggestions__tag:hover {
	background: #dbf507;
    color: #000000;
    border-color: #dbf507;
}

/* Анимация загрузки */
.search-suggestions__spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f4f6;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.search-suggestions__loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #6b7280;
}

.search-suggestions__error {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #ef4444;
}

.search-suggestions__error-icon {
    margin-right: 8px;
    font-size: 16px;
}
.search-suggestions__product-price {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 4px;
}

.search-suggestions__price-regular {
    font-size: 14px;
    font-weight: 600;
    color: #2c2c2c;
}

.search-suggestions__price-old {
    font-size: 12px;
    color: #999;
    text-decoration: line-through;
    font-weight: 400;
}

.search-suggestions__price-new {
    font-size: 14px;
    font-weight: 600;
}
.search-suggestions__not-found {
    padding: 40px 20px;
    text-align: center;
    color: #666;
}

.search-suggestions__not-found-title {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 8px;
    color: #333;
}

.search-suggestions__not-found-text {
    font-size: 14px;
    color: #888;
}

@media (min-width: 1280px) {
	.search-suggestions__taps .search-suggestions__tags-list {
		display: inline-block;
	}
	.search-suggestions__taps .search-suggestions__tag {
		margin: 3px 4px 3px 4px;
	}
} 

@media (max-width: 768px) {
    .search-suggestions__price-regular {
        font-size: 13px;
    }
    
    .search-suggestions__price-old {
        font-size: 11px;
    }
    
    .search-suggestions__price-new {
        font-size: 13px;
    }
	.search-suggestions__tags-list {
		width: initial;
	}
	.search-suggestions__tag:hover {
		color: #374151;
		background: #f3f4f6;
		border: 1px solid #e5e7eb;
		    border: none;
	}
}

@media (max-width: 768px) {
    .custom-search {
        position: relative;
        max-width: 100%;
        margin: 0;
    }
    
    .custom-search__input {
        font-size: 16px;
        padding: 14px 50px 14px 16px;
        border-radius: 8px;
    }
    
    .custom-search__suggestions {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        max-height: none;
        height: 100vh;
        margin-top: 0;
        border-radius: 0;
        border: none;
        z-index: 9999;
        background: rgba(255, 255, 255, 1);
        display: none;
        flex-direction: column;
        transform: translateY(100%);
        transition: transform 0.3s ease;
    }
    
    .custom-search__suggestions.active {
        display: flex;
        transform: translateY(0);
    }
	
    /*.custom-search__suggestions::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.1);
        z-index: -1;
    }*/
    
    .search-suggestions__header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 16px;
        border-bottom: 1px solid #e5e7eb;
        background: white;
        position: sticky;
        top: 0;
        z-index: 1;
        min-height: 60px;
        box-sizing: border-box;
    }
	
    .search-suggestions__header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 16px;
        border-bottom: 1px solid #e5e7eb;
        background: white;
        position: sticky;
        top: 0;
        z-index: 1;
        min-height: 60px;
        box-sizing: border-box;
    }
    
    .search-suggestions__search-box {
        flex: 1;
        margin-right: 16px;
    }
    
    .search-suggestions__search-input {
        width: 100%;
        padding: 12px 16px;
        border: 2px solid #e5e7eb;
        border-radius: 0px;
        font-size: 16px;
        outline: none;
        box-sizing: border-box;
    }
    
    .search-suggestions__search-input:focus {
        border-color: #e5e7eb;
    }
	.search-suggestions__header {
		display: flex;
		align-items: center;
		gap: 8px;
		padding: 16px;
		border-bottom: 1px solid #e5e7eb;
		background: white;
		position: sticky;
		top: 0;
		z-index: 1;
		min-height: 60px;
		box-sizing: border-box;
	}

	.search-suggestions__search-box {
		flex: 1;
		display: flex;
		align-items: center;
	}

	.search-form {
		display: flex;
		align-items: center;
		gap: 8px;
		width: 100%;
	}

	.search-input-wrapper {
		position: relative;
		flex: 1;
		display: flex;
		align-items: center;
	}

	.search-suggestions__search-input {
		width: 100%;
		padding: 12px 40px 12px 16px;
		border: 2px solid #e5e7eb;
		border-radius: 0px;
		font-size: 16px;
		outline: none;
		box-sizing: border-box;
		background: white;
		transition: border-color 0.2s ease;
	}

	.search-suggestions__search-input:focus {
		border-color: #e5e7eb;
	}

	.search-suggestions__clear {
		position: absolute;
		right: 8px;
		top: 50%;
		transform: translateY(-50%);
		background: none;
		border: none;
		color: #9ca3af;
		cursor: pointer;
		padding: 6px;
		display: none;
		align-items: center;
		justify-content: center;
		border-radius: 50%;
		transition: all 0.2s ease;
		z-index: 2;
		background: white;
		opacity: 0.8;
	}

	.search-suggestions__clear:hover {
		background: #f3f4f6;
		color: #6b7280;
	}

	.search-suggestions__clear.active {
		display: flex;
	}

	.search-suggestions__submit {
		border: none;
		color: black;
		cursor: pointer;
		display: flex;
		align-items: center;
		justify-content: center;
		flex-shrink: 0;
		min-width: 22px;
		height: 44px;
		box-sizing: border-box;
	}
	.search-form{
		display: flex;
		align-items: center;
		gap: 8px;
		width: 100%;
	}
	.search-suggestions__submit:hover {
		color: #eee;
	}

	.search-suggestions__submit:active {
		color: #eee;
	}

	.search-suggestions__close {
		background: #f3f4f6;
		border: none;
		border-radius: 8px;
		color: #6b7280;
		cursor: pointer;
		padding: 12px;
		display: flex;
		align-items: center;
		justify-content: center;
		transition: all 0.2s ease;
		flex-shrink: 0;
		min-width: 44px;
		height: 44px;
		box-sizing: border-box;
	}

	.search-suggestions__close:hover {
		background: #e5e7eb;
		color: #374151;
	}
    .search-suggestions__close {
        background: none;
        border: none;
        font-size: 24px;
        color: #6b7280;
        cursor: pointer;
        padding: 4px;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }
    
    .search-suggestions__content {
        flex: 1;
        overflow-y: auto;
        padding-bottom: env(safe-area-inset-bottom, 0);
    }
    
    .search-suggestions__section {
        padding: 0;
        border-bottom: 1px solid #f3f4f6;
    }
    
    .search-suggestions__title {
        padding: 12px 16px 8px;
        font-size: 13px;
        background: #f9fafb;
        margin: 0;
    }
    
    .search-suggestions__item {
        padding: 14px 16px;
        border-bottom: 1px solid #f3f4f6;
    }
    
    .search-suggestions__item:last-child {
        border-bottom: none;
    }
    
    .search-suggestions__item--product {
        padding: 12px 16px;
    }
    
    .search-suggestions__product-image {
        width: 50px;
        height: 50px;
    }
    
    .search-suggestions__product-name {
        -webkit-line-clamp: 2;
        font-size: 15px;
    }
    
    .search-suggestions__tags {
        padding: 5px 0px 5px 0px;
        gap: 6px;
    }
    
    .search-suggestions__tag {
        padding: 8px 14px;
        font-size: 13px;
    }
    
    .search-suggestions__loading,
    .search-suggestions__error {
        padding: 40px 20px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .custom-search {
        max-width: 100%;
    }
    
    .search-suggestions__header {
        padding: 12px;
        min-height: 56px;
    }
    
    .search-suggestions__search-box {
        margin-right: 0px;
    }
    
    .search-suggestions__search-input {
        padding: 9px 9px;
    }
    
    .search-suggestions__item {
        padding: 12px 16px;
    }
    
    .search-suggestions__product-image {
        width: 45px;
        height: 45px;
    }
    
    .search-suggestions__product-name {
        font-size: 14px;
    }
    
    .search-suggestions__tags {
        padding: 8px 12px 12px;
    }
    
    .search-suggestions__tag {
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* Для очень высоких устройств */
@media (max-width: 768px) and (max-height: 600px) {
    .custom-search__suggestions {
        height: 100vh;
    }
}

/* Безопасные области для iPhone X и новее */
@supports(padding: max(0px)) {
    @media (max-width: 768px) {
        .search-suggestions__header {
            padding-top: max(10px, env(safe-area-inset-top));
            padding-left: max(10px, env(safe-area-inset-left));
            padding-right: max(10px, env(safe-area-inset-right));
        }
        
        .search-suggestions__content {
            padding-left: max(16px, env(safe-area-inset-left));
            padding-right: max(16px, env(safe-area-inset-right));
            padding-bottom: max(16px, env(safe-area-inset-bottom));
        }
    }
}

@media screen and (max-width: 768px) {
    .custom-search__input-wrapper input {
        display: none !important;
    }
}
