/* Иконки для категорий */
.icon-gpu:before {
    content: "";
    display: inline-block;
    width: 80px;
    height: 80px;
    margin-top: 20px;
    background-image: url('/static/resources/gpu.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}
.icon-cpu:before {
    content: "";
    display: inline-block;
    width: 70px;
    height: 70px;
    margin-top: 15px;
    background-image: url('/static/resources/cpu.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}
.icon-motherboard:before {
    content: "";
    display: inline-block;
    width: 60px;
    height: 60px;
    margin-top: 20px;
    background-image: url('/static/resources/motherboard.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}
.icon-ram:before {
    content: "";
    display: inline-block;
    width: 80px;
    height: 80px;
    margin-top: 20px;
    background-image: url('/static/resources/ram.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}
.icon-ssd:before {
    content: "";
    display: inline-block;
    width: 70px;
    height: 70px;
    margin-top: 15px;
    background-image: url('/static/resources/ssd.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}
.icon-hdd:before {
    content: "";
    display: inline-block;
    width: 65px;
    height: 65px;
    margin-top: 15px;
    background-image: url('/static/resources/hdd.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}
.icon-psu:before {
    content: "";
    display: inline-block;
    width: 60px;
    height: 60px;
    margin-top: 15px;
    background-image: url('/static/resources/psu.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}
.icon-case:before {
    content: "";
    display: inline-block;
    width: 60px;
    height: 60px;
    margin-top: 20px;
    background-image: url('/static/resources/case.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.name-gpu:before {
    content: "Видеокарта";
}
.name-cpu:before {
    content: "Процессор";
}
.name-ram:before {
    content: "Оперативаная память";
}
.name-psu:before {
    content: "Блок питания";
}
.name-motherboard:before {
    content: "Материнска плата";
}
.name-case:before {
    content: "Копрус";
}
.name-ssd:before {
    content: "SSD";
}
.name-hdd:before {
    content: "Жесткий диск";
}

.model-selection-section {
    position: relative;
    z-index: 100; /* Создаем контекст стекинга */
    isolation: isolate; /* Новое свойство для изоляции контекста */
    padding: 40px 0;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4edf5 100%);
    border-bottom: 1px solid #e1e8ed;
}

.model-selection-section .container {
    height: auto; /* Автоматическая высота */
    min-height: 300px; /* Минимальная высота */
    transition: min-height 0.5s ease; /* Плавное изменение */
}

.model-selection-section .container.narrow {
    min-height: 100px; /* Уменьшенная высота */
}

/* Стили для кнопки возврата */
.back-button {
    position: absolute;
    top: -33px;
    left: 20px;
    background: none;
    border: none;
    color: #2a7bc8;
    font-size: 16px;
    cursor: pointer;
    padding: 5px 10px;
    z-index: 10;
}

.back-button:hover {
    text-decoration: underline;
}

.model-selector {
    width: 100% !important;
    max-width: 1400px !important;
    margin: 0 auto;
    position: relative;
    min-height: 300px;
}


.step h2{
    font-size: 2em;
}

/* Добавим новые классы для управления видимостью */
.step {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    opacity: 0;
    transform: translateY(20px);
    transition:
        opacity 0.5s ease,
        transform 0.5s ease;
    visibility: hidden;
    text-align: center;
}

.step.active {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

/* Новый класс для мгновенного скрытия */
.step.instant-hide {
    transition: none !important;
    opacity: 0;
    transform: translateY(20px);
    visibility: hidden;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
    margin: 30px;
}

.category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 25px 15px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: 2px solid transparent;
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border-color: #4da6ff;
}

.category-card:active {
    transform: translateY(0);
}

.category-icon {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: #f0f8ff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    font-size: 32px;
    color: #2a7bc8;
}

.category-card span {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    text-align: center;
}

.model-search-box {
    position: relative;
    z-index: 110; /* Выше, чем у основной секции */
    margin-top: 30px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

#model-search-input {
    width: 100%;
    padding: 15px 25px;
    border: 2px solid #d1e5f7;
    border-radius: 50px;
    font-size: 18px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: all 0.3s;
}

#model-search-input:focus {
    outline: none;
    border-color: #4da6ff;
    box-shadow: 0 6px 16px rgba(77, 166, 255, 0.25);
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); /* Более заметная тень */
    margin-top: 10px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 2000; /* Очень высокий z-index */
    display: none;
    padding: 10px 0;
    transform: translateZ(0); /* Форсируем создание слоя GPU */
}

.result-item {
    padding: 12px 25px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 16px;
    text-align: start;
}

.result-item:hover {
    background: #f0f8ff;
}

.no-results {
    padding: 20px;
    text-align: center;
    color: #95a5a6;
}

/* Анимации */
.fade-in {
    animation: fadeIn 0.5s forwards;
}

.fade-out {
    animation: fadeOut 0.3s forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-20px); }
}

/* Для мобильных устройств */
@media (max-width: 768px) {
    .search-results {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 90%;
        max-height: 70vh;
        z-index: 3000; /* Максимальный для мобилок */
    }

    /* Оверлей для мобилок */
    .search-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.7);
        z-index: 2500;
        display: none;
    }
}

.model-search-top {
    margin-bottom: 20px;
}

.search-label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    text-align: center;
}

.search-label h2{
    font-size: 2em;
}

.or-use-filters {
    text-align: center;
    margin: 15px 0;
    color: #666;
    font-style: italic;
    position: relative;
}

.or-use-filters:before,
.or-use-filters:after {
    content: "";
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background-color: #ddd;
}

.or-use-filters:before {
    left: 0;
}

.or-use-filters:after {
    right: 0;
}

.sorting-controls {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
}

/* Адаптивные стили */
@media (max-width: 768px) {
    .model-search-top {
        margin-bottom: 15px;
    }

    .or-use-filters {
        margin: 10px 0;
    }

    .or-use-filters:before,
    .or-use-filters:after {
        width: 30%;
    }
}