/* ============================================ */
/* FULLSCREEN SEARCH MODAL - UNDER HEADER */
/* ============================================ */

.fullscreen-search-modal {
    position: fixed;
    top: var(--search-modal-top, 120px); /* Start below header - CSS variable support */
    left: 0;
    width: 100%;
    height: var(--search-modal-height, calc(100% - 120px)); /* Remaining height below header */
    background: rgba(0, 0, 0, 0.75); /* Уменьшена непрозрачность с 0.85 до 0.75 */
    z-index: 2147483647 !important; /* МАКСИМАЛЬНЫЙ Z-INDEX - поверх всего */
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    transform: translateZ(0); /* Аппаратное ускорение */
    will-change: opacity, visibility;
}

.fullscreen-search-modal.active {
    opacity: 1;
    visibility: visible;
}

/* Гарантируем, что все дочерние элементы наследуют z-index */
.fullscreen-search-modal * {
    z-index: inherit !important;
}

.fullscreen-search-container {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 50px 20px 50px;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* Отступ сверху через псевдоэлемент (будет управляться JS) */
.fullscreen-search-container::before {
    content: '';
    display: block;
    height: var(--menu-offset, 0px);
    flex-shrink: 0;
    width: 100%;
}

/* ============================================ */
/* ФОРМА ПОИСКА С КРЕСТИКОМ БЕЗ КРУЖКА */
/* ============================================ */

.fullscreen-search-form {
    position: relative;
    margin-bottom: 40px;
    padding-top: 20px;
}

/* Крестик закрытия БЕЗ КРУЖКА - НАД ЛИНИЕЙ ПОИСКА */
.fullscreen-search-close {
    position: absolute;
    top: 10px; /* Над линией поиска */
    right: 0; /* В правом краю формы */
    background: none !important; /* БЕЗ ФОНА */
    border: none !important; /* БЕЗ ОБОДКА */
    color: #fff;
    font-size: 0; /* Скрываем текстовый крестик */
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2147483646 !important; /* Почти максимальный, чуть ниже модалки */
    outline: none !important;
    box-shadow: none !important;
    border-radius: 0 !important; /* БЕЗ СКРУГЛЕНИЯ */
    transition: none !important; /* БЕЗ АНИМАЦИЙ */
    padding: 0;
    margin: 0;
}

/* SVG иконка крестика - БЕЛЫЙ КРЕСТИК */
.fullscreen-search-close svg {
    width: 24px;
    height: 24px;
    stroke: #ffffff !important; /* БЕЛЫЙ КРЕСТИК */
    stroke-width: 2;
}

/* УБИРАЕМ ВСЕ ЭФФЕКТЫ ПРИ НАВЕДЕНИИ */
.fullscreen-search-close:hover {
    background: none !important;
    transform: none !important; /* БЕЗ ВРАЩЕНИЯ */
    border: none !important;
}

.fullscreen-search-close:hover svg {
    stroke: #ffffff !important; /* ОСТАЕТСЯ БЕЛЫМ */
}

.fullscreen-search-close:focus {
    outline: none !important;
    box-shadow: none !important;
    background: none !important;
}

/* Поле ввода с учетом крестика */
#fullscreen-search-input {
    width: 100%;
    padding: 20px 50px 20px 0; /* Право: 50px для крестика */
    font-size: 36px;
    background: transparent;
    border: none;
    border-bottom: 2px solid #d7ca9e; /* Цвет как у кнопки */
    color: #fff;
    outline: none;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

#fullscreen-search-input:focus {
    border-bottom-color: #d7ca9e; /* Остается тот же цвет при фокусе */
    outline: none;
    box-shadow: none;
}

#fullscreen-search-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.search-loading {
    position: absolute;
    right: 60px; /* Справа от крестика */
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.7);
    font-size: 16px;
    display: none;
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #d7ca9e;
    animation: spin 1s ease-in-out infinite;
    margin-right: 10px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================ */
