﻿/* Reset et Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4a5568;
    --secondary-color: #1EC6B6;
    --accent-color: #FF4A52;
    --text-dark: #2d3748;
    --text-gray: #718096;
    --bg-light: #f8fafc;
    --border-color: #e2e8f0;
    --shadow-sm: 0 5px 20px rgba(0,0,0,0.1);
    --shadow-md: 0 10px 20px rgba(0,0,0,0.05);
    --transition: all 0.3s ease;
}

body {
    font-family: "Rubik", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-gray);
    background: var(--bg-light);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Accessibilité */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

*:focus-visible {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}

/* Container responsive */
.container {
    width: 100%;
    margin: 0 auto;
    padding: 0 15px;
}

/* 280px - 320px : Très petits smartphones */
@media (min-width: 280px) {
    .container {
        max-width: 100%;
        padding: 0 10px;
    }
}

/* 321px - 374px : Petits smartphones */
@media (min-width: 321px) {
    .container {
        max-width: 100%;
        padding: 0 12px;
    }
}

/* 375px - 413px : Smartphones standards */
@media (min-width: 375px) {
    .container {
        max-width: 100%;
        padding: 0 15px;
    }
}

/* 414px - 599px : Smartphones moyens/grands */
@media (min-width: 414px) {
    .container {
        max-width: 100%;
        padding: 0 20px;
    }
}

/* 600px - 767px : Petites tablettes */
@media (min-width: 600px) {
    .container {
        max-width: 540px;
    }
}

/* 768px - 1023px : Tablettes standard */
@media (min-width: 768px) {
    .container {
        max-width: 720px;
    }
}

/* 1024px - 1279px : Grandes tablettes/petits laptops */
@media (min-width: 1024px) {
    .container {
        max-width: 960px;
    }
}

/* 1280px+ : Desktop standard */
@media (min-width: 1280px) {
    .container {
        max-width: 1200px;
    }
}

/* 1440px+ : Full HD */
@media (min-width: 1440px) {
    .container {
        max-width: 1320px;
    }
}

/* 1920px+ : 2K/4K */
@media (min-width: 1920px) {
    .container {
        max-width: 1600px;
    }
}

/* Header */
.header {
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 10px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    backface-visibility: hidden;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.logo img {
    height: 35px;
    width: auto;
}

@media (min-width: 414px) {
    .logo img {
        height: 40px;
    }
}

@media (min-width: 768px) {
    .header {
        padding: 15px 0;
    }

    .logo img {
        height: 50px;
    }
}

/* Bouton retour */
.btn-back {
    background: var(--bg-light);
    color: var(--primary-color);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

    .btn-back:hover {
        background: #edf2f7;
        transform: translateX(-2px);
    }

@media (min-width: 414px) {
    .btn-back {
        padding: 10px 16px;
        font-size: 14px;
        gap: 8px;
    }
}

/* Section recherche */
.search-section {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-color) 100%);
    padding: 20px 0;
}

@media (min-width: 768px) {
    .search-section {
        padding: 40px 0;
    }
}

.search-title {
    color: white;
    font-size: 20px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 8px;
}

.search-subtitle {
    color: rgba(255,255,255,0.9);
    font-size: 14px;
    text-align: center;
    margin-bottom: 20px;
}

@media (min-width: 414px) {
    .search-title {
        font-size: 24px;
    }

    .search-subtitle {
        font-size: 15px;
    }
}

@media (min-width: 768px) {
    .search-title {
        font-size: 32px;
        margin-bottom: 12px;
    }

    .search-subtitle {
        font-size: 16px;
        margin-bottom: 30px;
    }
}

@media (min-width: 1280px) {
    .search-title {
        font-size: 40px;
    }

    .search-subtitle {
        font-size: 18px;
    }
}

