/* ===== CSS Personnalisé pour taghtil ===== */

:root {
    --primary-color: #0066cc;
    --secondary-color: #28a745;
    --accent-color: #ffc107;
    --dark-color: #343a40;
    --light-color: #f8f9fa;
    --text-muted: #6c757d;
    --border-color: #dee2e6;
    --shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
}

/* Classe de conteneur avec bordure standard */
.container-bordered {
    background-color: #fff;
    border: 1px solid #d4d4d4;
    border-radius: 10px 10px 10px 10px;
    padding: 20px 9px 10px 10px;
}

/* ===== Styles généraux ===== */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    padding-top: 76px; /* Compenser la navbar fixe */
    overflow-x: hidden; /* Éviter le scroll horizontal */
}

html {
    scroll-behavior: smooth;
    height: 100%;
}

body {
    height: 100%;
    min-height: 100vh;
}

.text-light-50 {
    color: rgba(255, 255, 255, 0.5) !important;
}

.text-light-75 {
    color: rgba(255, 255, 255, 0.75) !important;
    text-decoration: none;
    transition: color 0.3s ease;
}

.text-light-75:hover {
    color: rgba(255, 255, 255, 1) !important;
}

/* ===== Navigation ===== */
.navbar {
    background: linear-gradient(135deg, var(--primary-color), #004a94) !important;
    box-shadow: var(--shadow);
    padding: 1rem 0;
}

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

.navbar-nav .nav-link {
    font-weight: 500;
    margin: 0 0.5rem;
    transition: all 0.3s ease;
}

.navbar-nav .nav-link:hover {
    transform: translateY(-1px);
}

.dropdown-menu {
    border: none;
    box-shadow: var(--shadow);
    border-radius: 0.5rem;
    overflow: hidden;
}

.dropdown-item {
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}

.dropdown-item:hover {
    background-color: var(--light-color);
    color: var(--primary-color);
}

/* ===== Section Hero ===== */
.hero-section-wrapper {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 3rem 0;
}

.hero-overlay {
    position: relative;
    background: linear-gradient(
        rgba(0, 0, 0, 0.4), 
        rgba(0, 0, 0, 0.5)
    ), url('https://images.unsplash.com/photo-1545324418-cc1a3fa10c00?w=1920&q=80') center/cover;
    background-size: cover;
    background-position: center;
    padding: 3rem 2.5rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.hero-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg, 
        rgba(102, 126, 234, 0.75) 0%, 
        rgba(118, 75, 162, 0.75) 100%
    );
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
}

.search-box {
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(15px);
    border-radius: 1.5rem !important;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2) !important;
    transition: all 0.3s ease;
}

.search-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25) !important;
}

/* Hero Text Styling */
.hero-overlay h1 {
    text-shadow: 2px 4px 8px rgba(0, 0, 0, 0.3);
    font-weight: 800;
    letter-spacing: -0.5px;
}

.hero-overlay .lead {
    text-shadow: 1px 2px 4px rgba(0, 0, 0, 0.2);
    font-size: 1.25rem;
    font-weight: 400;
}

.form-label {
    color: var(--dark-color);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.form-select, .form-control {
    border-radius: 0.5rem;
    border: 2px solid var(--border-color);
    padding: 0.75rem;
    transition: all 0.3s ease;
}

.form-select:focus, .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 102, 204, 0.25);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #004a94);
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    padding: 0.75rem 2rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

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

/* ===== Section Types de propriétés ===== */
.property-type-card {
    transition: transform 0.3s ease;
}

.property-type-card:hover {
    transform: translateY(-5px);
}

.property-type-img {
    position: relative;
    overflow: hidden;
    height: 200px;
}

.property-type-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.property-type-card:hover .property-type-img img {
    transform: scale(1.1);
}

.property-type-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(0, 102, 204, 0.8), rgba(0, 74, 148, 0.8));
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.property-type-card:hover .property-type-overlay {
    opacity: 1;
}

.card {
    border-radius: 1rem;
    overflow: hidden;
    transition: all 0.3s ease;
    border: none !important;
    box-shadow: var(--shadow-sm);
}

.card:hover {
    box-shadow: var(--shadow);
}

