/* ===== STYLES PRINCIPAUX AfriMalle ===== */

:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --light-color: #f8fafc;
    --dark-color: #1e293b;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* ===== RESET ET BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: #ffffff;
}

/* ===== GESTION DES IMAGES ===== */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Éviter les icônes cassées */
img[src*="no-image.svg"] {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 20px;
    text-align: center;
    color: #6c757d;
    font-size: 14px;
}

img[src*="no-image.svg"]::before {
    content: "ðÂÂ¼ï¸Â";
    display: block;
    font-size: 2rem;
    margin-bottom: 10px;
}

/* Animation de chargement pour les images */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s ease;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* Fallback pour les images cassées */
img:not([src]), img[src=""], img[src*="undefined"] {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 14px;
}

img:not([src])::before, img[src=""]::before, img[src*="undefined"]::before {
    content: "Image non disponible";
    display: block;
}

/* ===== NAVIGATION ===== */
.navbar {
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
}

.navbar-nav .nav-link {
    font-weight: 500;
    transition: color 0.3s ease;
}

.navbar-nav .nav-link:hover {
    color: var(--primary-color) !important;
    background-color: white;
    border-radius: 2px;
}

/* ===== HERO SECTION ===== */
.hero-section {
    /* Image de fond responsive */
    background-color: var(--primary-dark); /* Fallback si l'image ne charge pas */
    background-image: url('../images/hero-bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    color: white;
    position: relative;
    overflow: hidden;
    padding: 4rem 0;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* Overlay pour améliorer la lisibilité du texte */
    background: rgba(0, 0, 0, 0.45);
    z-index: 0;
}

/* S'assurer que le contenu passe au-dessus de l'overlay */
.hero-section .container {
    position: relative;
    z-index: 1;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    opacity: 0.9;
}

.hero-description {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    opacity: 0.8;
}

.hero-buttons .btn {
    padding: 0.75rem 2rem;
    font-weight: 600;
    border-radius: 50px;
    transition: all 0.3s ease;
}

.hero-buttons .btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.hero-image {
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

/* ===== STATISTIQUES ===== */
.stats-section {
    padding: 4rem 0;
}

.stat-card {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.stat-icon i {
    font-size: 4rem !important;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 1rem;
    color: var(--secondary-color);
    font-weight: 500;
}

.country-stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.country-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.country-flag {
    flex-shrink: 0;
}

.flag-img {
    font-size: 2.5em;
    border-radius: 5px;
}

.country-info {
    flex: 1;
}

.country-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.country-count {
    color: var(--secondary-color);
    font-size: 0.9rem;
}

/* ===== CARTES CLIQUABLES ===== */
.clickable-card {
    cursor: pointer;
    transition: all 0.3s ease;
}

.clickable-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.clickable-card:hover .stat-icon,
.clickable-card:hover .country-name {
    color: var(--primary-color);
}

.clickable-card:hover .stat-number {
    color: var(--primary-dark);
}

/* ===== CARTES D'ANNONCES ===== */
.ad-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    height: 100%;
}

.ad-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.ad-image {
    position: relative;
    height: 200px;
    overflow: hidden;
    background-color: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    display: block;
}

/* Amélioration pour les images principales */
.ad-image img[src*="uploads/"] {
    object-fit: cover;
    background-color: transparent;
}

.ad-image img[src*="no-image.svg"] {
    object-fit: contain;
    padding: 20px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
}

.ad-card:hover .ad-image img {
    transform: scale(1.05);
}

.ad-category {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.ad-content {
    padding: 1.5rem;
}

.ad-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dark-color);
    line-height: 1.4;
}

.ad-description {
    font-size: 0.9rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.ad-meta {
    margin-bottom: 1rem;
}

.ad-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--success-color);
}

.ad-location {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--secondary-color);
}

.flag-small {
    font-size: 1.2em;
    border-radius: 2px;
}

.ad-date {
    font-size: 0.8rem;
    color: var(--secondary-color);
}

/* ===== DÉTAIL ANNONCE ===== */
.annonce-detail {
    background: var(--light-color);
}

