/* ==========================================================================
   RAFTAR ECOM - Responsive Stylesheet
   Mobile-First Responsive Breakpoints
   ========================================================================== */

/* --------------------------------------------------------------------------
   Breakpoints Reference:
   - Mobile: < 576px
   - Small tablets: 576px - 767px
   - Tablets: 768px - 1023px
   - Laptops: 1024px - 1199px
   - Desktops: 1200px - 1399px
   - Large desktops: >= 1400px
   -------------------------------------------------------------------------- */

/* ==========================================================================
   Small Devices (576px and up)
   ========================================================================== */
@media (min-width: 576px) {
    :root {
        --container-padding: 2rem;
    }

    /* Typography */
    .hero-title {
        font-size: clamp(2.5rem, 6vw, 4.5rem);
    }

    /* Hero Stats */
    .hero-stats {
        gap: var(--spacing-2xl);
    }

    .stat-item {
        min-width: 100px;
    }

    /* Forms */
    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Buttons in groups */
    .hero-buttons {
        flex-wrap: nowrap;
    }

    /* Property grid */
    .property-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ==========================================================================
   Medium Devices - Tablets (768px and up)
   ========================================================================== */
@media (min-width: 768px) {
    /* Section spacing */
    .section {
        padding: var(--spacing-5xl) 0;
    }

    /* Hero Section */
    .hero-text {
        padding: var(--spacing-4xl) 0;
    }

    .hero-description {
        font-size: var(--fs-xl);
    }

    /* About Features */
    .about-features {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Services Grid */
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Process Timeline */
    .process-timeline {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Testimonials */
    .testimonials-slider {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Location Grid */
    .location-grid {
        grid-template-columns: 1fr;
    }

    .location-info {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }

    /* Contact Grid */
    .contact-grid {
        grid-template-columns: 1fr;
    }

    /* Footer */
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .footer-bottom-content {
        flex-direction: row;
        justify-content: space-between;
    }

    /* CTA Section */
    .cta-buttons {
        flex-direction: row;
    }

    /* Advantages Stats */
    .advantages-stats {
        flex-direction: row;
    }

    .adv-stat-item {
        flex: 1;
    }
}

/* ==========================================================================
   Large Devices - Laptops (1024px and up)
   ========================================================================== */
@media (min-width: 1024px) {
    /* Header */
    .main-nav {
        display: block;
    }

    .mobile-menu-toggle {
        display: none;
    }

    .btn.btn-header {
        display: inline-flex;
    }

    /* Hide cursor on touch devices */
    .cursor-follower,
    .cursor-dot {
        display: block;
    }

    /* About Grid */
    .about-grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--spacing-4xl);
    }

    /* Advantages Grid */
    .advantages-grid {
        grid-template-columns: 1fr 1fr;
    }

    /* Location Grid */
    .location-grid {
        grid-template-columns: 1fr 1fr;
    }

    .location-info {
        display: flex;
        flex-direction: column;
    }

    /* Contact Grid */
    .contact-grid {
        grid-template-columns: 1fr 1.2fr;
    }

    /* Footer */
    .footer-grid {
        grid-template-columns: 2fr 1fr 1fr 1.5fr;
    }

    /* Property Types */
    .property-grid {
        grid-template-columns: repeat(8, 1fr);
    }

    /* Hero Navigation Position */
    .hero-nav {
        bottom: var(--spacing-3xl);
    }

    /* Scroll Indicator */
    .scroll-indicator {
        display: flex;
    }
}

/* ==========================================================================
   Extra Large Devices - Desktops (1200px and up)
   ========================================================================== */
@media (min-width: 1200px) {
    /* Container */
    :root {
        --container-max: 1320px;
    }

    /* Header Phone */
    .header-phone {
        display: flex;
    }

    /* Services Grid - 3 columns */
    .services-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Process Timeline - 3 columns */
    .process-timeline {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Testimonials - 3 columns */
    .testimonials-slider {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Hero content max width */
    .hero-text {
        max-width: 800px;
    }

    /* Larger stats numbers */
    .stat-number {
        font-size: var(--fs-5xl);
    }

    /* About Image positioning */
    .about-image-wrapper {
        padding: var(--spacing-2xl);
    }

    .about-image-secondary {
        width: 45%;
        max-width: 220px;
        bottom: 60px;
        left: -20px;
        right: auto;
    }

    .about-experience-badge {
        top: 0;
        left: 0;
    }
}

/* ==========================================================================
   XXL Devices - Large Desktops (1400px and up)
   ========================================================================== */
@media (min-width: 1400px) {
    :root {
        --container-max: 1400px;
    }

    /* Even larger typography for hero */
    .hero-title {
        font-size: var(--fs-6xl);
    }

    /* More spacing for sections */
    .section {
        padding: 8rem 0;
    }

    /* Larger service cards */
    .service-card-inner {
        padding: var(--spacing-3xl);
    }

    /* Process steps spacing */
    .process-step {
        padding: var(--spacing-3xl);
    }
}

/* ==========================================================================
   Mobile-Specific Styles (max-width)
   ========================================================================== */

/* Small mobile devices */
@media (max-width: 375px) {
    :root {
        --container-padding: 1rem;
        --fs-base: 0.9375rem;
    }

    .hero-title {
        font-size: var(--fs-2xl);
    }

    .hero-buttons {
        flex-direction: column;
    }

    .hero-buttons .btn {
        width: 100%;
    }

    .hero-stats {
        flex-direction: column;
        align-items: flex-start;
    }

    .stat-item {
        text-align: left;
    }

    .about-features {
        grid-template-columns: 1fr;
    }

    .property-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .advantages-stats {
        flex-direction: column;
    }

    .adv-stat-item {
        width: 100%;
    }

    .cta-buttons {
        flex-direction: column;
    }

    .cta-buttons .btn {
        width: 100%;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }
}

/* Tablets in portrait */
@media (max-width: 1023px) {
    /* Hide scroll indicator on smaller screens */
    .scroll-indicator {
        display: none;
    }

    /* Adjust hero navigation */
    .hero-nav {
        bottom: var(--spacing-xl);
    }

    /* Mobile menu overlay */
    .mobile-menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        opacity: 0;
        visibility: hidden;
        z-index: calc(var(--z-modal) - 1);
        transition: all var(--transition-base);
    }

    .mobile-menu-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* Adjust about section */
    .about-image-wrapper {
        max-width: 500px;
        margin: 0 auto;
    }

    /* Advantages section */
    .advantages-visual {
        order: -1;
    }

    .advantages-image {
        max-width: 100%;
    }

    .advantages-stats {
        position: relative;
        bottom: auto;
        left: auto;
        right: auto;
        margin-top: var(--spacing-lg);
    }
}

/* Landscape phones */
@media (max-width: 767px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: var(--spacing-4xl) 0;
    }

    .hero-content {
        padding-top: calc(var(--header-height) + var(--spacing-xl));
    }

    .hero-stats {
        display: none;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */
@media print {
    /* Hide non-essential elements */
    .header,
    .preloader,
    .cursor-follower,
    .cursor-dot,
    .mobile-menu,
    .hero-nav,
    .scroll-indicator,
    .whatsapp-float,
    .scroll-top,
    .cta-section {
        display: none !important;
    }

    /* Reset backgrounds */
    body {
        background: white !important;
        color: black !important;
    }

    .hero,
    .services-section,
    .process-section,
    .advantages-section,
    .testimonials-section,
    .location-section,
    .contact-section,
    .footer {
        background: white !important;
        color: black !important;
    }

    /* Ensure text is readable */
    h1, h2, h3, h4, h5, h6,
    p, li, a {
        color: black !important;
    }

    /* Remove shadows */
    * {
        box-shadow: none !important;
    }

    /* Links */
    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
    }

    /* Page breaks */
    .section {
        page-break-inside: avoid;
    }

    h2, h3 {
        page-break-after: avoid;
    }
}

/* ==========================================================================
   High DPI / Retina Displays
   ========================================================================== */
@media (-webkit-min-device-pixel-ratio: 2),
       (min-resolution: 192dpi) {
    /* Sharper borders */
    .service-card,
    .testimonial-card,
    .location-card,
    .contact-form-wrapper {
        border: 0.5px solid var(--color-gray-200);
    }
}

/* ==========================================================================
   Dark Mode Support (if user prefers)
   ========================================================================== */
@media (prefers-color-scheme: dark) {
    /* Optional: Add dark mode styles if needed */
    /* Currently the site has a professional construction theme
       that works well with the current color scheme */
}

/* ==========================================================================
   Hover Media Query (devices that support hover)
   ========================================================================== */
@media (hover: hover) {
    /* Apply hover effects only on devices that support it */
    .service-card:hover {
        transform: translateY(-10px);
    }

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

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

    .advantage-item:hover {
        padding-left: var(--spacing-md);
    }

    .nav-link:hover::after {
        width: 100%;
    }
}

/* Touch devices - remove hover effects */
@media (hover: none) {
    .service-card:active {
        transform: translateY(-5px);
    }

    .nav-link::after {
        display: none;
    }
}

/* ==========================================================================
   Safe Area Insets (for notched devices)
   ========================================================================== */
@supports (padding: env(safe-area-inset-bottom)) {
    .footer-bottom {
        padding-bottom: calc(var(--spacing-lg) + env(safe-area-inset-bottom));
    }

    .whatsapp-float {
        bottom: calc(var(--spacing-xl) + env(safe-area-inset-bottom));
        left: calc(var(--spacing-xl) + env(safe-area-inset-left));
    }

    .scroll-top {
        bottom: calc(var(--spacing-xl) + env(safe-area-inset-bottom));
        right: calc(var(--spacing-xl) + env(safe-area-inset-right));
    }
}

/* ==========================================================================
   Container Queries (Modern CSS)
   ========================================================================== */
@supports (container-type: inline-size) {
    .services-grid {
        container-type: inline-size;
    }

    @container (min-width: 600px) {
        .service-card-inner {
            padding: var(--spacing-2xl);
        }
    }

    @container (min-width: 900px) {
        .service-card-inner {
            padding: var(--spacing-3xl);
        }
    }
}

/* ==========================================================================
   Accessibility - Focus Visible
   ========================================================================== */
@media (prefers-reduced-motion: no-preference) {
    :focus-visible {
        outline: 2px solid var(--color-primary);
        outline-offset: 4px;
        transition: outline-offset 0.1s ease;
    }

    :focus-visible:active {
        outline-offset: 2px;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --color-primary: #1a4a44;
        --color-gray-600: #333333;
    }

    .btn-primary {
        border: 2px solid var(--color-white);
    }

    .service-card {
        border: 2px solid var(--color-gray-300);
    }
}
