/* Styles pour la page annonce.php */
body {
    font-family: Arial, sans-serif;
}

.container {
    max-width: 1200px;
}

/* Badge type styling (réutilisé de annonces2.css) */
.badge-type {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
}

.badge-type[data-type="offre"] {
    background: #28A745; /* Vert pour les offres */
}

.badge-type[data-type="demande"] {
    background: #DC3545; /* Rouge pour les demandes */
}

/* Style pour le conteneur de titre */
.category-title-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Style pour l'image */
img {
    max-width: 100%;
    height: auto;
}

/* Style pour les étoiles de notation */
.rating i {
    cursor: pointer;
    transition: color 0.2s ease;
}

/* Style pour les boutons d'action */
.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Style pour le lien de retour */
a.text-orange-500 {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

a.text-orange-500:hover {
    text-decoration: underline;
}

/*********************************************************/

    /* Styles supplémentaires pour l'optimisation des images */
    .image-container {
        position: relative;
        width: 100%;
        height: 100%;
    }
    
    .image-fallback {
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 4px;
    }
    
    .thumbnail-container {
        position: relative;
        width: 80px;
        height: 60px;
    }
    
    /* Animation de chargement */
    @keyframes pulse {
        0% { opacity: 1; }
        50% { opacity: 0.5; }
        100% { opacity: 1; }
    }
    
    .image-loading {
        animation: pulse 1.5s ease-in-out infinite;
    }

.image-container{
    min-height: 384px;
}

@media (max-width: 640px) {
    .image-container{
        min-height: 320px;
    }
}

.detail-icon {
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 10px;
            background-color: #f3f4f6;
            color: #3b82f6;
            flex-shrink: 0;
        }
        .detail-icon i {
            font-size: 18px;
        }
        
.bg-teal-600 {
  background-color: #0d9488;
}
.bg-orange-600 {
  background-color: #0f8f3e;
}
.bg-amber-500 {
    background-color: #f59e0b;
}

.max-w-6xl.mx-auto.px-4 {
    background: #fff;
    margin-top: 0px;
    padding-top: 1.5rem;
}

.input-field {
    padding: 10px 40px !important;
}

/* ============================================
   AFFICHAGE HORIZONTAL DES ANNONCES SIMILAIRES ET RÉCEMMENT CONSULTÉES
   ============================================ */

/* Conteneur principal amélioré */
.max-w-6xl.mx-auto.px-4.md\:px-8.mt-12 {
    margin-top: 2.5rem;
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Titres des sections */
.max-w-6xl.mx-auto.px-4.md\:px-8.mt-12 h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #f3f4f6;
    position: relative;
}

.max-w-6xl.mx-auto.px-4.md\:px-8.mt-12 h2::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, #0f8f3e, #fb923c);
}

/* Conteneur horizontal pour le défilement */
.annonces-horizontal-container {
    position: relative;
    margin: 0 -1rem;
    padding: 0 1rem;
}

@media (min-width: 768px) {
    .annonces-horizontal-container {
        margin: 0;
        padding: 0;
    }
}

/* Grille horizontale améliorée */
.annonces-horizontal-grid {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 1rem;
    padding: 0.5rem 0 1.5rem 0;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
}

/* Masquer la scrollbar pour Webkit */
.annonces-horizontal-grid::-webkit-scrollbar {
    display: none;
}

/* Boutons de navigation pour le défilement horizontal */
.horizontal-scroll-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: white;
    border: 2px solid #f3f4f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transition: all 0.3s ease;
}

.annonces-horizontal-container:hover .horizontal-scroll-btn {
    opacity: 1;
}

.horizontal-scroll-btn:hover {
    background: #0f8f3e;
    border-color: #0f8f3e;
    color: white;
    transform: translateY(-50%) scale(1.1);
}

.horizontal-scroll-btn.prev {
    left: 0.5rem;
}

.horizontal-scroll-btn.next {
    right: 0.5rem;
}

/* Désactiver les boutons de navigation sur mobile */
@media (max-width: 767px) {
    .horizontal-scroll-btn {
        display: none;
    }
}

/* Carte d'annonce en affichage horizontal */
.annonce-horizontal-card {
    flex: 0 0 auto;
    width: 280px;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    /*border: 1px solid #fed7aa;*/
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    position: relative;
}

.annonce-horizontal-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -10px rgba(249, 115, 22, 0.2);
    border-color: #0f8f3e;
}

/* Image dans la carte horizontale */
.annonce-horizontal-card .h-48 {
    height: 180px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
}

.annonce-horizontal-card .w-full.h-full.object-cover {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.5s ease;
}

.annonce-horizontal-card:hover .w-full.h-full.object-cover {
    transform: scale(1.05);
}

/* Overlay pour l'image au hover */
.annonce-horizontal-card .h-48::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.annonce-horizontal-card:hover .h-48::after {
    opacity: 1;
}

