/* =============================================================================
   Real Estate Manager — style.css
   Shortcode [real_estate_list]
   ============================================================================= */

/* ── Variables ──────────────────────────────────────────────────────────────── */

:root {
    --re-accent:       #c8973a;
    --re-accent-dark:  #a87a28;
    --re-blue:         #1a4f6e;
    --re-ink:          #1a1a2e;
    --re-ink-mid:      #4a4a6a;
    --re-ink-light:    #8888aa;
    --re-bg:           #f7f6f3;
    --re-bg-card:      #ffffff;
    --re-border:       #e4e0d8;
    --re-radius:       10px;
    --re-radius-sm:    6px;
    --re-shadow:       0 2px 12px rgba(0,0,0,0.07);
    --re-shadow-hover: 0 8px 28px rgba(0,0,0,0.13);
    --re-transition:   0.2s ease;
    --re-badge-vente:      #e8f5e9;
    --re-badge-vente-text: #2e7d32;
    --re-badge-loc:        #e8f0fe;
    --re-badge-loc-text:   #1a47c8;
    --re-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Conteneur global ───────────────────────────────────────────────────────── */

.re-app {
    font-family: var(--re-font);
    color: var(--re-ink);
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px 40px;
}

/* ── TOOLBAR ────────────────────────────────────────────────────────────────── */

.re-toolbar {
    background: var(--re-bg-card);
    border: 1px solid var(--re-border);
    border-radius: var(--re-radius);
    padding: 18px 20px;
    margin-bottom: 24px;
    box-shadow: var(--re-shadow);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Recherche */
.re-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.re-search-icon {
    position: absolute;
    left: 12px;
    width: 18px;
    height: 18px;
    color: var(--re-ink-light);
    pointer-events: none;
    flex-shrink: 0;
}

.re-search {
    width: 100%;
    padding: 10px 36px 10px 40px;
    border: 1px solid var(--re-border);
    border-radius: var(--re-radius-sm);
    font-size: 14px;
    color: var(--re-ink);
    background: var(--re-bg);
    transition: border-color var(--re-transition), box-shadow var(--re-transition);
    outline: none;
}

.re-search:focus {
    border-color: var(--re-accent);
    box-shadow: 0 0 0 3px rgba(200,151,58,0.15);
    background: #fff;
}

.re-search-clear {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    color: var(--re-ink-light);
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: color var(--re-transition), background var(--re-transition);
}

.re-search-clear:hover {
    color: var(--re-ink);
    background: var(--re-border);
}

/* Filtres */
.re-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.re-select {
    padding: 9px 32px 9px 12px;
    border: 1px solid var(--re-border);
    border-radius: var(--re-radius-sm);
    font-size: 13px;
    color: var(--re-ink);
    background: var(--re-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238888aa' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 10px center;
    appearance: none;
    cursor: pointer;
    outline: none;
    transition: border-color var(--re-transition);
    min-width: 160px;
}

.re-select:focus {
    border-color: var(--re-accent);
    box-shadow: 0 0 0 3px rgba(200,151,58,0.15);
}

/* Prix min/max */
.re-price-range {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}

.re-price-input {
    width: 120px;
    padding: 9px 10px;
    border: 1px solid var(--re-border);
    border-radius: var(--re-radius-sm);
    font-size: 13px;
    color: var(--re-ink);
    background: var(--re-bg);
    outline: none;
    transition: border-color var(--re-transition);
    -moz-appearance: textfield;
}

.re-price-input::-webkit-outer-spin-button,
.re-price-input::-webkit-inner-spin-button { -webkit-appearance: none; }

.re-price-input:focus {
    border-color: var(--re-accent);
    box-shadow: 0 0 0 3px rgba(200,151,58,0.15);
}

.re-price-sep {
    color: var(--re-ink-light);
    font-size: 13px;
}

/* Barre inférieure : tri + compteur + reset */
.re-toolbar-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--re-border);
}

.re-select-sort {
    min-width: 180px;
}

.re-results-count {
    font-size: 13px;
    color: var(--re-ink-mid);
    font-weight: 500;
}

.re-reset-btn {
    padding: 7px 16px;
    border: 1px solid var(--re-border);
    border-radius: var(--re-radius-sm);
    background: #fff;
    color: var(--re-ink-mid);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--re-transition);
}

.re-reset-btn:hover {
    border-color: var(--re-accent);
    color: var(--re-accent);
    background: #fffbf4;
}

/* ── GRILLE ─────────────────────────────────────────────────────────────────── */

.re-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    min-height: 200px;
}

/* ── CARTE BIEN ──────────────────────────────────────────────────────────────── */