/* Formulaire de recherche */
.search-form {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    padding: 15px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

@media (min-width: 414px) {
    .search-form {
        padding: 20px;
    }
}

@media (min-width: 768px) {
    .search-form {
        padding: 30px;
        border-radius: 15px;
    }
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

@media (min-width: 600px) {
    .form-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

@media (min-width: 1024px) {
    .form-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
}

@media (min-width: 1440px) {
    .form-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.form-group {
    display: flex;
    flex-direction: column;
}

    .form-group.full-width {
        grid-column: 1 / -1;
    }

@media (min-width: 1024px) {
    .form-group.btn-group {
        grid-column: span 1;
    }
}

.form-label {
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
    font-size: 13px;
}

@media (min-width: 414px) {
    .form-label {
        font-size: 14px;
        margin-bottom: 8px;
    }
}

.form-control, .form-select {
    width: 100%;
    height: 45px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
    background: white;
    transition: var(--transition);
}

@media (min-width: 414px) {
    .form-control, .form-select {
        height: 48px;
        padding: 10px 15px;
        font-size: 15px;
    }
}

@media (min-width: 768px) {
    .form-control, .form-select {
        height: 50px;
        font-size: 16px;
    }
}

.form-control:focus, .form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
    outline: none;
}

/* Bouton recherche */
.btn-search {
    background: var(--primary-color);
    border: none;
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    color: white;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

@media (min-width: 414px) {
    .btn-search {
        padding: 14px 20px;
        font-size: 15px;
        height: 48px;
    }
}

@media (min-width: 768px) {
    .btn-search {
        font-size: 16px;
        height: 50px;
    }
}

.btn-search:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

/* Section résultats */
.results-section {
    padding: 30px 0;
}

@media (min-width: 768px) {
    .results-section {
        padding: 50px 0;
    }
}

@media (min-width: 1280px) {
    .results-section {
        padding: 60px 0;
    }
}

.results-header {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

@media (min-width: 768px) {
    .results-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 30px;
    }
}

@media (min-width: 1024px) {
    .results-header {
        margin-bottom: 40px;
    }
}

.results-count {
    font-size: 16px;
    color: var(--primary-color);
    font-weight: 600;
}

@media (min-width: 414px) {
    .results-count {
        font-size: 18px;
    }
}

@media (min-width: 768px) {
    .results-count {
        font-size: 20px;
    }
}

/* Grille de propriétés */
.property-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 600px) {
    .property-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }
}

@media (min-width: 1024px) {
    .property-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 30px;
    }
}

/* Carte propriété */
.property-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    cursor: pointer;
    backface-visibility: hidden;
}

@media (min-width: 768px) {
    .property-card {
        border-radius: 15px;
    }
}

.property-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.property-image {
    height: 180px;
    background-size: cover;
    background-position: center;
    position: relative;
}

@media (min-width: 414px) {
    .property-image {
        height: 200px;
    }
}

@media (min-width: 768px) {
    .property-image {
        height: 220px;
    }
}

@media (min-width: 1024px) {
    .property-image {
        height: 250px;
    }
}

.property-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--primary-color);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
}

@media (min-width: 414px) {
    .property-badge {
        padding: 6px 12px;
        font-size: 12px;
        top: 15px;
        left: 15px;
    }
}

.price-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 6px 10px;
    border-radius: 15px;
    font-weight: bold;
    font-size: 12px;
}

@media (min-width: 414px) {
    .price-badge {
        padding: 8px 12px;
        font-size: 13px;
        top: 15px;
        right: 15px;
    }
}

.property-content {
    padding: 15px;
}

@media (min-width: 414px) {
    .property-content {
        padding: 20px;
    }
}

@media (min-width: 768px) {
    .property-content {
        padding: 25px;
    }
}

.property-title {
    font-size: 16px;
    font-weight: bold;
    color: var(--text-dark);
    margin-bottom: 8px;
    line-height: 1.3;
}

@media (min-width: 414px) {
    .property-title {
        font-size: 18px;
    }
}

