﻿.am-search-page {
    padding: 24px 16px;
}

.am-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--am-muted);
    margin-bottom: 20px;
}

    .am-breadcrumb a {
        color: inherit;
        text-decoration: none;
    }

        .am-breadcrumb a:hover {
            color: var(--am-text);
            text-decoration: underline;
        }

.am-search-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
}

.am-search-sidebar {
    position: sticky;
    top: 20px;
    height: fit-content;
}

.am-sidebar-cats {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 20px;
}

.am-sidebar-cats__title {
    font-size: 16px;
    font-weight: 800;
    margin: 0 0 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--am-red);
}

.am-cat-tree {
    list-style: none;
    margin: 0;
    padding: 0;
}

.am-cat-tree__item {
    margin-bottom: 4px;
}

.am-cat-tree__row {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: space-between;
}

.am-cat-tree__link {
    flex: 1;
    padding: 10px 14px;
    border-radius: 6px;
    text-decoration: none;
    color: var(--am-text);
    font-size: 14px;
    font-weight: 500;
    transition: all .2s ease;
}

    .am-cat-tree__link:hover {
        background: #f5f5f5;
        color: var(--am-red);
    }

.am-cat-tree__item.is-selected > .am-cat-tree__row .am-cat-tree__link {
    background: var(--am-red);
    color: #fff;
    font-weight: 600;
}

.am-cat-tree__toggle {
    width: 32px;
    height: 32px;
    border: 2px solid var(--am-red);
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .25s ease;
    border-radius: 6px;
    flex-shrink: 0;
}

    .am-cat-tree__toggle:hover {
        background: var(--am-red);
    }

        .am-cat-tree__toggle:hover .am-cat-tree__icon {
            color: #fff;
        }

.am-cat-tree__icon {
    font-size: 20px;
    font-weight: 700;
    color: var(--am-red);
    line-height: 1;
    transition: all .25s ease;
}

.am-cat-tree__item.is-open .am-cat-tree__toggle {
    background: var(--am-red);
    border-color: var(--am-red);
}

.am-cat-tree__item.is-open .am-cat-tree__icon {
    transform: rotate(45deg);
    color: #fff;
}

.am-cat-tree__sub {
    list-style: none;
    margin: 8px 0 12px 0;
    padding: 12px 0 12px 20px;
    border-left: 3px solid var(--am-red);
    display: none;
    background: linear-gradient(90deg, rgba(15,76,92,0.03) 0%, transparent 100%);
}

.am-cat-tree__item.is-open > .am-cat-tree__sub {
    display: block;
    animation: slideDown .3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.am-cat-tree__sub .am-cat-tree__link {
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--am-red);
    position: relative;
}

    .am-cat-tree__sub .am-cat-tree__link::before {
        content: "→";
        position: absolute;
        left: -8px;
        opacity: 0;
        transition: all .2s ease;
    }

    .am-cat-tree__sub .am-cat-tree__link:hover {
        background: rgba(15,76,92,0.08);
        color: var(--am-red);
        padding-left: 20px;
    }

        .am-cat-tree__sub .am-cat-tree__link:hover::before {
            opacity: 1;
            left: 0;
        }

.am-cat-tree__sub .am-cat-tree__item.is-selected .am-cat-tree__link {
    background: var(--am-red);
    color: #fff;
    font-weight: 600;
}

    .am-cat-tree__sub .am-cat-tree__item.is-selected .am-cat-tree__link::before {
        opacity: 0;
    }

.am-search-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 20px;
}

.am-search-toolbar__left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.am-search-toolbar__label {
    font-size: 14px;
    color: var(--am-muted);
}

.am-view-switcher {
    display: flex;
    gap: 6px;
}

.am-view-btn {
    width: 36px;
    height: 36px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .2s ease;
}

    .am-view-btn svg {
        width: 18px;
        height: 18px;
        stroke: var(--am-muted);
    }

    .am-view-btn:hover,
    .am-view-btn.active {
        border-color: var(--am-red);
        background: var(--am-red);
    }

        .am-view-btn:hover svg,
        .am-view-btn.active svg {
            stroke: #fff;
        }

.am-search-toolbar__center {
    font-size: 14px;
    color: var(--am-text);
}

    .am-search-toolbar__center strong {
        font-weight: 700;
        color: var(--am-red);
    }

.am-sort-form {
    display: flex;
}

.am-sort-select {
    min-width: 180px;
    padding: 8px 32px 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7 10l5 5 5-5" fill="%23666"/></svg>') no-repeat right 8px center;
    background-size: 16px;
    appearance: none;
    cursor: pointer;
    font-size: 14px;
}

.am-product-grid {
    display: grid;
    gap: 16px;
    margin-bottom: 32px;
}

    .am-product-grid.am-grid-4 {
        grid-template-columns: repeat(4, 1fr);
    }

    .am-product-grid.am-grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }

    .am-product-grid.am-grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .am-product-grid.am-grid-list {
        grid-template-columns: 1fr;
    }

        .am-product-grid.am-grid-list .am-card {
            display: grid;
            grid-template-columns: 200px 1fr;
            gap: 16px;
        }

.am-no-results {
    text-align: center;
    padding: 80px 20px;
}

    .am-no-results svg {
        opacity: .3;
        margin-bottom: 16px;
    }

    .am-no-results h3 {
        font-size: 18px;
        margin: 0 0 8px;
    }

    .am-no-results p {
        color: var(--am-muted);
        margin: 0;
    }

.am-pagination {
    margin-top: 32px;
}

    .am-pagination ul {
        display: flex;
        justify-content: center;
        gap: 8px;
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .am-pagination li a {
        display: block;
        padding: 8px 14px;
        border: 1px solid #ddd;
        border-radius: 6px;
        text-decoration: none;
        color: var(--am-text);
        transition: all .2s ease;
    }

        .am-pagination li a:hover,
        .am-pagination li.active a {
            background: var(--am-red);
            border-color: var(--am-red);
            color: #fff;
        }

@media (max-width: 1024px) {
    .am-search-layout {
        grid-template-columns: 1fr;
    }

    .am-search-sidebar {
        position: static;
    }

    .am-product-grid.am-grid-4 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .am-search-toolbar {
        flex-wrap: wrap;
        gap: 12px;
    }

    .am-search-toolbar__left,
    .am-search-toolbar__center,
    .am-search-toolbar__right {
        flex: 1 1 100%;
    }

    .am-product-grid.am-grid-4,
    .am-product-grid.am-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

.am-category-header {
    margin-bottom: 20px;
}

.am-category-title {
    font-size: 28px;
    font-weight: 800;
    margin: 0 0 8px;
    color: var(--am-text);
}

.am-category-count {
    font-size: 14px;
    color: var(--am-muted);
    margin: 0;
}

    .am-category-count strong {
        color: var(--am-red);
        font-weight: 700;
    }


.am-product-grid.am-grid-1 {
    grid-template-columns: 1fr;
}

.am-view-btn--mobile {
    display: none;
}

@media (max-width: 768px) {

    .am-view-switcher .am-view-btn[data-view="grid-4"],
    .am-view-switcher .am-view-btn[data-view="grid-3"] {
        display: none !important;
    }

    .am-view-btn--mobile {
        display: flex;
    }
}

.am-search-content.is-ajax-loading {
    opacity: .55;
    pointer-events: none;
    transition: opacity .15s ease;
}

.am-ajax-fadein {
    animation: amFadeIn .22s ease;
}

@keyframes amFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}