.image-gallery {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: var(--shadow);
}

.main-image img {
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.main-image img:hover {
    transform: scale(1.02);
}

.thumbnail-images img {
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.thumbnail-images img:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow);
}

.annonce-info {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 100px;
}

.annonce-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--dark-color);
}

.price-display {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--success-color);
    margin-bottom: 1rem;
}

.contact-buttons .btn {
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.contact-buttons .btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.share-buttons .btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.share-buttons .btn:hover {
    transform: scale(1.1);
}

/* ===== FILTRES ===== */
.filters-section {
    background: var(--light-color);
}

.filters-form {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: var(--shadow);
}

/* ===== PAGINATION ===== */
.pagination .page-link {
    border: none;
    color: var(--primary-color);
    padding: 0.75rem 1rem;
    margin: 0 0.25rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.pagination .page-link:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.pagination .page-item.active .page-link {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* ===== CONTACT ===== */
.contact-section {
    background: var(--light-color);
}

.contact-info {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: var(--shadow);
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.contact-icon {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    background: var(--light-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.contact-details h5 {
    font-weight: 600;
    margin-bottom: 0.25rem; /* Titre proche de l'icône */
}
.contact-details p,
.contact-details small { margin: 0; }

.contact-form {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: var(--shadow);
}

/* ===== FOOTER ===== */
footer {
    background: var(--dark-color);
    color: white;
}

.footer-contact-info { display: block; }

.social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.social-links a:hover {
    background: var(--primary-color);
    transform: translateY(-2px);
}

/* ===== UTILITAIRES ===== */
.border-left-primary {
    border-left: 4px solid var(--primary-color) !important;
}

.border-left-success {
    border-left: 4px solid var(--success-color) !important;
}

.border-left-info {
    border-left: 4px solid var(--secondary-color) !important;
}

.border-left-warning {
    border-left: 4px solid var(--warning-color) !important;
}

.text-gray-300 {
    color: #d1d5db !important;
}

.text-gray-800 {
    color: var(--dark-color) !important;
}

@media (max-width: 991.98px) {
	.hero-section { 
    background-image: none;
    background-color: var(--primary-dark); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .hero-section {
        padding: 3rem 0;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.2rem;
    }
        
    .stat-card {
        padding: 1.5rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .annonce-title {
        font-size: 1.5rem;
    }
    
    .price-display {
        font-size: 2rem;
    }
    
    .contact-item {
        flex-direction: row; /* Icône à gauche, titre à droite sur tablette */
        align-items: center;
        text-align: left;
    }
    .contact-details { width: 100%; }
    .contact-details h5 { margin-bottom: 0.25rem; }
    
    .country-stat-card {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 576px) {
    /* Conserver l'agencement horizontal comme tablette */
    .contact-item { flex-direction: row; align-items: center; text-align: left; }
    .contact-details { width: 100%; }
    .contact-details h5 { margin-bottom: 0.25rem; }
    .hero-section {
        padding: 2rem 0;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-buttons .btn {
        width: 100%;
        margin-bottom: 1rem;
    }
    
    .hero-buttons .btn:last-child {
        margin-bottom: 0;
    }
    
    .ad-card {
        margin-bottom: 1.5rem;
    }
    
    .filters-form {
        padding: 1rem;
    }
}

@media (max-width: 359.98px) {
    .row > [class*="col-"] {
      flex: 0 0 100%;
      max-width: 100%;
    }
    .clickable-card {
      padding: 0.5rem;
    }
    .stat-label {
      font-size: 0.75rem;
    }
    .stat-number {
      font-size: 1rem;
    }
    .stat-icon i {
      font-size: 1.2rem;
    }
  }
  

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

/* ===== LOADING ===== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== ACCESSIBILITÉ ===== */
.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;
}

/* ===== FOCUS VISIBLE ===== */
.btn:focus,
.form-control:focus,
.form-select:focus {
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.25);
    border-color: var(--primary-color);
}

/* ===== PRINT STYLES ===== */
@media print {
    .navbar,
    .footer,
    .btn,
    .share-buttons {
        display: none !important;
    }
    
    .ad-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}