@media (min-width: 768px) {
    .property-title {
        font-size: 20px;
        margin-bottom: 10px;
    }
}

@media (min-width: 1280px) {
    .property-title {
        font-size: 22px;
    }
}

.property-location {
    display: flex;
    align-items: center;
    color: var(--text-gray);
    font-size: 13px;
    margin-bottom: 12px;
    gap: 5px;
}

@media (min-width: 414px) {
    .property-location {
        font-size: 14px;
    }
}

.property-features {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

@media (min-width: 414px) {
    .property-features {
        gap: 12px;
        margin-bottom: 15px;
    }
}

.feature-item {
    display: flex;
    align-items: center;
    color: var(--text-gray);
    font-size: 13px;
    gap: 4px;
}

@media (min-width: 414px) {
    .feature-item {
        font-size: 14px;
        gap: 5px;
    }
}

.feature-item i {
    color: var(--primary-color);
}

.property-description {
    color: var(--text-gray);
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (min-width: 414px) {
    .property-description {
        font-size: 14px;
        margin-bottom: 15px;
    }
}

.property-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    gap: 10px;
}

@media (min-width: 414px) {
    .property-footer {
        padding-top: 15px;
    }
}

.property-price {
    font-size: 16px;
    font-weight: bold;
    color: var(--text-dark);
}

@media (min-width: 414px) {
    .property-price {
        font-size: 18px;
    }
}

@media (min-width: 768px) {
    .property-price {
        font-size: 20px;
    }
}

.property-price small {
    font-size: 12px;
    color: var(--text-gray);
    font-weight: normal;
}

@media (min-width: 414px) {
    .property-price small {
        font-size: 13px;
    }
}

.btn-view-details {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
}

@media (min-width: 414px) {
    .btn-view-details {
        padding: 8px 16px;
        font-size: 13px;
    }
}

@media (min-width: 768px) {
    .btn-view-details {
        font-size: 14px;
    }
}

.btn-view-details:hover {
    background: #5a67d8;
}

/* Message vide */
.empty-results {
    text-align: center;
    padding: 40px 20px;
}

@media (min-width: 768px) {
    .empty-results {
        padding: 60px 20px;
    }
}

.empty-results i {
    font-size: 40px;
    color: #cbd5e0;
    margin-bottom: 15px;
}

@media (min-width: 414px) {
    .empty-results i {
        font-size: 48px;
        margin-bottom: 20px;
    }
}

.empty-results h3 {
    color: var(--text-gray);
    margin-bottom: 8px;
    font-size: 18px;
}

@media (min-width: 414px) {
    .empty-results h3 {
        font-size: 20px;
    }
}

@media (min-width: 768px) {
    .empty-results h3 {
        font-size: 24px;
    }
}

.empty-results p {
    color: #a0aec0;
    font-size: 14px;
}

@media (min-width: 414px) {
    .empty-results p {
        font-size: 15px;
    }
}

/* Mode paysage mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .search-section {
        padding: 15px 0;
    }

    .search-title {
        font-size: 18px;
        margin-bottom: 5px;
    }

    .search-subtitle {
        font-size: 13px;
        margin-bottom: 15px;
    }

    .search-form {
        padding: 15px;
    }

    .form-grid {
        gap: 10px;
    }

    .form-control, .form-select, .btn-search {
        height: 40px;
    }
}

/* Mode contraste élevé */
@media (prefers-contrast: high) {
    .property-card {
        border: 2px solid var(--text-dark);
    }

    .btn-search, .btn-view-details {
        border: 2px solid white;
    }
}

/* Optimisations performance */
.property-card,
.btn-search,
.btn-view-details,
.btn-back {
    will-change: transform;
}

/* Touch devices */
@media (hover: none) and (pointer: coarse) {
    .property-card:active {
        transform: scale(0.98);
    }

    .btn-search:active,
    .btn-view-details:active,
    .btn-back:active {
        transform: scale(0.95);
    }
}
