/* ============================================================
   ANNONCES-INDEX.CSS — Version corrigée
   Styles des cartes + scroll infini
   ============================================================ */

/* ---------- Wrapper carte (neutre) ---------- */
.annonce-card-wrapper {
    display: flex;
    flex-direction: column;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
    height: 100%;
    gap: 0.5rem;
}

/* ---------- Bandeau vendeur (hors du <a>) ---------- */
.annonce-card-wrapper .vendeur-info-compact {
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    border: none;
    padding: 0.25rem 0.25rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.annonce-card-wrapper .vendeur-pseudo-text {
    max-width: 90px;
    line-height: 1.3;
}

.annonce-card-wrapper .pro-badge-compact {
    line-height: 1;
    font-size: 9px;
    padding: 1px 3px;
    background: linear-gradient(135deg, #ea580c 0%, #FF8C00 100%);
}

.annonce-card-wrapper .verified-badge-mini {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: white;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.8);
}

/* ---------- Le <a> : seul élément avec radius + shadow ---------- */
.annonce-card-wrapper .annonce-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 1rem;
    box-shadow: 0 4px 12px rgb(0 0 0 / 15%);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
    padding:0px !important;
}

.annonce-card-wrapper .annonce-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgb(0 0 0 / 20%);
}

/* ---------- Bouton Commander ---------- */
.annonce-card-wrapper .btn-commander-boutique {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px 14px;
    border: 0;
    border-radius: 0.55rem;
    box-shadow: 0 4px 12px rgb(0 0 0 / 15%);
    background: #16a34a;
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.2s ease;
    margin-top: 8px;
}

.annonce-card-wrapper .btn-commander-boutique:hover {
    background: #15803d;
    box-shadow: 0 6px 16px rgb(0 0 0 / 20%);
    transform: translateY(-1px);
}

.annonce-card-wrapper .btn-commander-boutique:active {
    transform: scale(0.98);
}

.annonce-card-wrapper .btn-commander-boutique:disabled,
.annonce-card-wrapper .btn-commander-boutique.btn-commander-disabled {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
    opacity: 0.85;
    box-shadow: 0 4px 12px rgb(0 0 0 / 8%);
    transform: none;
}

/* ---------- Image ---------- */
.annonce-card-wrapper .annonce-image-container {
    height: 12rem;
    width: 100%;
    position: relative;
    background: #e5e7eb;
    overflow: hidden;
    flex-shrink: 0;
}

