/* ==========================================================================
   LOCAFRIQUE - STYLES RESPONSIVE
   Optimisé pour tous les appareils (mobile-first)
   ========================================================================== */

/* ==========================================================================
   GRANDES TABLETTES ET DESKTOPS (1024px+)
   ========================================================================== */

@media (max-width: 1200px) {
    .container {
        max-width: 100%;
        padding: 0 var(--spacing-lg);
    }
    
    .hero-text h1 {
        font-size: 3.5rem;
    }
    
    .search-form {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
    
    .properties-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    }
}

/* ==========================================================================
   TABLETTES (768px - 1024px)
   ========================================================================== */

@media (max-width: 1024px) {
    :root {
        --spacing-xxxl: 3rem;
        --spacing-xxl: 2.5rem;
    }
    
    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--pure-white);
        flex-direction: column;
        padding: var(--spacing-lg);
        box-shadow: var(--shadow-lg);
        border-radius: 0 0 var(--radius-lg) var(--radius-lg);
        gap: var(--spacing-md);
        z-index: var(--z-dropdown);
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .hamburger {
        display: flex;
    }
    
    .nav-actions {
        flex-wrap: wrap;
        gap: var(--spacing-sm);
    }
    
    .location-display {
        order: -1;
        width: 100%;
        justify-content: center;
    }
    
    .hero-text h1 {
        font-size: 3rem;
    }
    
    .search-form {
        grid-template-columns: 1fr 1fr;
        gap: var(--spacing-lg);
    }
    
    .search-btn {
        grid-column: 1 / -1;
    }
    
    .category-buttons {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-md);
    }
    
    .controls-bar {
        flex-direction: column;
        align-items: stretch;
        gap: var(--spacing-md);
    }
    
    .view-controls {
        justify-content: center;
    }
    
    .sort-controls {
        justify-content: space-between;
    }
    
    .properties-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: var(--spacing-lg);
    }
    
    .properties-grid.list-view .property-card {
        flex-direction: column;
        height: auto;
    }
    
    .properties-grid.list-view .property-image {
        width: 100%;
        height: 250px;
    }
    
    .about-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-xl);
        text-align: center;
    }
    
    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--spacing-lg);
    }
    
    .modal-content {
        width: 95%;
    }
}

/* ==========================================================================
   MOBILES LARGES (481px - 768px)
   ========================================================================== */