/* ИКОНКА ПОИСКА - ЧЕРНАЯ ЛИНЗА (ВСЕГДА ЧЕРНАЯ) */
/* ============================================ */

.fullscreen-search-trigger {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    padding: 10px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 0;
    position: relative;
    outline: none !important;
    box-shadow: none !important;
}

.fullscreen-search-trigger:hover {
    transform: scale(1.1);
    background: none;
    box-shadow: none;
    outline: none !important;
}

.fullscreen-search-trigger:focus,
.fullscreen-search-trigger:active {
    outline: none !important;
    box-shadow: none !important;
    background: none;
}

/* Иконка поиска - ЧЕРНАЯ ЛИНЗА (ВСЕГДА ЧЕРНАЯ) */
.search-icon {
    width: 24px;
    height: 24px;
    display: block;
    transition: transform 0.3s ease;
}

/* Линза ВСЕГДА ЧЕРНАЯ */
.fullscreen-search-trigger .search-icon circle {
    fill: #000000 !important; /* ЧЕРНАЯ линза */
    stroke: #ffffff !important; /* БЕЛЫЙ ободок */
    stroke-width: 2 !important;
}

.fullscreen-search-trigger .search-icon path {
    stroke: #ffffff !important; /* БЕЛАЯ ручка лупы */
    stroke-width: 2 !important;
    stroke-linecap: round !important;
}

/* При наведении ЛИНЗА ОСТАЕТСЯ ЧЕРНОЙ */
.fullscreen-search-trigger:hover .search-icon circle {
    fill: #000000 !important; /* ОСТАЕТСЯ ЧЕРНОЙ */
}

.fullscreen-search-trigger:hover .search-icon path {
    stroke: #ffffff !important; /* Ручка остается белой */
}

.fullscreen-search-trigger:hover .search-icon {
    transform: scale(1.1);
}

/* ============================================ */
/* РЕЗУЛЬТАТЫ ПОИСКА */
/* ============================================ */

.fullscreen-search-results {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.search-results-container {
    width: 100%;
    flex: 1;
}

/* Кнопка "Полный результат поиска" */
.full-search-button-container {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    text-align: center;
}

.full-search-button {
    background: #d7ca9e;
    border: 2px solid #d7ca9e;
    color: #000;
    padding: 15px 30px;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 4px;
    outline: none !important;
}

.full-search-button:hover {
    background: #000;
    color: #fff;
    border-color: #000;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 255, 255, 0.2);
}

/* СЕТКА КАРТОЧЕК ТОВАРОВ - 3x2 (3 КОЛОНКИ, 2 СТРОКИ) */
.bike-search-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 колонки */
    gap: 20px;
    width: 100%;
}

.bike-search-card {
    background: #fff;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: all 0.3s ease;
    width: 100%;
    overflow: hidden;
    border-radius: 0;
    aspect-ratio: 4/3; /* Хорошее соотношение для 3x2 сетки */
}

.bike-search-card:hover {
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    transform: translateY(-5px);
}

.bike-search-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    flex: 1;
}

/* Контейнер изображения - занимает 70% высоты карточки */
.bike-search-image-container {
    position: relative;
    width: 100%;
    height: 70%; /* Занимает 70% высоты карточки */
    overflow: hidden;
    background: #ffffff;
    flex-shrink: 0;
}

.bike-search-image-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    box-sizing: border-box;
}

.bike-search-image {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
    background: #ffffff;
    transition: transform 0.3s ease;
}

.bike-search-card:hover .bike-search-image {
    transform: scale(1.05);
}

.bike-search-image-placeholder {
    width: 100%;
    height: 100%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 14px;
}

/* Бейджи */
.bike-search-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    z-index: 3;
    border-radius: 0;
}

.bike-search-badge.new {
    background: #000;
    color: #fff;
}

.bike-search-badge.popular {
    background: #d7ca9e;
    color: #000;
}

