/* ── Blog Search Bar ── */
.blog-search {
    position: relative;
    width: 100%;
    max-width: 60rem;
    margin: 0 auto 4rem;
}

.blog-search__field {
    position: relative;
    display: flex;
    align-items: center;
}

.blog-search__icon {
    position: absolute;
    left: 1.6rem;
    top: 50%;
    transform: translateY(-50%);
    width: 2rem;
    height: 2rem;
    pointer-events: none;
    color: #999;
}

.blog-search__icon svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.blog-search__input {
    width: 100%;
    padding: 1.4rem 4.8rem 1.4rem 4.8rem;
    border: 2px solid #e0e0e0;
    border-radius: 1.2rem;
    font-size: 1.6rem;
    font-family: inherit;
    background: #fff;
    color: #0d0d0d;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.blog-search__input::placeholder {
    color: #999;
}

.blog-search__input:focus {
    border-color: #fdb602;
    box-shadow: 0 0 0 3px rgba(253, 182, 2, 0.15);
}

.blog-search__clear {
    position: absolute;
    right: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    display: none;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    border: none;
    background: #e0e0e0;
    border-radius: 50%;
    cursor: pointer;
    color: #666;
    font-size: 1.4rem;
    line-height: 1;
    transition: background 0.2s;
    padding: 0;
}

.blog-search__clear:hover {
    background: #ccc;
}

/* ── Live Search Dropdown ── */
.blog-search__dropdown {
    position: absolute;
    top: calc(100% + 0.4rem);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 1.2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    max-height: 40rem;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.blog-search__dropdown._visible {
    display: block;
}

.blog-search__dropdown::-webkit-scrollbar {
    width: 6px;
}

.blog-search__dropdown::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

.blog-search__loading,
.blog-search__empty {
    padding: 1.6rem 2rem;
    color: #999;
    font-size: 1.4rem;
    text-align: center;
}

.blog-search__item {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    width: 100%;
    padding: 1.2rem 1.6rem;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}

.blog-search__item:hover,
.blog-search__item:focus {
    background: #f8f8f8;
    outline: none;
}

.blog-search__item + .blog-search__item {
    border-top: 1px solid #f0f0f0;
}

.blog-search__item-img {
    width: 5.6rem;
    height: 4rem;
    border-radius: 0.6rem;
    object-fit: cover;
    flex-shrink: 0;
}

.blog-search__item-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    overflow: hidden;
    min-width: 0;
}

.blog-search__item-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: #0d0d0d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.blog-search__item-excerpt {
    font-size: 1.2rem;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Blog Layout with Sidebar ── */
.blog-list__layout {
    display: flex;
    gap: 4rem;
    align-items: flex-start;
}

/* ── Sidebar ── */
.blog-sidebar {
    flex-shrink: 0;
    width: 24rem;
    position: sticky;
    top: 14rem;
}

.blog-sidebar__title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #0d0d0d;
    margin-bottom: 1.6rem;
    padding-bottom: 1.2rem;
    border-bottom: 2px solid #fdb602;
}

.blog-sidebar__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.blog-sidebar__link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.2rem;
    border-radius: 0.8rem;
    font-size: 1.4rem;
    color: #333;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    font-family: inherit;
    text-align: left;
}

.blog-sidebar__link:hover {
    background: #f5f5f5;
    color: #0d0d0d;
}

.blog-sidebar__link._active {
    background: #fdb602;
    color: #0d0d0d;
    font-weight: 600;
}

.blog-sidebar__count {
    font-size: 1.2rem;
    color: #999;
    background: #f0f0f0;
    padding: 0.2rem 0.8rem;
    border-radius: 1rem;
    min-width: 2.4rem;
    text-align: center;
    margin-left: 0.8rem;
}

.blog-sidebar__link._active .blog-sidebar__count {
    background: rgba(255, 255, 255, 0.4);
    color: #0d0d0d;
}

/* ── Results Grid ── */
.blog-results {
    flex: 1;
    min-width: 0;
}

#blog-results-grid {
    grid-gap: 2.4rem;
    display: grid;
    gap: 2.4rem;
    grid-template-columns: repeat(3, 1fr);
    transition: opacity 0.2s;
}

#blog-results-grid._loading {
    opacity: 0.4;
    pointer-events: none;
}

.blog-results__empty {
    grid-column: 1 / -1;
    text-align: center;
    color: #999;
    font-size: 1.6rem;
    padding: 6rem 2rem;
}

/* ── Pagination ── */
#blog-results-pagination {
    margin-top: 4rem;
    text-align: center;
    display: flex;
    justify-content: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.blog-pagination__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 4rem;
    padding: 0.8rem 1.2rem;
    background: #f0f0f0;
    color: #333;
    border: none;
    border-radius: 0.6rem;
    font-size: 1.4rem;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.blog-pagination__btn:hover {
    background: #e0e0e0;
}

.blog-pagination__btn.current {
    background: #fdb602;
    color: #0d0d0d;
    font-weight: 700;
    pointer-events: none;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
    #blog-results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .blog-list__layout {
        flex-direction: column;
        gap: 2.4rem;
    }

    .blog-sidebar {
        width: 100%;
        position: static;
    }

    .blog-sidebar__list {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.8rem;
    }

    .blog-sidebar__link {
        padding: 0.8rem 1.2rem;
        font-size: 1.3rem;
    }

    .blog-search {
        max-width: 100%;
    }
}

@media (max-width: 600px) {
    #blog-results-grid {
        grid-template-columns: 1fr;
    }

    .blog-search__input {
        font-size: 1.4rem;
        padding: 1.2rem 4rem 1.2rem 4rem;
    }
}
