/* ====================
   Mobile First Responsive Design
   ==================== */

/* Mobile Large (up to 768px) */
@media (max-width: 768px) {
    /* Header */
    .nav {
        position: fixed;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(247, 247, 245, 0.95);
        backdrop-filter: blur(25px);
        -webkit-backdrop-filter: blur(25px);
        padding: 2rem;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
        transition: var(--transition-smooth);
        z-index: 999;
    }
    
    .nav.active {
        top: calc(100% - 1px);
    }
    
    .nav-list {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .nav-toggle {
        display: flex;
    }
    
    .nav-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(6px, 6px);
    }
    
    .nav-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    
    .nav-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(6px, -6px);
    }
    
    .header-actions .btn {
        display: none;
    }
    
    /* Hero */
    .hero-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
    
    .hero-actions {
        justify-content: center;
    }
    
    .ai-assistant-section {
        order: -1;
    }
    
    .ai-cards {
        flex-direction: column;
        gap: 1rem;
    }
    
    .ai-card {
        padding: 1.5rem;
    }
    
    /* Sections */
    .section-header {
        margin-bottom: 2rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .section-subtitle {
        font-size: 1rem;
    }
    
    /* Listings */
    .listings-carousel {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .listing-card {
        margin: 0 1rem;
    }
    
    .listing-actions {
        flex-direction: column;
    }
    
    .listing-actions .btn {
        text-align: center;
    }
    
    /* Neighborhoods */
    .neighborhoods-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .neighborhood-card {
        height: 300px;
        margin: 0 1rem;
    }
    
    /* Testimonials */
    .testimonials-slider {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .testimonial-card {
        margin: 0 1rem;
        padding: 2rem 1.5rem;
    }
    
    /* CTA */
    .cta-content {
        flex-direction: column;
        text-align: center;
        gap: 2rem;
    }
    
    .cta-actions {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .footer-bottom-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .footer-links {
        justify-content: center;
    }
    
    /* Chat Widget */
    .chat-widget {
        width: calc(100vw - 40px);
        height: calc(100vh - 140px);
        bottom: 100px;
        right: 20px;
        left: 20px;
    }
    
    .chat-toggle {
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
        font-size: 1.25rem;
    }
    
    /* Buttons */
    .btn {
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }
    
    .hero-actions .btn {
        padding: 1.125rem 2rem;
        font-size: 1.125rem;
    }
    
    /* Modal */
    .modal {
        width: 95%;
        margin: 1rem;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1.5rem;
    }
    
    /* Forms */
    .filters-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .filter-buttons {
        justify-content: flex-start;
    }
    
    .filters-actions {
        justify-content: center;
        flex-wrap: wrap;
    }
}

/* Mobile Small (up to 480px) */
@media (max-width: 480px) {
    /* Base */
    .container {
        padding: 0 1rem;
    }
    
    /* Typography */
    h1 { font-size: 2.5rem; }
    h2 { font-size: 2rem; }
    h3 { font-size: 1.5rem; }
    
    /* Hero */
    .hero {
        min-height: 600px;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.125rem;
    }
    
    .hero-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .hero-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* AI Cards */
    .ai-card {
        padding: 1rem;
    }
    
    .ai-card-header h3 {
        font-size: 1rem;
    }
    
    /* Listing Cards */
    .listing-content {
        padding: 1.5rem;
    }
    
    .listing-details {
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .listing-detail {
        font-size: 0.875rem;
    }
    
    /* Neighborhood Cards */
    .neighborhood-content {
        padding: 1.5rem;
    }
    
    .neighborhood-content h3 {
        font-size: 1.5rem;
    }
    
    /* Testimonials */
    .testimonial-card {
        padding: 1.5rem 1rem;
    }
    
    .testimonial-card blockquote {
        font-size: 1rem;
    }
    
    /* Chat Widget */
    .chat-widget {
        width: calc(100vw - 20px);
        height: calc(100vh - 120px);
        bottom: 80px;
        right: 10px;
        left: 10px;
    }
    
    .chat-input-container {
        padding: 1rem;
    }
    
    .voice-controls {
        padding: 0.5rem;
    }
    
    .message-content {
        max-width: 220px;
        padding: 0.875rem 1rem;
        font-size: 0.9rem;
    }
    
    /* Footer */
    .footer {
        padding: 3rem 0 1.5rem;
    }
    
    .contact-info p {
        font-size: 0.9rem;
    }
    
    .social-links {
        justify-content: center;
    }
}

/* Tablet Portrait (768px to 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    /* Hero */
    .hero-content {
        grid-template-columns: 1fr 350px;
        gap: 3rem;
    }
    
    .ai-assistant-section {
        padding: 1.5rem;
    }
    
    /* Listings */
    .listings-carousel {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Neighborhoods */
    .neighborhoods-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Testimonials */
    .testimonials-slider {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: 2fr 1fr 1fr;
        gap: 2rem;
    }
    
    /* Chat Widget */
    .chat-widget {
        width: 380px;
        height: 550px;
    }
}

/* Desktop Small (1024px to 1200px) */
@media (min-width: 1025px) and (max-width: 1200px) {
    .container {
        max-width: 1000px;
    }
    
    .hero-content {
        grid-template-columns: 1fr 380px;
    }
    
    .listings-carousel {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .footer-content {
        grid-template-columns: 2fr 1fr 1fr 1.5fr;
    }
}

/* Desktop Large (1200px and up) */
@media (min-width: 1201px) {
    .container {
        max-width: 1400px;
    }
    
    .listings-carousel {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .neighborhoods-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .testimonials-slider {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Ultra Wide Screens (1600px and up) */
@media (min-width: 1600px) {
    .container {
        max-width: 1600px;
    }
    
    .hero-content {
        grid-template-columns: 1fr 450px;
        gap: 5rem;
    }
    
    .ai-assistant-section {
        padding: 3rem;
    }
    
    .listings-carousel {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Optimize for high-DPI screens */
    .logo-img,
    .listing-image img,
    .neighborhood-image img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Landscape Orientation on Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        min-height: 500px;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .chat-widget {
        height: calc(100vh - 100px);
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --off-white: #1a1a1a;
        --charcoal: #f0f0f0;
        --white: #2a2a2a;
    }
    
    .header {
        background: rgba(26, 26, 26, 0.9);
    }
    
    .chat-widget {
        background: linear-gradient(135deg, rgba(26, 26, 26, 0.95) 0%, rgba(42, 42, 42, 0.9) 100%);
    }
    
    .bot-message .message-content {
        background: var(--charcoal);
        color: var(--off-white);
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .hero-video video {
        animation: none;
    }
    
    .pulse,
    .bounce,
    .spin {
        animation: none;
    }
}

/* Print Styles */
@media print {
    .header,
    .chat-widget,
    .chat-toggle,
    .hero-video,
    .nav-toggle {
        display: none !important;
    }
    
    .hero {
        background: var(--off-white);
        color: var(--charcoal);
        min-height: auto;
        padding: 2rem 0;
    }
    
    .hero-overlay {
        display: none;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .btn {
        border: 2px solid black;
        background: white;
        color: black;
    }
    
    a {
        text-decoration: underline;
    }
}