/* Apartments grid – cards and filters.
 * Paleta (variabilele --ap-*) e definită în stilul de bază comun:
 * inc/apartments/apartments-base/assets/apartments-base.css
 *
 * Bara flotantă „Cere detalii" a fost externalizată în modulul global:
 * inc/site-cta-bar/ */

/* No-results message (shown by JS when a filter combo matches nothing) */
.ap-no-results {
    text-align: center;
    padding: 32px 16px;
    margin: 0 0 20px;
    background-color: var(--ap-accent-10);
    border-radius: 8px;
    color: var(--ap-primary);
    font-weight: 500;
}

.ap-no-results[hidden] {
    display: none;
}

/* "More apartments" block */
.more-apartments {
    margin-top: 20px;
    margin-bottom: 20px;
    text-align: center;
    padding: 1rem 1rem;
    background-color: var(--ap-accent-10);
    border-radius: 8px;
}

/* Grid + filters */
.ap {
    overflow: hidden;
}

.ap-filters-wrap {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 24px;
    margin: 30px 0;
}

.ap-filters-wrap .button-group {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.ap-filters-wrap .button-group .button {
    border-style: solid;
    border-width: 2px 2px 2px 2px;
    padding: 8px 16px 8px 16px;
    border-radius: 50rem;
    background-color: transparent;
    color: var(--ap-primary);
}

.ap-filters-wrap .button-group.group-green .button {
    border-color: var(--ap-accent);
}

.ap-filters-wrap .button-group.group-green .button:hover,
.ap-filters-wrap .button-group.group-green .button.is-checked {
    background-color: var(--ap-accent);
}

.ap-filters-wrap .button-group.group-blue .button {
    border-color: var(--ap-primary);
}

.ap-filters-wrap .button-group.group-blue .button:hover,
.ap-filters-wrap .button-group.group-blue .button.is-checked {
    background-color: var(--ap-primary);
    color: #fff;
}

/* =====================================================================
 * Filtre premium (varianta cu select-uri + switch de disponibilitate).
 * Toate au aceeași culoare (linii subțiri neutre), rotunjire 50rem, aerisit.
 * Varianta veche cu butoane rămâne mai sus (.button-group) pentru comutare.
 * ================================================================== */
.ap-filters--select {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: 20px;
    margin: 30px 0 40px;
}

.ap-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ap-field-label {
    display: block;
    margin: 0;
    padding-left: 18px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: normal;
    text-transform: none;
    color: var(--ap-primary-60);
}

/* Select premium */
.ap-select-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.ap-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 100%;
    min-width: 200px;
    min-height: 50px;
    margin: 0;
    padding: 14px 46px 14px 22px;
    border: 1px solid var(--ap-primary-20);
    border-radius: 50rem;
    background: transparent;
    color: var(--ap-primary);
    font-size: 15px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.ap-select:hover {
    border-color: var(--ap-primary-40);
}

.ap-select:focus {
    outline: none;
    border-color: var(--ap-primary);
    box-shadow: 0 0 0 3px var(--ap-primary-10);
}

.ap-select-icon {
    position: absolute;
    right: 20px;
    width: 14px;
    height: 14px;
    color: var(--ap-primary-60);
    pointer-events: none;
}

/* Switch de disponibilitate (chenar în același stil ca select-ul) */
.ap-switch {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 50px;
    padding: 0 22px;
    border: 1px solid var(--ap-primary-20);
    border-radius: 50rem;
    cursor: pointer;
    user-select: none;
}

.ap-switch-text {
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    color: var(--ap-primary-40);
    transition: color 0.2s ease;
}

/* Activarea schimbă DOAR culoarea (grosimea rămâne fixă, ca să nu miște layout-ul).
 * Implicit dezactivat => „Toate" e activ. */
.ap-switch-text--left {
    color: var(--ap-primary);
}

.ap-switch.is-on .ap-switch-text--left {
    color: var(--ap-primary-40);
}

.ap-switch.is-on .ap-switch-text--right {
    color: var(--ap-primary);
}

/* Numărul dintre paranteze de lângă etichete: puțin mai discret decât textul. */
.ap-count {
    font-variant-numeric: tabular-nums;
    opacity: 0.65;
}

.ap-switch-control {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
}

.ap-switch-control input {
    position: absolute;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.ap-switch-track {
    position: relative;
    width: 42px;
    height: 24px;
    border-radius: 50rem;
    background: var(--ap-primary-20);
    transition: background 0.2s ease;
}

.ap-switch-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(23, 40, 67, 0.25);
    transition: transform 0.2s ease;
}

.ap-switch.is-on .ap-switch-track {
    background: var(--ap-primary);
}

.ap-switch.is-on .ap-switch-thumb {
    transform: translateX(18px);
}

@media screen and (max-width: 560px) {
    .ap-filters--select {
        flex-direction: column;
        align-items: stretch;
    }

    .ap-select {
        min-width: 0;
    }

    /* Switch-ul nu se întinde pe toată lățimea: rămâne aliniat stânga,
     * cu spațiu gol în dreapta. */
    .ap-switch {
        align-self: flex-start;
    }
}

.ap-row {
    display: flex;
    flex-wrap: wrap;
    margin-left: -12px;
    margin-right: -12px;
}

.ap-item {
    padding: 0 12px;
    margin-bottom: 24px;
    width: 25%;
}

.ap-item-inner {
    height: 100%;
    background-color: #fff;
    border: 1px solid var(--ap-primary-20);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    /* Întreg cardul e link către pagina single */
    color: inherit;
    text-decoration: none;
    transition:
        background-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

.ap-item-inner:hover {
    background-color: var(--ap-light);
    box-shadow: 0 8px 24px rgba(23, 40, 67, 0.12);
    transform: translateY(-2px);
}

.ap-item-inner:hover,
.ap-item-inner:focus,
.ap-item-inner:hover .ap-item-top-info-1,
.ap-item-inner:focus .ap-item-top-info-1 {
    color: inherit;
}

/* Imagine card: pătrat 1:1, contain, fundal alb */
.ap-item-image {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background-color: #fff;
    border-radius: 3px;
    overflow: hidden;
    /* Centrare robustă chiar dacă tema forțează img{height:auto} */
    display: flex;
    align-items: center;
    justify-content: center;
}

.ap-item-image-main {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center;
    background-color: #fff;
    display: block;
}

/* Duplex: miniatură cu nivelul secundar, colț dreapta-jos */
.ap-item-image-secondary {
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: 40% !important;
    height: 40% !important;
    object-fit: contain;
    background-color: #fff;
    border-radius: 6px !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25) !important;
    transition:
        width 0.25s ease,
        height 0.25s ease,
        right 0.25s ease,
        bottom 0.25s ease,
        border-radius 0.25s ease,
        box-shadow 0.25s ease;
    z-index: 2;
}

/* La hover pe card, miniatura crește pe toată suprafața și pierde radius/umbră */
.ap-item-inner:hover .ap-item-image-secondary {
    right: 0;
    bottom: 0;
    width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.ap-item-top {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 10px;
}

.ap-item-top-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Titlu card – aceeași formă ca pe single (lead subțire + rest mai discret),
 * trunchiat la maximum 2 rânduri (multiline truncate). */
.ap-item-title {
    margin: 0;
    font-size: 20px;
    font-weight: 400;
    line-height: 1.2;
    /* Nu depăși niciodată 2 rânduri; după rândul 2 apar „…". */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
}

.ap-item-title-lead {
    color: var(--ap-dark);
    font-weight: 400;
}

.ap-item-title-rest {
    color: var(--ap-dark-60);
    font-weight: 200;
    font-size: 0.8em;
}

/* Etajele sub titlu (pot fi mai multe la duplex, separate prin virgulă). */
.ap-item-floors {
    color: var(--ap-dark);
    font-weight: 200;
    font-size: 14px;
    line-height: 1.2;
}

.ap-item-top-areas {
    display: flex;
    margin-top: 6px;
    color: var(--ap-primary);
    border-top: 1px solid var(--ap-primary-10);
    border-bottom: 1px solid var(--ap-primary-10);
}

.ap-item-top-areas > div {
    width: 33.3333%;
    padding: 6px 2px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    justify-content: center;
    text-align: center;
}

.ap-item-top-areas > div:nth-child(1) {
    /* background-color: #00000005; */
}

.ap-item-top-areas > div:nth-child(2) {
    /* background-color: #ffffff66; */
    border-left: 1px solid var(--ap-primary-10);
    border-right: 1px solid var(--ap-primary-10);
}

.ap-item-top-areas > div:nth-child(3) {
    /* background-color: #00000005; */
}

.ap-item-top-areas > div > div:first-of-type {
    font-size: 24px;
    font-weight: 400;
    line-height: 1em;
}

.ap-item-top-areas > div > div:last-of-type {
    font-size: 13px;
    line-height: 1em;
    color: var(--ap-primary-60);
    font-weight: 200;
}

.ap-item-bottom {
    padding: 10px;
}

/* „m²" din eticheta de suprafață (ex. Balcon (m²)) */
.ap-item-top-areas sup {
    font-size: 0.7em;
}

/* Prețul: bloc comun (inc/apartments/apartments-price/assets/apartments-price.css).
 * Doar pe cardul de arhivă îl facem mai subtil: preț 400, text TVA 200. */
.ap-item-bottom .apt-price-main {
    font-weight: 400;
}

.ap-item-bottom .apt-price-main .apt-price-suffix {
    font-weight: 200;
}

.ap-item-bottom .apt-price-vat {
    font-weight: 400;
}

.ap-item-bottom .apt-price-vat .apt-price-suffix {
    font-weight: 200;
}

.ap-item-bottom .rezervat {
    width: 100%;
    text-align: center;
    line-height: 1em;
    padding: 13px 10px;
    font-size: 15px;
    border-radius: 8px;
    background-color: var(--ap-accent-20);
    color: var(--ap-primary);
}

.ap-item-bottom .vandut {
    width: 100%;
    text-align: center;
    line-height: 1em;
    padding: 15px 10px;
    font-size: 15px;
    border-radius: 8px;
    background-color: var(--ap-danger);
    color: #fff;
}

@media screen and (max-width: 1024px) {
    .ap-item {
        width: 33.333%;
    }
}

@media screen and (max-width: 879px) {
    .ap-item {
        width: 50%;
    }
}

@media screen and (max-width: 560px) {
    .ap-item {
        width: 100%;
    }
}
