/* Responsive Design - Mobile First Approach */

/* Default mobile styles (applies to all screens) */
.nav-toggle {
    display: none;
}

/* Mobile devices (up to 991px) */
@media (max-width: 991px) {
    .nav-toggle {
        display: flex !important;
        flex-direction: column;
        gap: 4px;
        cursor: pointer;
        z-index: 1002;
    }
    
    .nav-toggle .bar {
        width: 25px;
        height: 3px;
        background: var(--dark);
        transition: var(--transition);
    }
    
    /* Mobile menu animation states */
    .nav-toggle.active .bar:nth-child(1) {
        transform: rotate(-45deg) translate(-5px, 6px);
    }
    
    .nav-toggle.active .bar:nth-child(2) {
        opacity: 0;
    }
    
    .nav-toggle.active .bar:nth-child(3) {
        transform: rotate(45deg) translate(-5px, -6px);
    }
    
    .nav-menu {
        position: fixed;
        top: 70px;
        left: -100%;
        background: var(--white);
        width: 100%;
        flex-direction: column;
        padding: 2rem;
        box-shadow: var(--shadow-lg);
        transition: var(--transition);
        gap: 1rem;
        z-index: 1001;
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .dropdown-content {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        background: var(--gray);
        margin-top: 1rem;
        display: none;
        border: 1px solid var(--gray-dark);
    }
    
    .dropdown.active .dropdown-content {
        display: block;
    }
    
    .dropdown .nav-link i {
        transition: transform 0.3s;
    }
    
    .dropdown.active .nav-link i {
        transform: rotate(180deg);
    }
    
    /* Improve touch targets for mobile */
    .btn {
        min-height: 44px;
        padding: 12px 24px;
    }
    
    .nav-link {
        padding: 12px 0;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    /* About Page Mobile Styles */
    .about-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .about-content h2 {
        font-size: 1.8rem;
    }
    
    .about-content h3 {
        font-size: 1.3rem;
    }
    
    /* Contact Page Mobile Styles */
    .contact-grid,
    .schedule-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .contact-form,
    .schedule-form {
        padding: 1.5rem;
    }
    
    .contact-method {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .method-icon {
        margin: 0 auto;
    }
    
    /* Browse Page Mobile Styles */
    .filters-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-actions {
        justify-content: center;
    }
    
    .homes-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    /* Property Details Mobile Styles */
    .details-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .specs-grid {
        grid-template-columns: repeat(2, 1fr);
        padding: 1.5rem;
    }
    
    .floorplan-container {
        grid-template-columns: 1fr;
    }
    
    .main-image {
        height: 300px;
    }
    
    .gallery-nav {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .thumbnail {
        width: 80px;
        height: 60px;
    }
    
    /* Improve readability on mobile */
    .section-header h2 {
        font-size: 1.8rem;
        line-height: 1.3;
    }
    
    .feature-card h3,
    .home-info h3 {
        font-size: 1.3rem;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-stats {
        gap: 2rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
}

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) {
    .hero-title {
        font-size: 2.2rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    .hero-buttons {
        flex-direction: row;
    }
    
    .hero-buttons .btn {
        width: auto;
    }
    
    .home-specs {
        flex-direction: row;
    }
    
    .feature-card {
        padding: 2rem 1.5rem;
    }
    
    /* About Page */
    .values-grid,
    .team-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Contact Page */
    .contact-method {
        flex-direction: row;
        text-align: left;
    }
    
    .method-icon {
        margin: 0;
    }
    
    /* Browse Page */
    .filters-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .homes-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Property Details */
    .specs-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
    .container {
        max-width: 720px;
        padding: 0 20px;
    }
    
    .hero {
        height: 100vh;
        margin-top: 80px;
    }
    
    .hero-title {
        font-size: 2.8rem;
    }
    
    .hero-subtitle {
        font-size: 1.2rem;
    }
    
    .section-header h2 {
        font-size: 2.2rem;
    }
    
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .homes-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .process-steps {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .hero-stats {
        flex-direction: row;
    }
    
    .cta-buttons {
        flex-direction: row;
    }
    
    .cta-buttons .btn {
        width: auto;
    }
    
    /* About Page */
    .about-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .team-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* Contact Page */
    .contact-grid,
    .schedule-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    /* Browse Page */
    .filters-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .homes-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
    .container {
        max-width: 960px;
    }
    
    .hero-title {
        font-size: 3.2rem;
    }
    
    /* Hide mobile menu on desktop */
    .nav-toggle {
        display: none !important;
    }
    
    .nav-menu {
        display: flex !important;
        position: static;
        background: transparent;
        box-shadow: none;
        padding: 0;
        flex-direction: row;
        left: 0 !important;
    }
    
    .dropdown-content {
        position: absolute;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        display: block !important;
        background: var(--white);
        box-shadow: var(--shadow-lg);
    }
    
    .dropdown:hover .dropdown-content {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
    
    .features-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .homes-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .process-steps {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .footer-content {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .nav-container {
        padding: 1rem 2rem;
    }
    
    /* About Page */
    .values-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    /* Browse Page */
    .filters-grid {
        grid-template-columns: repeat(6, 1fr);
    }
    
    .homes-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
    
    .hero-title {
        font-size: 3.5rem;
    }
    
    .hero-content {
        max-width: 800px;
    }
}

/* Extra extra large devices (1400px and up) */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
    
    .nav-container {
        max-width: 1400px;
    }
}

/* Very small devices (phones, 375px and down) */
@media (max-width: 375px) {
    .hero-title {
        font-size: 1.6rem;
    }
    
    .hero-subtitle {
        font-size: 0.95rem;
    }
    
    .hero-buttons .btn {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .container {
        padding: 0 12px;
    }
    
    .feature-card,
    .home-info {
        padding: 1.5rem 1rem;
    }
    
    .home-specs span {
        font-size: 0.85rem;
    }
    
    /* About Page */
    .values-grid,
    .team-grid {
        grid-template-columns: 1fr;
    }
    
    /* Contact Page */
    .contact-form,
    .schedule-form {
        padding: 1rem;
    }
    
    /* Browse Page */
    .filters-container {
        padding: 1.5rem;
    }
    
    .homes-grid {
        grid-template-columns: 1fr;
    }
    
    /* Property Details */
    .specs-grid {
        grid-template-columns: 1fr;
        padding: 1rem;
    }
    
    .sidebar-card {
        padding: 1.5rem;
    }
}

/* Landscape orientation optimizations */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        height: auto;
        min-height: 100vh;
        padding: 100px 0 60px;
    }
    
    .hero-content {
        padding: 2rem 0;
    }
    
    .hero-stats {
        margin-top: 1rem;
    }
    
    .scroll-indicator {
        display: none;
    }
    
    .main-image {
        height: 300px;
    }
}

/* High-resolution displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .hero-background {
        background-image: url('https://images.unsplash.com/photo-1568605114967-8130f3a36994?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=2070&q=80');
    }
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .hero-title .title-line {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
    
    .fade-in-scroll {
        transition: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
    
    .scroll-indicator {
        animation: none !important;
    }
    
    .nav-toggle .bar {
        transition: none !important;
    }
}

/* Dark mode support - Respect user preferences */
@media (prefers-color-scheme: dark) {
    :root {
        --white: #ffffff;
        --dark: #000000;
        --dark-light: #666666;
        --gray: #f5f5f5;
        --gray-dark: #e0e0e0;
    }
    
    body {
        background-color: #ffffff;
        color: #000000;
    }
    
    .navbar {
        background: #ffffff;
    }
    
    .feature-card,
    .home-card {
        background: #ffffff;
        border-color: #e0e0e0;
    }
    
    .contact-form,
    .schedule-form,
    .filters-container,
    .sidebar-card {
        background: #ffffff;
        border-color: #e0e0e0;
    }
}

/* Print styles */
@media print {
    * {
        background: transparent !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    .navbar,
    .footer,
    .btn,
    .hero-buttons,
    .cta-section,
    .scroll-indicator,
    .hero-background,
    .hero-overlay,
    .nav-toggle,
    .social-links,
    .gallery-nav,
    .thumbnail-gallery {
        display: none !important;
    }
    
    .hero {
        height: auto;
        color: black !important;
        background: white !important;
        margin-top: 0;
        position: static;
    }
    
    .hero-content {
        position: static;
        color: black !important;
    }
    
    .hero-title,
    .hero-subtitle {
        color: black !important;
    }
    
    .home-card {
        break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #ccc !important;
        margin-bottom: 1rem;
    }
    
    .home-image {
        height: 150px;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
    
    h1, h2, h3 {
        color: black !important;
    }
    
    a {
        text-decoration: underline;
    }
    
    a[href]:after {
        content: " (" attr(href) ")";
    }
    
    .container {
        max-width: none;
        padding: 0;
    }
    
    section {
        padding: 40px 0 !important;
        page-break-inside: avoid;
    }
    
    /* Property Details Print Styles */
    .details-grid {
        grid-template-columns: 1fr;
    }
    
    .property-sidebar {
        display: none;
    }
    
    .main-image {
        height: 300px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .feature-card:hover,
    .home-card:hover {
        transform: none;
    }
    
    .btn:hover {
        transform: none;
    }
    
    .dropdown:hover .dropdown-content {
        opacity: 0;
        visibility: hidden;
    }
    
    /* Improve touch feedback */
    .btn:active {
        transform: scale(0.98);
    }
    
    .feature-card:active,
    .home-card:active {
        transform: scale(0.99);
    }
    
    .gallery-nav:active {
        transform: translateY(-50%) scale(0.95);
    }
}

/* Foldable devices and very small screens */
@media (max-width: 320px) {
    .hero-title {
        font-size: 1.4rem;
    }
    
    .hero-subtitle {
        font-size: 0.9rem;
    }
    
    .hero-buttons .btn {
        padding: 8px 14px;
        font-size: 13px;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .feature-icon {
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
    }
    
    .value-icon {
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
    }
    
    .method-icon {
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
    }
}