/**
 * Global Responsive Stylesheet - Aqari Theme
 * ============================================
 * This file ensures full responsiveness across the entire website.
 * It is loaded LAST to override all other styles.
 * 
 * v1.1.0 - 2026-02-07 (Fixed: removed base rules that affected desktop)
 */

/* ==========================================================================
   TABLET BREAKPOINT (max-width: 1024px)
   ========================================================================== */
@media (max-width: 1024px) {

    /* Container adjustments */
    .container {
        padding-left: 20px;
        padding-right: 20px;
    }

    /* Project Layout */
    .project-layout {
        grid-template-columns: 1fr 300px;
        gap: 20px;
    }

    /* Project Hero */
    .project-hero {
        height: auto;
        min-height: 400px;
        padding-bottom: 30px;
    }

    .project-title {
        font-size: 2.2rem;
    }

    /* Projects Grid */
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    /* Section padding */
    .section-padding {
        padding: 50px 0;
    }

    /* Section titles */
    .section-title {
        font-size: 2rem;
    }
}

/* ==========================================================================
   MOBILE BREAKPOINT (max-width: 768px)
   ========================================================================== */
@media (max-width: 768px) {

    /* ===== 🛡️ NUCLEAR OPTION: PREVENT HORIZONTAL SCROLL ===== */
    html,
    body {
        width: 100%;
        height: 100%;
        margin: 0px;
        padding: 0px;
        overflow-x: hidden !important;
        position: relative;
    }

    /* Constraint Main Wrappers */
    #page,
    .site,
    .site-content,
    .site-main,
    .project-body-content,
    .judod-container {
        max-width: 100% !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }

    /* Images & Media - Never overflow */
    img,
    video,
    iframe,
    canvas,
    svg {
        max-width: 100% !important;
        height: auto !important;
    }

    /* Carousel Cards - Must retain exact height and cover card fully without dark gaps */
    .site-main .makan-carousel-card img,
    .makan-carousel-card img,
    .makan-carousel-slide img {
        width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        min-height: 100% !important;
        object-fit: cover !important;
    }

    /* Text - Break long words */
    p,
    h1,
    h2,
    h3,
    h4,
    span,
    a,
    li,
    div,
    blockquote {
        overflow-wrap: break-word !important;
        word-wrap: break-word !important;
        word-break: break-word;
        /* Ensure long URLs break */
        max-width: 100% !important;
    }

    /* Fix Bootstrap Rows Negative Margins */
    .row {
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        display: flex !important;
        flex-wrap: wrap !important;
        flex-direction: column !important;
        /* Force Stack on Mobile */
    }

    /* Fix Bootstrap Columns */
    [class*="col-"] {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        margin-bottom: 20px !important;
        /* Space between stacked columns */
    }

    /* Container - Visual Breathing Room */
    .container {
        width: calc(100% - 30px) !important;
        /* Force physical margins */
        max-width: 100% !important;
        margin-left: auto !important;
        margin-right: auto !important;
        padding-left: 0 !important;
        /* Reset padding since we use calc width */
        padding-right: 0 !important;
        overflow-x: hidden !important;
    }

    /* CLEARANCE for Sticky Bar */
    body.single-project,
    .project-body-content {
        padding-bottom: 150px !important;
        /* Huge buffer for sticky bar */
    }

    /* RTL Specific Fixes */
    html[dir="rtl"] .row,
    body.rtl .row {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* Force Project Layout to be Single Column */
    .project-layout,
    .project-body-content .row {
        display: block !important;
        /* Remove Flex to avoid any row behavior */
    }

    /* Specific Element Fixes */
    .content-card,
    .entry-content,
    .unified-project-info {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* FIX: Force scroll on all tables */
    table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* FIX: TOC Containers */
    #toc_container,
    .ez-toc-container,
    .lwptoc {
        width: 100% !important;
        float: none !important;
        display: block !important;
        margin: 20px 0 !important;
    }

    /* ===== END NUCLEAR FIXES ===== */

    /* Project Layout - SINGLE COLUMN */
    .project-layout {
        grid-template-columns: 1fr !important;
        gap: 25px;
        margin-top: 0;
    }

    /* Project Hero */
    .project-hero {
        height: auto;
        min-height: 300px;
        padding: 100px 0 40px;
    }

    .project-title {
        font-size: 1.6rem !important;
        line-height: 1.3;
    }

    .project-location {
        font-size: 1rem;
        margin-bottom: 20px;
    }

    .hero-badges {
        gap: 8px;
    }

    .badge {
        padding: 6px 12px;
        font-size: 12px;
    }

    .hero-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .hero-contact-btns {
        flex-direction: column;
        width: 100%;
    }

    .hero-contact-btns .btn {
        width: 100%;
        justify-content: center;
    }

    /* Projects Grid - SINGLE COLUMN on phone */
    .projects-grid {
        grid-template-columns: 1fr !important;
        gap: 20px;
    }

    /* Project Cards */
    .project-card-image {
        height: 200px;
    }

    .project-card-content {
        padding: 20px;
    }

    .project-card-title {
        font-size: 1.2rem;
    }

    .project-card-price {
        font-size: 1.3rem;
    }

    .project-card-meta {
        gap: 10px;
    }

    /* Info Cards */
    .info-card {
        padding: 20px;
        margin-bottom: 20px;
    }

    .card-title {
        font-size: 1.2rem;
        margin-bottom: 15px;
        padding-bottom: 10px;
    }

    .card-title i {
        font-size: 20px;
    }

    /* Data Grid / Rows */
    .data-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
        padding: 12px 0;
    }

    .data-row .label {
        font-size: 13px;
    }

    .data-row .value {
        font-size: 15px;
    }

    /* Price Box */
    .price-box {
        padding: 20px;
    }

    .price-main {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .price-value {
        font-size: 1.8rem;
    }

    .discount-badge {
        font-size: 1rem;
        padding: 8px 14px;
    }

    .price-details {
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }

    .price-detail-value {
        font-size: 1.1rem;
    }

    /* Payment Plans */
    .plan-details {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    /* Developer Card */
    .dev-profile {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    /* Quick Info Bar / Grid */
    .quick-info-grid {
        grid-template-columns: 1fr 1fr !important;
    }

    .quick-info-item {
        padding: 15px;
    }

    .quick-info-item i {
        font-size: 22px;
    }

    .quick-info-item .value {
        font-size: 16px;
    }

    /* Section Padding */
    .section-padding {
        padding: 40px 0;
    }

    .section-title {
        font-size: 1.6rem;
    }

    .section-title::after {
        width: 60px;
        margin-top: 10px;
    }

    /* Buttons */
    .btn {
        padding: 12px 20px;
        font-size: 14px;
    }

    /* Gallery Grid */
    .gallery-grid,
    .project-gallery-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px;
    }

    /* Features Grid */
    .features-grid,
    .features-grid-enhanced {
        grid-template-columns: 1fr !important;
    }

    /* FAQs */
    .faq-accordion .faq-item {
        padding: 15px;
    }

    .faq-question {
        font-size: 1rem;
    }

    /* Footer adjustments */
    .footer-widgets {
        grid-template-columns: 1fr !important;
        gap: 30px;
    }

    /* Hero Quick Stats */
    .hero-quick-stats {
        gap: 20px;
        margin: 30px 0 20px;
    }

    .hero-quick-stats .stat-number {
        font-size: 1.8rem;
    }

    /* Glass Premium Search */
    .glass-premium {
        flex-direction: column;
        padding: 15px;
        gap: 10px;
    }

    .search-icon-wrapper {
        margin: 0;
    }

    .search-field {
        width: 100%;
        text-align: center;
    }

    .gradient-btn {
        width: 100%;
    }

    /* Premium Filters */
    .premium-filters {
        gap: 10px;
    }

    .premium-filter {
        padding: 8px 15px;
        font-size: 13px;
    }

    /* Scroll Indicator */
    .scroll-indicator {
        bottom: 15px;
    }

    /* Stats Bar */
    .project-stats-bar .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .stat-box {
        padding: 15px;
    }

    /* Content Card */
    .content-card {
        padding: 20px;
        margin-bottom: 20px;
    }

    .section-heading {
        font-size: 1.3rem;
    }

    /* Lead Form */
    .lead-form-card {
        padding: 20px;
    }

    /* Sticky Sidebar - Move to bottom */
    .sticky-sidebar {
        position: static !important;
    }

    /* Row Layout Fix - AGGRESSIVE */
    .row {
        margin-left: 0 !important;
        margin-right: 0 !important;
        max-width: 100% !important;
    }

    .col-lg-8,
    .col-lg-4,
    .col-md-6,
    .col-sm-12,
    [class*="col-"] {
        width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }

    /* Force all content to stay within screen */
    .project-body-content,
    .content-card,
    .entry-content {
        max-width: 100% !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }
}

/* ==========================================================================
   SMALL MOBILE BREAKPOINT (max-width: 480px)
   ========================================================================== */
@media (max-width: 480px) {

    /* Typography */
    html {
        font-size: 14px;
    }

    h1 {
        font-size: 1.6rem;
    }

    h2 {
        font-size: 1.4rem;
    }

    h3 {
        font-size: 1.2rem;
    }

    /* Container - tighter padding */
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }

    /* Hero adjustments */
    .single-project-hero {
        min-height: 350px;
        /* Increased height */
        padding: 50px 0;
        background-attachment: scroll;
        /* Fix for iOS */
        display: flex;
        align-items: center;
    }

    .hero-content-wrapper {
        padding-top: 20px;
    }

    .hero-title {
        font-size: 1.8rem;
        line-height: 1.3;
        margin-bottom: 15px;
    }

    .hero-badges {
        margin-bottom: 15px;
        gap: 10px;
    }

    .badge {
        font-size: 12px;
        padding: 6px 12px;
    }

    /* Stats Grid - 2 Columns (not stacked) */
    .project-stats-bar .stats-grid {
        grid-template-columns: 1fr 1fr !important;
        /* Force 2 columns */
        gap: 15px;
    }

    .stat-box {
        padding: 12px;
    }

    .stat-label {
        font-size: 12px;
    }

    .stat-value {
        font-size: 14px;
    }

    /* Quick Info - Single column on very small screens */
    .quick-info-grid {
        grid-template-columns: 1fr !important;
    }

    /* Gallery - Single column */
    .gallery-grid,
    .project-gallery-grid {
        grid-template-columns: 1fr !important;
    }

    /* Price Details - Stack */
    .price-details {
        grid-template-columns: 1fr;
    }

    /* Project Card */
    .project-card-image {
        height: 180px;
    }

    .project-card-content {
        padding: 15px;
    }

    /* Buttons - Full width */
    .btn {
        width: 100%;
        justify-content: center;
    }

    .quick-contact-btns {
        grid-template-columns: 1fr !important;
    }

    /* Hide floating buttons if sticky bar exists (assuming sticky bar is for mobile) */
    .floating-cta-buttons {
        display: none !important;
    }

    /* Add padding to body for sticky bar */
    body.single-project {
        padding-bottom: 80px;
    }
}

/* ==========================================================================
   ARCHIVE PAGES RESPONSIVENESS
   ========================================================================== */

/* NOTE: Base .archive-layout is defined in projects-archive.css and search-results.css */

/* Tablet Breakpoint (max-width: 1024px) */
@media (max-width: 1024px) {
    .archive-layout {
        grid-template-columns: 1fr 280px;
        gap: 30px;
    }

    .projects-grid-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

/* Mobile Breakpoint (max-width: 968px) - Sidebar moves to top/bottom */
@media (max-width: 968px) {
    .archive-layout {
        display: flex;
        flex-direction: column;
        gap: 30px;
    }

    #secondary.widget-area {
        width: 100%;
        order: -1;
        /* Sidebar on top for filtering */
    }

    /* Make filter widget collapsible or compact if needed */
    .project-filters-widget {
        position: static;
        margin-bottom: 0;
    }
}

/* Phone Breakpoint (max-width: 768px) */
@media (max-width: 768px) {
    .archive-layout {
        gap: 20px;
        margin: 20px auto;
    }

    .projects-grid-container {
        grid-template-columns: 1fr;
        /* Single column projects */
        gap: 20px;
    }

    .projects-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .archive-header {
        padding: 40px 20px;
    }

    .archive-title {
        font-size: 2rem;
    }

    .developers-archive-grid {
        grid-template-columns: 1fr !important;
    }

    /* Sidebar styling on mobile */
    .widget-area {
        padding-left: 0;
        padding-right: 0;
    }

    .project-filters-widget,
    .default-sidebar-widgets {
        position: static;
        margin-bottom: 20px;
    }
}

/* Small Phone Breakpoint (max-width: 480px) */
@media (max-width: 480px) {
    .archive-layout {
        gap: 15px;
    }

    .projects-grid-container {
        gap: 15px;
    }
}

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */
@media print {

    .site-header,
    .main-navigation,
    .mobile-menu-toggle,
    .header-cta,
    .lead-form-card,
    .quick-contact-btns,
    .social-share-buttons,
    .scroll-indicator,
    .btn-whatsapp,
    .btn-call {
        display: none !important;
    }

    body {
        font-size: 12pt;
        line-height: 1.5;
        color: #000;
        background: #fff;
    }

    .container {
        max-width: 100%;
        padding: 0;
    }
}