/* Contenu de la carte horizontale */
.annonce-horizontal-card .p-4 {
    padding: 1.25rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* Titre de l'annonce */
.annonce-horizontal-card .font-bold.text-lg.text-gray-800.mb-1 {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 0.5rem;
    color: #1f2937;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.8rem;
}

/* Prix */
.annonce-horizontal-card .text-orange-500.font-medium.mb-2 {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.75rem;
    margin-top: auto;
}

/* Localisation */
.annonce-horizontal-card .flex.items-center.gap-2.text-sm.text-gray-600 {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.5rem;
}

.annonce-horizontal-card .flex.items-center.gap-2.text-sm.text-gray-600 i {
    color: #6b7280;
    font-size: 0.875rem;
}

/* Badge "Nouveau" optionnel */
.annonce-badge {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    background: linear-gradient(135deg, #0f8f3e, #fb923c);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Indicateur de défilement (dots) */
.scroll-indicator {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-bottom: 1rem;
}

.scroll-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d1d5db;
    transition: all 0.3s ease;
    cursor: pointer;
}

.scroll-dot.active {
    background: #0f8f3e;
    width: 24px;
    border-radius: 4px;
}

/* ============================================
   RESPONSIVE POUR L'AFFICHAGE HORIZONTAL
   ============================================ */

/* Mobile */
@media (max-width: 639px) {
    .max-w-6xl.mx-auto.px-4.md\:px-8.mt-12 {
        margin-top: 2rem;
    }
    
    .max-w-6xl.mx-auto.px-4.md\:px-8.mt-12 h2 {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }
    
    .annonces-horizontal-container {
        margin: 0 -1rem;
        padding: 0 1rem;
    }
    
    .annonce-horizontal-card {
        width: 48%;
    }
    
    .annonce-horizontal-card .h-48 {
        height: 160px;
    }
    
    .annonce-horizontal-card .font-bold.text-lg.text-gray-800.mb-1 {
        font-size: 0.95rem;
        min-height: 2.6rem;
        line-height: 1.3;
    }
    
    .annonce-horizontal-card .text-orange-500.font-medium.mb-2 {
        font-size: 1rem;
    }
    
    /* Snap scrolling sur mobile */
    .annonces-horizontal-grid {
        scroll-snap-type: x mandatory;
    }
    
    .annonce-horizontal-card {
        scroll-snap-align: start;
    }
}

/* Tablette */
@media (min-width: 640px) and (max-width: 1023px) {
    .annonce-horizontal-card {
        width: 300px;
    }
    
    .annonce-horizontal-card .h-48 {
        height: 170px;
    }
    
    .annonces-horizontal-grid {
        gap: 1.25rem;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .annonces-horizontal-grid {
        display: flex;
        grid-auto-flow: column;
        grid-auto-columns: minmax(280px, 1fr);
        gap: 7px;
        overflow-x: auto;
        padding-bottom: 1rem;
    }
    
    .annonce-horizontal-card {
        /*max-width: 230px;*/
    }
    
    .annonce-horizontal-card .h-48 {
        height: 180px;
    }
    
    /* Masquer la scrollbar sur desktop mais garder la fonctionnalité */
    .annonces-horizontal-grid {
        scrollbar-width: thin;
        scrollbar-color: #0f8f3e #f3f4f6;
    }
    
    .annonces-horizontal-grid::-webkit-scrollbar {
        height: 6px;
    }
    
    .annonces-horizontal-grid::-webkit-scrollbar-track {
        background: #f3f4f6;
        border-radius: 3px;
    }
    
    .annonces-horizontal-grid::-webkit-scrollbar-thumb {
        background: #0f8f3e;
        border-radius: 3px;
    }
    
    .annonces-horizontal-grid::-webkit-scrollbar-thumb:hover {
        background: #0f8f3e;
    }
}

/* Grands écrans */
@media (min-width: 1536px) {
    .max-w-6xl {
        max-width: 80rem;
    }
    
    .annonces-horizontal-grid {
        /*gap: 2rem;*/
    }
    
    .annonce-horizontal-card {
       /* min-width: 300px;*/
    }
    
    .annonce-horizontal-card .h-48 {
        height: 200px;
    }
    
    .annonce-horizontal-card .font-bold.text-lg.text-gray-800.mb-1 {
        font-size: 1.1rem;
        min-height: 3rem;
    }
}

/* ============================================
   STYLES POUR LES AUTRES ANNONCES DU VENDEUR (HORIZONTAL)
   ============================================ */

/* Adaptation pour la section "Autres annonces du vendeur" */
.grid.grid-cols-1.sm\:grid-cols-2.gap-4 {
    /*display: flex;*/
    overflow-x: auto;
    gap: 1rem;
    padding: 0.5rem 0 1.5rem 0;
    margin: 0 -1rem;
    padding: 0 1rem;
}

@media (min-width: 768px) {
    .grid.grid-cols-1.sm\:grid-cols-2.gap-4 {
        margin: 0;
        padding: 0;
    }
}

/* Carte pour autres annonces du vendeur en horizontal */
.bg-gray-50.rounded-lg.p-3.hover\:shadow-md.transition-shadow.block {
    flex: 0 0 auto;
    width: 100%px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    transition: all 0.2s ease;
}

.bg-gray-50.rounded-lg.p-3.hover\:shadow-md.transition-shadow.block:hover {
    border-color: #0f8f3e;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* ============================================
   JAVASCRIPT HELPER CLASSES
   ============================================ */

/* État de chargement */
.annonce-loading {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* État vide (pas d'annonces) */
.empty-annonces {
    text-align: center;
    padding: 3rem 1rem;
    color: #6b7280;
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    margin-top: 1rem;
}

.empty-annonces i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #9ca3af;
}

/* ============================================
   ACCESSIBILITÉ
   ============================================ */

.annonce-horizontal-card:focus-within {
    outline: 2px solid #0f8f3e;
    outline-offset: 2px;
}

/* Masquer visuellement mais accessible aux lecteurs d'écran */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.main-categories-row{
    transition: transform 0.3s ease, top 0.3s ease, opacity 0.3s ease;
    box-shadow: 0 10px 5px -5px rgba(0, 0, 0, 0.3);
 }