.re-card {
    background: var(--re-bg-card);
    border: 1px solid var(--re-border);
    border-radius: var(--re-radius);
    overflow: hidden;
    box-shadow: var(--re-shadow);
    display: flex;
    flex-direction: column;
    transition: transform var(--re-transition), box-shadow var(--re-transition);
    opacity: 0;
    transform: translateY(10px);
}

.re-card-animate {
    animation: re-card-in 0.35s ease forwards;
}

@keyframes re-card-in {
    to { opacity: 1; transform: translateY(0); }
}

.re-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--re-shadow-hover);
}

/* Média */
.re-card-media {
    position: relative;
    height: 200px;
    overflow: hidden;
    background: #f0ede8;
    flex-shrink: 0;
}

.re-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.re-card:hover .re-card-img {
    transform: scale(1.04);
}

.re-card-no-img {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.re-card-no-img svg {
    width: 52px;
    height: 52px;
    color: #ccc;
}

/* Badge offre */
.re-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.re-badge-vente {
    background: var(--re-badge-vente);
    color: var(--re-badge-vente-text);
}

.re-badge-location {
    background: var(--re-badge-loc);
    color: var(--re-badge-loc-text);
}

/* Compteur photos */
.re-photo-count {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0,0,0,0.55);
    color: #fff;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 20px;
    backdrop-filter: blur(4px);
}

/* Corps carte */
.re-card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.re-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--re-ink);
    margin: 0;
    line-height: 1.35;
    /* Tronquer à 2 lignes */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.re-card-location {
    font-size: 12px;
    color: var(--re-ink-mid);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Tags (nature / type) */
.re-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.re-tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    background: #f0ede8;
    color: var(--re-ink-mid);
    font-weight: 500;
}

.re-tag-type {
    background: #edf2fb;
    color: var(--re-blue);
}

/* Chips (surface, étage, meublé…) */
.re-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.re-chip {
    font-size: 12px;
    color: var(--re-ink-mid);
    background: var(--re-bg);
    border: 1px solid var(--re-border);
    border-radius: 20px;
    padding: 3px 10px;
}

/* Footer carte */
.re-card-footer {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid var(--re-border);
}

.re-card-price {
    font-size: 17px;
    font-weight: 700;
    color: var(--re-accent-dark);
    line-height: 1.2;
}

.re-price-na {
    font-size: 13px;
    color: var(--re-ink-light);
    font-weight: 400;
}

.re-card-date {
    font-size: 11px;
    color: var(--re-ink-light);
}

/* ── ÉTAT VIDE ───────────────────────────────────────────────────────────────── */

.re-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--re-ink-mid);
}

.re-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
    opacity: 0.5;
}

.re-empty p {
    margin: 0 0 6px;
    font-size: 15px;
    font-weight: 500;
}

.re-empty-sub {
    font-size: 13px !important;
    color: var(--re-ink-light) !important;
    font-weight: 400 !important;
}

/* ── LOADER ──────────────────────────────────────────────────────────────────── */

.re-loading {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 60px 20px;
    color: var(--re-ink-light);
    font-size: 14px;
}

.re-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--re-border);
    border-top-color: var(--re-accent);
    border-radius: 50%;
    animation: re-spin 0.7s linear infinite;
    flex-shrink: 0;
}

@keyframes re-spin {
    to { transform: rotate(360deg); }
}

/* ── PAGINATION ──────────────────────────────────────────────────────────────── */

.re-pagination {
    margin-top: 28px;
    display: flex;
    justify-content: center;
}

.re-pages {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.re-page-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--re-border);
    border-radius: var(--re-radius-sm);
    background: #fff;
    color: var(--re-ink-mid);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--re-transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.re-page-btn:hover:not(:disabled):not(.re-page-active) {
    border-color: var(--re-accent);
    color: var(--re-accent);
    background: #fffbf4;
}

.re-page-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.re-page-active {
    background: var(--re-accent);
    border-color: var(--re-accent);
    color: #fff;
    font-weight: 600;
    cursor: default;
}

.re-page-ellipsis {
    padding: 0 6px;
    color: var(--re-ink-light);
    font-size: 14px;
    user-select: none;
}

/* ── RESPONSIVE ──────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {

    .re-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .re-select {
        min-width: 100%;
        width: 100%;
    }

    .re-price-range {
        width: 100%;
    }

    .re-price-input {
        width: calc(50% - 18px);
        flex: 1;
    }

    .re-toolbar-bottom {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .re-select-sort {
        min-width: 100%;
        width: 100%;
    }

    .re-reset-btn {
        width: 100%;
    }

    .re-grid {
        grid-template-columns: 1fr;
    }

    .re-card-media {
        height: 180px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .re-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}