.bike-search-badge.pre-order {
    background: #d7ca9e;
    color: #000;
    border-radius: 0;
}

.bike-search-badge.out-of-stock {
    background: #666;
    color: #fff;
}

/* Горизонтальная полоска между фото и названием */
.bike-search-divider {
    height: 1px;
    background: #e5e5e5;
    width: 100%;
    margin: 0;
    flex-shrink: 0;
}

/* Информация о велосипеде - занимает 30% высоты карточки */
.bike-search-info {
    padding: 12px 8px 8px;
    text-align: left;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #fff;
    height: 30%; /* Занимает 30% высоты карточки */
    box-sizing: border-box;
}

/* Шрифт названия как на Commencal.com */
.bike-search-title {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #000;
    margin: 0 0 6px 0;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
}

.bike-search-specs {
    margin-bottom: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
}

.bike-search-spec-year,
.bike-search-spec-material {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bike-search-spec-year:after {
    content: "•";
    margin: 0 4px;
}

.bike-search-spec-material:after {
    content: "";
    margin: 0;
}

/* Убрана цена */
.bike-search-price-container,
.bike-search-price,
.bike-search-price.no-price {
    display: none !important;
}

/* Блокировка скролла при открытой модалке */
body.search-modal-open {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* Специальные стили для корректной работы JS */
.search-no-results {
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 18px;
    padding: 40px 20px;
    display: none;
}

.no-results-message {
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 18px;
    padding: 40px 20px;
}

/* ============================================ */
/* АДАПТИВНОСТЬ */
/* ============================================ */

@media (max-width: 1200px) {
    .bike-search-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .bike-search-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .fullscreen-search-modal {
        top: var(--search-modal-top, 100px);
        height: var(--search-modal-height, calc(100% - 100px));
    }
    
    .fullscreen-search-container {
        padding: 40px 15px 30px;
    }
    
    .fullscreen-search-close {
        top: 5px;
        width: 35px;
        height: 35px;
    }
    
    .fullscreen-search-close svg {
        width: 20px;
        height: 20px;
    }
    
    #fullscreen-search-input {
        font-size: 24px;
        padding: 15px 45px 15px 0;
    }
    
    .search-loading {
        right: 55px;
        font-size: 14px;
    }
    
    .bike-search-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .bike-search-info {
        padding: 10px 6px 6px;
    }
    
    .bike-search-title {
        font-size: 13px;
    }
}

@media (max-width: 576px) {
    .bike-search-grid {
        grid-template-columns: 1fr;
    }
    
    .bike-search-card {
        aspect-ratio: 4/3;
    }
    
    .fullscreen-search-close {
        top: 0;
        right: -5px;
        width: 35px;
        height: 35px;
    }
    
    .fullscreen-search-close svg {
        width: 18px;
        height: 18px;
    }
    
    #fullscreen-search-input {
        padding: 15px 40px 15px 0;
    }
    
    .search-loading {
        right: 50px;
    }
}

@media (max-width: 480px) {
    .fullscreen-search-modal {
        top: var(--search-modal-top, 80px);
        height: var(--search-modal-height, calc(100% - 80px));
    }
    
    #fullscreen-search-input {
        font-size: 18px;
    }
    
    .bike-search-title {
        font-size: 12px;
    }
}

/* Для корректной работы на iOS */
@supports (-webkit-touch-callout: none) {
    .fullscreen-search-modal {
        height: -webkit-fill-available;
    }
}

/* Кастомный скроллбар */
.fullscreen-search-results::-webkit-scrollbar {
    width: 8px;
}

.fullscreen-search-results::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.fullscreen-search-results::-webkit-scrollbar-thumb {
    background: rgba(215, 202, 158, 0.5);
    border-radius: 4px;
}

.fullscreen-search-results::-webkit-scrollbar-thumb:hover {
    background: rgba(215, 202, 158, 0.8);
}