.annonce-card-wrapper .annonce-image-container img,
.annonce-card-wrapper .annonce-image-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ---------- Contenu ---------- */
.annonce-card-wrapper .annonce-content {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.annonce-card-wrapper .titre-annonce {
    font-weight: 400 !important;
    font-size: 0.9rem;
    line-height: 1.3rem;
    height: 2.6rem;
    overflow: hidden;
    color: #1f2937;
    margin: 0 0 0.25rem 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.annonce-card-wrapper .price {
    color: #FF6B00;
    font-weight: bold;
    font-size: 1.05rem;
    margin: 0;
    margin-left:0.5rem;
}

.annonce-card-wrapper .annonce-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

.annonce-card-wrapper .annonce-geosecure {
    margin-top: 0.25rem;
    font-size: 0.75rem;
}

/* ---------- Bouton Découvrir ---------- */
.annonce-card-wrapper .btn-decouvrir {
    display: block;
    text-align: center;
    background: #f3f4f6;
    color: #1f2937;
    transition: background-color 0.2s, color 0.2s;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    margin-top: 0.5rem;
    font-weight: 500;
    cursor: pointer;
}

.annonce-card-wrapper .btn-decouvrir:hover {
    background: #ffedd5;
    color: #ea580c;
}

.annonce-card-wrapper .btn-decouvrir-externe {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
    white-space: nowrap;
    overflow: hidden;
    max-width: 100%;
    box-sizing: border-box;
    width: 100%;
}

.annonce-card-wrapper .btn-decouvrir-externe span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.annonce-card-wrapper .btn-decouvrir-externe i {
    flex-shrink: 0;
    font-size: 0.8rem;
}

.annonce-card-wrapper .btn-decouvrir-externe:hover {
    background: #dbeafe;
    color: #1e3a8a;
}

/* ---------- Bouton favori ---------- */
.annonce-card-wrapper .favorite-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    z-index: 25;
}

.annonce-card-wrapper .favorite-btn i {
    color: #9ca3af;
    font-size: 0.85rem;
}

.annonce-card-wrapper .favorite-btn.active i {
    color: #dc2626;
}

.annonce-card-wrapper .favorite-btn.active {
    background: rgba(239, 68, 68, 0.15);
}

/* ============================================================
   GRILLE DES ANNONCES — corrigée
   ============================================================ */
.annonces-grid {
    display: grid;
    /* Cartes de 240 à 280px, jamais plus */
    grid-template-columns: repeat(auto-fill, minmax(220px, 240px));
    gap: 7px;
    row-gap: 2.5rem;
    justify-content: start;
}

/* Force les cartes à ne pas dépasser 280px */
.annonce-card-wrapper {
    max-width: 280px;
    width: 100%;
}

/* ---------- Sections catégorie ---------- */
.category-section {
    /*margin-bottom: 2.5rem;*/
}

.category-title-container {
    padding: 0.5rem 0;
    margin-bottom: 1rem;
    border-bottom: 2px solid #ea580c;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 0px;
}

.category-title-container h2 {
    font-size: 1.15rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.annonces-count {
    font-size: 0.8rem;
}

/* ---------- Cartes sponsorisées ---------- */
.annonce-card .sponsor-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 5;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.1rem 0.6rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.annonce-card .sponsor-badge[data-type="urgent"] {
    background: #dc2626;
}

.annonce-card .sponsor-badge[data-type="mise_en_avant"] {
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    color: #7a2c0c;
}

/* ---------- Loader scroll infini ---------- */
#scroll-loader {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem 1rem;
    min-height: 60px;
}

#scroll-loader .spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #f3f4f6;
    border-top-color: #ea580c;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

#scroll-loader.no-more {
    color: #9ca3af;
    font-size: 0.85rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
    .annonces-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.6rem;
    }

    .annonce-card-wrapper {
        max-width: 100%;
    }

    .annonce-card-wrapper .annonce-image-container {
        height: 9rem;
    }

    .annonce-card-wrapper .titre-annonce {
        font-size: 0.8rem;
        line-height: 1.15rem;
        height: 2.3rem;
    }

    .annonce-card-wrapper .price {
        font-size: 0.9rem;
    }

    .annonce-card-wrapper .btn-commander-boutique {
        padding: 7px 8px;
        font-size: 0.75rem;
        border-radius: 0.5rem;
    }

    .annonce-card-wrapper .btn-decouvrir {
        padding: 0.35rem 0.5rem;
        font-size: 0.75rem;
    }

    .annonce-card-wrapper .annonce-content {
        padding: 0rem;
        padding-top: 0.5rem;
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    .annonces-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 260px));
    }
}

/* Cartes au-delà de 2 lignes */
.annonces-grid > .annonce-card-wrapper.is-row-hidden {
    display: none !important;
}

.category-see-all {
    font-size: 0.85rem;
    font-weight: 500;
    color: #ea580c;
    text-decoration: none;
    white-space: nowrap;
}
.category-see-all:hover { text-decoration: underline; }

/* ---------- Bouton Commander : espacement sous Découvrir ---------- */
.annonce-card-wrapper .btn-decouvrir {
    display: block;
    text-align: center;
    background: #f3f4f6;
    color: #1f2937;
    transition: background-color 0.2s, color 0.2s;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    margin-top: 0.5rem;
    font-weight: 500;
    cursor: pointer;
}

@media (max-width: 640px) {
    .annonce-card-wrapper .btn-decouvrir{
        display: none !important;
    }
    .annonce-card-wrapper .btn-commander-boutique {
    border-radius: 0rem;
    }
}

.annonce-card-wrapper .btn-commander-boutique {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px 14px;
    border: 0;
    box-shadow: 0 4px 12px rgb(0 0 0 / 15%);
    background: #16a34a;
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.2s ease;
    margin-top: 8px;   /* ← espace sous Découvrir */
}