@media (max-width: 768px) {
    :root {
        --spacing-xxxl: 2rem;
        --spacing-xxl: 1.5rem;
        --spacing-xl: 1.25rem;
    }
    
    html {
        font-size: 15px;
    }
    
    .container {
        padding: 0 var(--spacing-md);
    }
    
    /* Header mobile */
    .nav-container {
        padding: 0 var(--spacing-md);
    }
    
    .nav-logo h1 {
        font-size: 1.5rem;
    }
    
    .nav-actions {
        gap: var(--spacing-xs);
    }
    
    .nav-actions .btn-primary,
    .nav-actions .btn-outline {
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: 0.85rem;
    }
    
    .location-display {
        font-size: 0.8rem;
        padding: var(--spacing-xs) var(--spacing-sm);
    }
    
    /* Hero mobile */
    .hero {
        min-height: 100vh;
        padding-top: 100px;
    }
    
    .hero-content {
        padding: 0 var(--spacing-md);
    }
    
    .hero-text h1 {
        font-size: 2.5rem;
        line-height: 1.2;
        margin-bottom: var(--spacing-lg);
    }
    
    .hero-text p {
        font-size: 1.1rem;
        margin-bottom: var(--spacing-xl);
    }
    
    /* Recherche mobile */
    .search-form {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
        padding: var(--spacing-md);
    }
    
    .search-field label {
        font-size: 0.85rem;
    }
    
    .search-field input,
    .search-field select {
        padding: var(--spacing-sm);
        font-size: 0.95rem;
    }
    
    .search-btn {
        padding: var(--spacing-md);
        font-size: 1rem;
    }
    
    /* Catégories rapides */
    .category-buttons {
        grid-template-columns: 1fr 1fr;
    }
    
    .category-btn {
        min-width: auto;
        padding: var(--spacing-md);
        font-size: 0.85rem;
    }
    
    .category-btn i {
        font-size: 1.2rem;
    }
    
    /* Section propriétés */
    .properties-section {
        padding: var(--spacing-xl) 0;
    }
    
    .section-header h2 {
        font-size: 2rem;
    }
    
    .controls-bar {
        gap: var(--spacing-sm);
    }
    
    .view-btn {
        padding: var(--spacing-sm);
        font-size: 0.85rem;
        flex: 1;
        justify-content: center;
    }
    
    .sort-select,
    .filter-btn {
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: 0.85rem;
    }
    
    /* Filtres */
    .filters-content {
        padding: var(--spacing-md);
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }
    
    .amenities-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .filter-actions {
        flex-direction: column;
        gap: var(--spacing-sm);
    }
    
    .filter-actions button {
        width: 100%;
        justify-content: center;
    }
    
    /* Grille des propriétés */
    .properties-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }
    
    .property-image {
        height: 220px;
    }
    
    .property-content {
        padding: var(--spacing-md);
    }
    
    .property-title {
        font-size: 1.1rem;
    }
    
    .property-features {
        flex-wrap: wrap;
        gap: var(--spacing-sm);
        font-size: 0.85rem;
    }
    
    .property-amenities {
        gap: var(--spacing-xs);
    }
    
    .amenity-tag {
        font-size: 0.7rem;
        padding: 2px var(--spacing-xs);
    }
    
    .property-footer {
        flex-direction: column;
        align-items: stretch;
        gap: var(--spacing-md);
    }
    
    .price-amount {
        font-size: 1.3rem;
    }
    
    .contact-btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Carte */
    .map-container {
        height: 400px;
    }
    
    /* À propos */
    .about-section {
        padding: var(--spacing-xl) 0;
    }
    
    .about-content h2 {
        font-size: 2rem;
    }
    
    .features-list {
        gap: var(--spacing-md);
    }
    
    .feature-item {
        flex-direction: column;
        text-align: center;
        gap: var(--spacing-md);
    }
    
    .feature-item i {
        align-self: center;
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .about-image img {
        height: 300px;
    }
    
    /* Footer */
    .footer {
        padding: var(--spacing-xl) 0 var(--spacing-md);
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
        text-align: center;
    }
    
    .footer-section:first-child {
        order: -1;
    }
    
    .social-links {
        justify-content: center;
    }
    
    .footer-legal {
        flex-direction: column;
        text-align: center;
        gap: var(--spacing-md);
    }
    
    /* Modals */
    .modal-content {
        margin: var(--spacing-md);
        max-height: 85vh;
    }
    
    .modal-header {
        padding: var(--spacing-md);
    }
    
    .modal-body {
        padding: var(--spacing-md);
    }
    
    /* Formulaires */
    .form-row {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }
    
    .form-actions {
        flex-direction: column;
        gap: var(--spacing-sm);
    }
    
    .form-actions button {
        width: 100%;
        justify-content: center;
    }
    
    /* Toasts */
    .toast-container {
        left: var(--spacing-md);
        right: var(--spacing-md);
        top: 90px;
    }
    
    .toast {
        max-width: none;
    }
    
    /* Pagination */
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .pagination button {
        min-width: 40px;
        padding: var(--spacing-sm);
    }
}

/* ==========================================================================
   PETITS MOBILES (320px - 480px)
   ========================================================================== */

@media (max-width: 480px) {
    html {
        font-size: 14px;
    }
    
    :root {
        --spacing-xl: 1rem;
        --spacing-lg: 0.75rem;
        --spacing-md: 0.5rem;
    }
    
    .hero-text h1 {
        font-size: 2rem;
        line-height: 1.1;
    }
    
    .hero-text p {
        font-size: 1rem;
    }
    
    .search-form {
        padding: var(--spacing-sm);
    }
    
    .search-field label {
        font-size: 0.8rem;
        margin-bottom: var(--spacing-xs);
    }
    
    .search-field input,
    .search-field select {
        padding: var(--spacing-sm);
        font-size: 0.9rem;
    }
    
    .section-header h2 {
        font-size: 1.75rem;
    }
    
    .property-image {
        height: 180px;
    }
    
    .property-content {
        padding: var(--spacing-sm);
    }
    
    .property-title {
        font-size: 1rem;
    }
    
    .property-features {
        font-size: 0.8rem;
    }
    
    .price-amount {
        font-size: 1.2rem;
    }
    
    .category-btn {
        padding: var(--spacing-sm);
        font-size: 0.8rem;
    }
    
    .view-btn {
        padding: var(--spacing-xs) var(--spacing-sm);
        font-size: 0.8rem;
    }
    
    .about-content h2 {
        font-size: 1.75rem;
    }
    
    .feature-item i {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }
    
    .footer-section h3 {
        font-size: 1.3rem;
    }
    
    .amenities-grid {
        grid-template-columns: 1fr;
    }
    
    .checkbox-item {
        padding: var(--spacing-sm);
    }
    
    .modal-content {
        margin: var(--spacing-sm);
        max-height: 90vh;
    }
}

