/* ============================================================
   LISTINGS & AD CARDS
   Dodati u style.css — koristi se na svim stranicama sa oglasima
   ============================================================ */

/* -- LISTINGS HEADER -- */
.listings-section { max-width: 1300px; margin: 2.5rem auto 0; padding: 0 1.25rem; }
.listings-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1.25rem; }
.listings-meta { font-size: 0.82rem; color: var(--muted); margin-top: 0.15rem; }
.listings-controls { display: flex; align-items: center; gap: 0.5rem; }
.sort-select { border: 1.5px solid var(--border); border-radius: 8px; padding: 0.4rem 0.75rem; font-family: inherit; font-size: 0.82rem; color: var(--text-2); background: white; outline: none; cursor: pointer; }
.view-btns { display: flex; gap: 0.35rem; }
.view-btn { background: white; border: 1.5px solid var(--border); border-radius: 8px; padding: 0.38rem 0.65rem; cursor: pointer; font-size: 0.8rem; color: var(--muted); transition: all 0.2s; }
.view-btn.active { background: var(--red); border-color: var(--red); color: white; }

/* -- ADS GRID -- */
.ads-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 1.25rem; }
.ads-grid.list-view { grid-template-columns: 1fr; }

/* -- AD CARD -- */
.ad-card { text-decoration:none;background: white; border: 1.5px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: all 0.25s; cursor: pointer; position: relative; }
.ad-card a{ text-decoration:none;}
a.ad-card {
    text-decoration: none;
    color: inherit;
    display: block;
}

.ad-card:hover { border-color: #d1d5db; box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.ad-card[data-hidden="true"] { display: none; }

.ad-img { height: 175px; background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%); display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.ad-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;  /* popuni, izreži višak */
    display: block;
}
.ad-img i { font-size: 1rem; color: #d1d5db; }
.ad-badge { position: absolute; top: 0.55rem; left: 0.65rem; background: var(--red); color: white; font-size: 0.68rem; font-weight: 700; padding: 0.2rem 0.55rem; border-radius: 6px; text-transform: uppercase; letter-spacing: 0.3px; display: flex; align-items: center; gap: 0.3rem; z-index: 1; }
.ad-fav { position: absolute; top: 0.65rem; right: 0.65rem; width: 30px; height: 30px; background: rgba(255,255,255,0.92); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; color: var(--muted); cursor: pointer; transition: all 0.2s; z-index: 1; border: none; }
/* Boja za samo dugme ako je aktivno ili hover */
.ad-fav:hover,
.ad-fav.active {
    background: white;
    border-color: var(--red); /* Opciono, ako imaš border */
}

/* KLJUČNI DEO: Boja ikonice unutar aktivnog dugmeta */
.ad-fav:hover i,
.ad-fav.active i {
    color: var(--red) !important;
}

.ad-body { padding: 0.9rem 1rem; }
.ad-cat-tag { display: block; font-size: 0.69rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 0.35rem; }
.ad-title { font-weight: 700; font-size: 0.96rem; color: var(--text); margin-bottom: 0.5rem; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ad-price { font-size: 1.0rem; font-weight: 800; color: var(--red); margin-bottom: 0.6rem; }
.ad-price small { font-size: 0.72rem; color: var(--muted); font-weight: 500; }
.ad-sqm {
    position: absolute;
    bottom: 0.6rem;
    right: 0.6rem;
    background: rgba(0,0,0,0.55);
    color: white;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.22rem 0.6rem;
    border-radius: 6px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    letter-spacing: 0.2px;
}
.ad-footer { display: flex; justify-content: space-between; align-items: center; font-size: 0.74rem; color: var(--muted); border-top: 1px solid var(--border); padding-top: 0.65rem; }
.ad-footer-left { display: flex; align-items: center; gap: 0.35rem; }
.ad-views { display: flex; align-items: center; gap: 0.3rem; }

/* -- LIST VIEW -- */
/* Grid view — ostaje isto */
.ads-grid.list-view .ad-card {
    display: flex;
    flex-direction: row;
    position: relative;
}

.ads-grid.list-view .ad-card > a {
    display: flex;
    flex-direction: row;
    flex: 1;
    max-height:160px;
    min-width: 0;
    text-decoration: none;
    color: inherit;
}

.ads-grid.list-view .ad-card > a .ad-img {
    width: 30%;
    min-width: 160px;
    height: 100%;
    flex-shrink: 0;
}

.ads-grid.list-view .ad-card > a .ad-body {
    flex: 1;
    min-width: 0;
}

@media (max-width: 540px) {
    .ads-grid.list-view .ad-card > a {
        flex-direction: row;
        max-height:190px;
    }
    .ads-grid.list-view .ad-card > a .ad-img {
        width: 100px;
        min-width: unset;

    }
}
/* Na mobilnom lista ostaje horizontalna, samo slika je uza */
@media (max-width: 540px) {
    .ads-grid.list-view .ad-img { width: 100px; min-width: 100px; }
    .ads-grid.list-view .ad-title { font-size: 0.88rem; }
    .ads-grid.list-view .ad-price { font-size: 1rem; }
}

/* -- EMPTY STATE & LOAD MORE -- */
.empty-notice { grid-column: 1/-1; text-align: center; padding: 4rem 2rem; background: white; border: 1.5px solid var(--border); border-radius: var(--radius); display: none; }
.empty-notice.visible { display: block; }
.empty-notice i { font-size: 2.5rem; color: var(--muted-light); display: block; margin-bottom: 1rem; }
.empty-notice h3 { font-size: 1.1rem; color: var(--text-2); margin-bottom: 0.5rem; }
.empty-notice p { font-size: 0.88rem; color: var(--muted); margin-bottom: 1.5rem; }

.load-more-wrap { text-align: center; margin: 2rem 0 3rem; }
.btn-load-more { text-decoration:none;background: white; border: 1.5px solid var(--border); color: var(--text-2); padding: 0.7rem 2rem; border-radius: 9999px; font-family: inherit; font-weight: 600; font-size: 0.88rem; cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; gap: 0.5rem; }
.btn-load-more:hover { border-color: var(--red); color: var(--red); }