.btn-outline-primary {
    border-color: var(--primary-color);
    color: var(--primary-color);
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

/* ===== Section Propriétés à proximité ===== */
.property-card {
    background: white;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    border: none;
}

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

.property-image {
    height: 250px;
    position: relative;
    overflow: hidden;
}

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

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

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

.property-price {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 700;
}

.property-info {
    padding: 1.5rem;
}

.property-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

.property-location {
    color: var(--text-muted);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}

.property-features {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.feature {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.property-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-sm {
    padding: 0.375rem 1rem;
    font-size: 0.875rem;
    border-radius: 0.375rem;
}

/* ===== Footer ===== */
.footer-link {
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-link:hover {
    color: white;
}

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

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

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .hero-section-wrapper {
        min-height: 60vh;
        padding: 2rem 0;
    }
    
    .hero-overlay {
        padding: 2.5rem 1.5rem;
        border-radius: 1.5rem !important;
    }
    
    .display-4 {
        font-size: 2rem;
    }
    
    .search-box {
        padding: 1.5rem !important;
    }
    
    .property-features {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .property-actions {
        flex-direction: column;
    }
}

@media (max-width: 576px) {
    .hero-section-wrapper {
        min-height: 50vh;
    }
    
    .hero-overlay {
        padding: 2rem 1rem;
        border-radius: 1rem !important;
    }
    
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .search-box .row {
        margin: 0;
    }
    
    .search-box .col-md-3,
    .search-box .col-md-6 {
        padding: 0.25rem;
    }
}

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

.animate-on-scroll {
    animation: fadeInUp 0.8s ease-out;
}

/* ===== Utilitaires ===== */
.bg-gradient-primary {
    background: linear-gradient(135deg, var(--primary-color), #004a94) !important;
}

.shadow-custom {
    box-shadow: var(--shadow);
}

.shadow-custom-lg {
    box-shadow: var(--shadow-lg);
}

.rounded-custom {
    border-radius: 1rem !important;
}

.text-primary-custom {
    color: var(--primary-color) !important;
}

/* ===== Amélioration de l'accessibilité ===== */
.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.skip-to-content {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-color);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 0 0 4px 4px;
    z-index: 1000;
}

.skip-to-content:focus {
    top: 0;
}

/* ===== Chargement ===== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== Testimonials ===== */
.testimonial-card {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    height: 100%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.testimonial-card:hover {
    transform: translateY(-5px);
}

.testimonial-content {
    margin-bottom: 1.5rem;
}

.testimonial-author {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.author-avatar {
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

/* ===== Property Cards ===== */
.property-card {
    background: white;
    border-radius: 15px;
    overflow: hidden !important; /* Force l'overflow hidden */
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border: none;
    position: relative;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.property-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}

.property-image {
    position: relative;
    height: 200px;
    overflow: hidden !important;
    width: 100% !important;
    max-width: 100% !important;
}

.property-image img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

/* .property-badge est maintenant défini dans search-results.css pour une meilleure organisation */
/* Ancien style: position: absolute; top: 15px; right: 15px; z-index: 2; */

.property-content {
    padding: 1.5rem;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    position: relative;
    overflow: hidden !important;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.property-content h5 {
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--dark-color);
    word-wrap: break-word;
    overflow: hidden !important;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.property-location {
    color: #6c757d;
    margin-bottom: auto; /* Pousse les caractéristiques vers le bas */
    font-size: 0.9rem;
    word-wrap: break-word;
    overflow: hidden !important;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.property-features {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: #6c757d;
    flex-wrap: wrap;
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    margin-top: auto;
}

.property-features span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* ===== Suggestions Section ===== */
.suggestions-section {
    background-color: #f8f9fa;
}

/* ===== Corrections spécifiques pour les colonnes de propriétés ===== */
.suggestions-section .col-lg-4,
.suggestions-section .col-md-6 {
    display: flex;
    align-items: stretch;
    padding-left: 15px;
    padding-right: 15px;
    box-sizing: border-box;
    overflow: hidden; /* Empêcher tout débordement */
}

.suggestions-section .property-card {
    width: 100%;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Forcer le contenu à rester dans la carte */
    max-width: 100%;
    box-sizing: border-box;
}

.suggestions-section .property-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden; /* Empêcher le débordement du contenu */
    max-width: 100%;
    box-sizing: border-box;
}

/* Assurer que le contenu ne déborde pas */
.row > [class*="col-"] {
    padding-left: 15px;
    padding-right: 15px;
    box-sizing: border-box;
    overflow: hidden; /* Solution radicale */
}

/* Correction spécifique pour les prix */
.suggestions-section .property-price {
    max-width: calc(100% - 3rem); /* Tenir compte du padding */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    box-sizing: border-box;
    display: block;
    position: relative;
}

/* Correction pour tous les éléments de contenu */
.suggestions-section .property-content * {
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

/* ===== DEBUG - Solution d'urgence pour le débordement ===== */
.suggestions-section .row {
    overflow: hidden !important;
}

.suggestions-section [class*="col-"] {
    overflow: hidden !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.suggestions-section .property-card {
    contain: layout !important;
    isolation: isolate !important;
}

/* Forcer toutes les largeurs à rester dans les limites */
.suggestions-section * {
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* ===== Structure améliorée pour les cartes de propriétés ===== */
.property-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.property-bottom {
    margin-top: auto;
    display: flex;
    flex-direction: column;
}

.property-bottom .property-features {
    order: 1;
}

/* ===== Corrections de défilement ===== */
.main-content {
    min-height: calc(100vh - 76px); /* Hauteur totale moins la navbar */
    padding-bottom: 2rem;
    width: 100%;
    overflow-x: hidden;
}

/* Assurer que les sections ont une hauteur appropriée */
section {
    position: relative;
    width: 100%;
    clear: both;
}

/* Corrections pour les containers */
.container {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding-left: 15px;
    padding-right: 15px;
}