/* ==========================================================================
   TRÈS PETITS ÉCRANS (max-width: 360px)
   ========================================================================== */

@media (max-width: 360px) {
    .hero-text h1 {
        font-size: 1.75rem;
    }
    
    .nav-logo h1 {
        font-size: 1.3rem;
    }
    
    .search-btn {
        font-size: 0.9rem;
        padding: var(--spacing-sm) var(--spacing-md);
    }
    
    .category-buttons {
        grid-template-columns: 1fr;
    }
    
    .view-controls {
        flex-direction: column;
        gap: var(--spacing-xs);
    }
    
    .view-btn {
        width: 100%;
    }
    
    .property-features {
        flex-direction: column;
        gap: var(--spacing-xs);
    }
    
    .about-content h2 {
        font-size: 1.5rem;
    }
}

/* ==========================================================================
   OPTIMISATIONS TACTILES
   ========================================================================== */

@media (hover: none) and (pointer: coarse) {
    /* Désactiver les animations hover sur tactile */
    .property-card:hover {
        transform: none;
        box-shadow: var(--shadow-sm);
    }
    
    .btn-primary:hover,
    .btn-outline:hover,
    .btn-secondary:hover {
        transform: none;
    }
    
    .category-btn:hover {
        transform: none;
        background: rgba(255, 255, 255, 0.2);
    }
    
    /* Augmenter les zones de clic */
    .property-action-btn {
        width: 44px;
        height: 44px;
    }
    
    .nav-link {
        padding: var(--spacing-md);
    }
    
    .hamburger {
        padding: var(--spacing-md);
    }
    
    .modal-close {
        width: 44px;
        height: 44px;
    }
    
    /* Focus visible pour l'accessibilité */
    button:focus-visible,
    input:focus-visible,
    select:focus-visible,
    a:focus-visible {
        outline: 3px solid var(--primary-orange);
        outline-offset: 2px;
    }
}

/* ==========================================================================
   ORIENTATION PAYSAGE SUR MOBILE
   ========================================================================== */

@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: 120px 0 var(--spacing-xl);
    }
    
    .hero-text h1 {
        font-size: 2.2rem;
        margin-bottom: var(--spacing-md);
    }
    
    .hero-text p {
        margin-bottom: var(--spacing-lg);
    }
    
    .search-container {
        margin-top: var(--spacing-lg);
    }
    
    .properties-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
    
    .map-container {
        height: 350px;
    }
}

/* ==========================================================================
   PRÉFÉRENCE DE MOUVEMENT RÉDUIT
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .spinner {
        animation: none;
    }
    
    .hero-text h1,
    .hero-text p,
    .search-container {
        animation: none;
    }
}

/* ==========================================================================
   CONTRASTE ÉLEVÉ
   ========================================================================== */

@media (prefers-contrast: high) {
    :root {
        --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
        --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
        --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
        --shadow-xl: 0 16px 40px rgba(0, 0, 0, 0.6);
    }
    
    .property-card {
        border-width: 2px;
    }
    
    .btn-outline {
        border-width: 3px;
    }
    
    .search-field input:focus,
    .search-field select:focus {
        box-shadow: 0 0 0 4px rgba(255, 107, 53, 0.3);
    }
}

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */

@media print {
    .header,
    .search-container,
    .controls-bar,
    .filters-panel,
    .pagination-container,
    .footer,
    .property-actions,
    .toast-container {
        display: none !important;
    }
    
    .hero {
        min-height: auto;
        padding: 2rem 0;
        background: var(--pure-white) !important;
        color: var(--charcoal) !important;
    }
    
    .hero-background {
        display: none;
    }
    
    .properties-section {
        padding: 2rem 0;
    }
    
    .property-card {
        break-inside: avoid;
        box-shadow: none !important;
        border: 2px solid var(--charcoal);
        margin-bottom: 1rem;
    }
    
    .property-card:hover {
        transform: none;
    }
    
    .about-section {
        padding: 2rem 0;
    }
    
    .about-grid {
        grid-template-columns: 1fr;
    }
    
    .map-container {
        display: none;
    }
    
    /* Optimiser les couleurs pour l'impression */
    * {
        color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
}