/* =========================
   КАРТОЧКИ ОБЪЯВЛЕНИЙ
========================= */
.items-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 18px;
}

.item {
    background: var(--panel);
    border: 1px solid rgba(24, 193, 210, 0.18);
    border-radius: 20px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.item:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
    border-color: var(--accent);
}

.item .image {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #111;
}

.item .image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.item .text {
    padding: 14px 14px 16px;
}

.item .text h4 {
    margin: 0 0 10px;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
}

.item .text h4 a {
    color: var(--text);
    transition: color 0.2s ease;
}

.item .text h4 a:hover {
    color: var(--accent);
}

.price {
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.location {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    line-height: 1.3;
}

.title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.title-row h4 {
    margin: 0;
    flex: 1;
    font-size: 18px;
    line-height: 1.25;
}

.title-row h4 a {
    color: var(--text);
}

.title-row h4 a:hover {
    color: var(--accent);
}

.favorite-toggle {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    box-shadow: none;
    outline: none;
}

.favorite-toggle:hover {
    border: none;
    background: transparent;
    box-shadow: none;
}

.favorite-toggle.is-active {
    background: transparent;
    border: none;
    box-shadow: none;
}

.favorite-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    display: none;
}

body.theme-dark .favorite-dark {
    display: block;
}

body.theme-dark .favorite-light {
    display: none;
}

body.theme-light .favorite-dark {
    display: none;
}

body.theme-light .favorite-light {
    display: block;
}

.favorite-toggle:focus,
.favorite-toggle:active {
    outline: none;
    box-shadow: none;
}

.item-price {
    margin: 10px 0 6px;
    color: var(--accent);
    font-size: 20px;
    font-weight: 700;
    line-height: 1.2;
}

.desc {
    margin: 10px 0 6px;
    color: var(--text);
    font-size: 20px;
    font-weight: 700;
    line-height: 1.2;
}

/* =========================
   ИЗБРАННЫЕ ОБЪЯВЛЕНИЯ
========================= */

.favorites-page {
    width: min(900px, calc(100% - 40px));
    margin: 0 auto;
    padding: 42px 0 70px;
}

.favorites-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 28px;
}

.favorites-header h1 {
    margin: 0 0 6px;
    color: var(--text);
    font-size: 30px;
    font-weight: 900;
}

.favorites-header p {
    margin: 0;
    color: var(--muted);
    font-size: 15px;
}

.favorites-sort-btn {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 10px;
    background: rgba(24, 193, 210, 0.08);
    color: var(--text);
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid rgba(24, 193, 210, 0.16);
}

.favorites-sort-btn:hover {
    color: var(--accent);
    border-color: rgba(24, 193, 210, 0.35);
}

.favorites-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.favorite-row {
    display: grid;
    grid-template-columns: 220px 1fr 42px;
    gap: 24px;
    align-items: start;
    padding: 18px 0;
    border-bottom: 1px solid rgba(24, 193, 210, 0.12);
}

.favorite-row:first-child {
    padding-top: 0;
}

.favorite-row:hover .favorite-row-title {
    text-decoration: underline;
}

.favorite-row-image {
    display: block;
    width: 220px;
    height: 160px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--panel);
    text-decoration: none;
}

.favorite-row-image img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.favorite-no-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    background: var(--input);
    font-size: 15px;
}

.favorite-row-body {
    padding-top: 2px;
}

.favorite-row-title {
    display: inline-block;
    margin-bottom: 7px;
    color: #1ea7ff;
    font-size: 22px;
    font-weight: 900;
    line-height: 1.2;
    text-decoration: none;
}

.favorite-row-price {
    margin-bottom: 7px;
    color: var(--text);
    font-size: 22px;
    font-weight: 900;
    line-height: 1.2;
}

.favorite-row-location {
    color: var(--text);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
}

.favorite-row-date {
    margin-top: 5px;
    color: var(--muted);
    font-size: 14px;
}

.favorite-row-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 8px;
}

.favorite-heart-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    text-decoration: none;
}

.favorite-row-icon {
    width: 23px;
    height: 23px;
    object-fit: contain;
}

.favorite-heart-btn:hover {
    transform: scale(1.08);
}

.favorites-empty {
    padding: 50px 24px;
    border-radius: 18px;
    background: var(--panel);
    border: 1px solid rgba(24, 193, 210, 0.18);
    text-align: center;
}

.favorites-empty h2 {
    margin: 0 0 10px;
    color: var(--text);
    font-size: 24px;
}

.favorites-empty p {
    margin: 0 0 20px;
    color: var(--muted);
}

.favorites-empty-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 22px;
    border-radius: 14px;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    font-weight: 800;
}

.favorites-empty-btn:hover {
    background: var(--accent-hover);
}

@media (max-width: 800px) {
    .favorites-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .favorite-row {
        grid-template-columns: 180px 1fr 36px;
        gap: 16px;
    }

    .favorite-row-image {
        width: 180px;
        height: 135px;
    }

    .favorite-row-title,
    .favorite-row-price {
        font-size: 19px;
    }

    .favorite-row-location {
        font-size: 14px;
    }
}

@media (max-width: 600px) {
    .favorite-row {
        grid-template-columns: 1fr;
    }

    .favorite-row-image {
        width: 100%;
        height: 240px;
    }

    .favorite-row-actions {
        justify-content: flex-start;
        padding-top: 0;
    }
}

.favorites-categories {
    display: flex;
    gap: 10px;
    margin: 0 0 28px;
    padding-bottom: 4px;
    overflow-x: auto;
}

.favorites-category-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    border: 1px solid rgba(24, 193, 210, 0.12);
}

.favorites-category-chip:hover {
    color: var(--accent);
    border-color: rgba(24, 193, 210, 0.35);
}

.favorites-category-chip.is-active {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
}