/* ================================================================
   Mobile Fix – Maxim Maintenance Solutions
   Targets: index.php and all other pages
   ================================================================ */

/* ── GLOBAL OVERFLOW GUARD ── */
html, body {
    overflow-x: hidden !important;
    max-width: 100% !important;
    position: relative;
    font-size: 15px; /* slightly smaller base text size for mobile */
}

img, video, iframe, embed, object {
    max-width: 100% !important;
    height: auto !important;
    object-fit: cover !important;
}

/* ── FLOATING PROFILE BAR WIDGET ── */
#floating-profile-bar {
    bottom: 20px !important;
    right: 15px !important;
    padding: 8px 12px !important;
    font-size: 13px !important;
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 480px) {
    #floating-profile-bar {
        bottom: 15px !important;
        right: 10px !important;
        padding: 6px 10px !important;
        font-size: 11px !important;
        max-width: 140px;
    }
    #profile-text {
        display: none; /* Hide text on very small screens, just show icon */
    }
    #floating-profile-bar a::after {
        content: " Profile";
        display: inline;
    }
}

/* ── MOBILE NAVBAR & NAVIGATION MENU ── */
@media (max-width: 768px) {
    .logo-img {
        height: 40px !important; /* Smaller logo in mobile header to prevent stretch */
    }
    .mobile-logo-img {
        max-width: 120px !important;
        height: auto !important;
        margin: 0 auto 15px !important;
        display: block !important;
    }
    .navbar {
        height: 60px !important;
    }
    .hamburger {
        width: 38px !important;
        height: 38px !important;
    }
    .nav-menu {
        padding: 85px 24px 30px !important;
        height: 100dvh !important;
        overflow-y: auto !important;
        gap: 4px !important;
    }
    .nav-link {
        font-size: 1.2rem !important;
        padding: 10px 0 !important;
    }
    .services-submenu,
    .projects-submenu {
        margin: 0 0 8px 0 !important;
        padding: 6px !important;
    }
    .services-submenu li a,
    .projects-submenu li a {
        padding: 8px 10px !important;
        font-size: 0.85rem !important;
    }
}

/* ── HERO SECTIONS (index.php and Subpages) ── */
@media (max-width: 768px) {
    /* Homepage Hero - Compact, auto-fitted & unstretched layout */
    .hero-section {
        height: auto !important;
        min-height: 85vh !important; /* Increased height for home hero */
        padding: 135px 15px 80px !important; /* Beautiful, snug padding fitting content perfectly */
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
    }

    .hero-content h1 {
        font-size: 1.5rem !important;
        min-height: auto !important;
        line-height: 1.25 !important;
        padding: 0 10px;
        margin-bottom: 12px !important;
    }

    .hero-content p {
        font-size: 0.9rem !important;
        margin-bottom: 15px !important;
        padding: 0 10px;
        line-height: 1.4 !important;
    }

    .hero-content .btn {
        padding: 10px 24px !important;
        font-size: 0.9rem !important;
    }

    /* Bottom Wave SVG Flattening - compressed curve height */
    .custom-shape-divider-bottom-1718624970 svg {
        height: 30px !important; /* Gentle subtle curve curve height */
    }

    /* About Page Blue Hero Section (.about-hero in ReadMore.php) */
    .about-hero {
        min-height: auto !important;
        height: auto !important;
        max-height: none !important;
        padding: 120px 16px 50px !important; /* Tight compact paddings on mobile */
    }

    /* Subpages Unified Hero (.subpage-hero, .careers-hero) - Ultra-tight height */
    .subpage-hero,
    .careers-hero {
        padding: 120px 1.5rem 2.5rem !important; /* Reduced height, compact and clean padding */
        min-height: auto !important;
        height: auto !important;
    }

    .subpage-hero .hero-title,
    .careers-hero h1 {
        font-size: 1.6rem !important;
        margin-bottom: 0.6rem !important;
    }

    .subpage-hero .hero-subtitle,
    .careers-hero p {
        font-size: 0.9rem !important;
        line-height: 1.35 !important;
        max-width: 100% !important;
    }

    /* Projects Page Hero (.hero-section in PRO.php) - Fully reduced */
    header.hero-section {
        height: auto !important;
        min-height: auto !important;
        padding: 120px 15px 40px !important;
    }

    header.hero-section .company-logo i {
        font-size: 2.2rem !important;
        margin-bottom: 0.4rem !important;
    }

    header.hero-section .company-logo h1 {
        font-size: 1.5rem !important;
    }

    header.hero-section .hero-subtitle {
        font-size: 0.9rem !important;
    }

    /* General Supplies Hero Container - Reduced */
    .hero-container {
        padding: 80px 15px 40px !important;
        min-height: auto !important;
        height: auto !important;
    }
}

/* ── FLOATING FEATURE BOXES (Stat Cards - 2x2 Grid) ── */
@media (max-width: 768px) {
    .floating-boxes-container-wrapper {
        margin-top: -20px !important;
    }

    .floating-boxes-container {
        grid-template-columns: 1fr 1fr !important; /* Strict 2x2 grid */
        gap: 10px !important;
        padding: 0 10px 15px !important;
    }

    .flippable-box {
        height: 185px !important; /* Proportional card height designed to avoid squashing text */
    }

    .flippable-box-front,
    .flippable-box-back {
        padding: 10px 6px !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
    }

    .flippable-box-front .flippable-box-icon,
    .flippable-box-front .box-icon {
        width: 30px !important;
        height: 30px !important;
        margin-bottom: 6px !important;
    }

    .flippable-box h4 {
        font-size: 0.8rem !important;
        margin-bottom: 4px !important;
        font-weight: 700 !important;
        line-height: 1.2 !important;
        color: #fff !important;
    }

    .flippable-box-front p {
        font-size: 0.7rem !important;
        line-height: 1.2 !important;
        color: #e2e8f0 !important;
    }

    .flippable-box-back p {
        font-size: 0.65rem !important;
        line-height: 1.25 !important;
        margin-bottom: 6px !important;
        color: #fff !important;
    }
    
    .flippable-box-back .btn {
        padding: 4px 8px !important;
        font-size: 0.62rem !important;
        min-height: auto !important;
        line-height: 1 !important;
    }
}

@media (max-width: 480px) {
    .floating-boxes-container {
        grid-template-columns: 1fr 1fr !important; /* Keep 2x2 grid on all mobile sizes */
    }
}

/* ── STATS GRID (2x2 Grid) ── */
@media (max-width: 768px) {
    /* Homepage stat items */
    .stats-grid, .hero-stats {
        grid-template-columns: 1fr 1fr !important; /* Force 2x2 grid */
        gap: 12px !important;
        padding: 0 10px !important;
    }

    .stat-item {
        padding: 10px !important;
    }

    .stat-number {
        font-size: 1.8rem !important;
    }

    .stat-label {
        font-size: 0.8rem !important;
    }

    /* About/ReadMore Page Stats Section (150+, 500k+, 100%, 24/7) */
    .stats-container {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important; /* Strict 2 column 2 row grid */
        gap: 1.5rem !important; /* Beautiful 1.5rem spacing */
        max-width: 100% !important;
        padding: 0 16px !important;
    }

    .stat-box h5 {
        font-size: 2.2rem !important; /* Proportional elegant sizes */
        margin-bottom: 0.3rem !important;
    }

    .stat-box p {
        font-size: 0.75rem !important;
        letter-spacing: 1px !important;
        opacity: 0.8 !important;
    }
}

@media (max-width: 480px) {
    .stats-grid, .hero-stats {
        grid-template-columns: 1fr 1fr !important; /* Strict 2x2 grid on smallest mobile */
    }
    .stats-container {
        grid-template-columns: 1fr 1fr !important;
    }
}

/* ── SERVICES GRID (Comprehensive Solutions - 2x2 Grid) ── */
@media (max-width: 768px) {
    .services-grid {
        grid-template-columns: 1fr 1fr !important; /* Force beautiful 2x2 layout on mobile */
        gap: 15px !important;
        padding: 0 10px !important;
    }

    .service-card {
        padding: 20px 15px !important; /* Elegant breathing room */
        min-height: 250px !important; /* Aligned heights to prevent uneven squeezing */
        display: flex !important;
        flex-direction: column !important;
        justify-content: space-between !important;
        box-shadow: 0 4px 15px rgba(0,0,0,0.03) !important;
    }

    .service-card .service-icon {
        width: 50px !important;
        height: 50px !important;
        border-radius: 14px !important;
        margin-bottom: 15px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .service-card .service-icon i {
        font-size: 1.4rem !important;
    }

    .service-card h3.service-title {
        font-size: 1.05rem !important;
        margin-bottom: 8px !important;
        font-weight: 700 !important;
        line-height: 1.25 !important;
    }

    .service-card p.service-description {
        font-size: 0.78rem !important;
        line-height: 1.4 !important;
        margin-bottom: 15px !important;
        color: #64748b !important;
        flex-grow: 1 !important;
    }

    .service-card .service-link {
        font-size: 0.8rem !important;
        display: inline-flex !important;
        align-items: center !important;
        gap: 6px !important;
    }
}

@media (max-width: 480px) {
    .services-grid {
        grid-template-columns: 1fr 1fr !important; /* Keep 2x2 even on smaller smartphones */
        gap: 10px !important;
    }
    .service-card {
        padding: 15px 10px !important;
        min-height: 235px !important;
    }
    .service-card h3.service-title {
        font-size: 0.92rem !important;
    }
}

/* ── ANIMATED TEAM SECTION (Well-Structured Text Alignment) ── */
@media (max-width: 768px) {
    .team-highlight {
        padding: 50px 15px !important;
    }
    
    .team-highlight h2 {
        font-size: 1.8rem !important;
        line-height: 1.3 !important;
    }
    
    .team-highlight p {
        font-size: 0.88rem !important;
        line-height: 1.6 !important;
        text-align: justify !important; /* Elegant justify alignments */
        text-align-last: center !important; /* Perfect transition center point for the CTA */
        padding: 0 12px !important;
        margin-bottom: 25px !important;
        max-width: 100% !important;
    }
}

/* ── PROJECTS IMAGE GALLERY GRID (2x2 Grid) ── */
@media (max-width: 768px) {
    .image-grid {
        grid-template-columns: 1fr 1fr !important; /* 2x2 Grid for gallery images */
        gap: 10px !important;
        margin-bottom: 1.5rem !important;
    }

    .image-item img {
        height: 130px !important; /* Scale down preview heights so they aren't stretched */
        width: 100% !important;
        object-fit: cover !important;
    }
}

/* ── SERVICE DETAIL PAGE ITEMS ── */
@media (max-width: 768px) {
    .service-item {
        flex-direction: column !important;
        padding: 15px !important;
        gap: 10px !important;
    }

    .service-item-image-container {
        width: 100% !important;
        height: 160px !important;
        margin-right: 0 !important;
        margin-bottom: 10px !important;
    }

    .service-item h4 {
        font-size: 1.15rem !important;
    }

    .service-item p {
        font-size: 0.88rem !important;
        line-height: 1.5 !important;
    }
}

/* ── PROJECTS PREVIEW (Enlarged Proportional Showcase - 1x1 Grid) ── */
@media (max-width: 768px) {
    .projects-preview-grid {
        grid-template-columns: 1fr !important; /* 1x1 Grid for projects showcase preview */
        gap: 15px !important;
    }

    .project-preview-item {
        height: 250px !important; /* Increased height so preview cards look larger, clearer, and premium */
    }
    
    .project-preview-info h3 {
        font-size: 1.1rem !important;
    }
}

/* ── ABOUT SECTION ── */
@media (max-width: 768px) {
    .about-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }

    .about-image img {
        height: 200px !important;
        width: 100% !important;
        object-fit: cover !important;
    }

    .about-text {
        text-align: center !important;
    }
}

/* ── HEAVY MACHINERY & CODED WELDERS ── */
@media (max-width: 768px) {
    .machinery-grid,
    .coded-welders-content {
        grid-template-columns: 1fr !important;
        gap: 1.2rem !important;
    }

    .machinery-image img,
    .welders-image img {
        height: 180px !important;
        width: 100% !important;
        object-fit: cover !important;
    }
}

/* ── FOOTER SECTION (Compact reduced height 2x2 Grid) ── */
@media (max-width: 768px) {
    .footer {
        padding: 25px 15px 15px !important; /* Substantially reduced footer height */
    }

    .footer-grid, .footer-content {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important; /* Beautiful 2x2 grid */
        text-align: left !important;
        gap: 12px !important; /* Tight spacing to keep height minimal */
        padding: 0 5px !important;
    }

    .footer-col:first-child, .footer-logo-section {
        grid-column: span 2 !important; /* Logo spans both columns for style */
        text-align: center !important;
        margin-bottom: 8px !important;
    }
    
    .footer-col:first-child .footer-description {
        font-size: 0.8rem !important;
        line-height: 1.4 !important;
        margin-bottom: 10px !important;
    }

    .footer-logo-img, .footer-logo-text {
        font-size: 1.5rem !important;
        height: 38px !important;
        margin-bottom: 6px !important;
    }

    .social-links, .footer-socials {
        text-align: center !important;
        margin-top: 8px !important;
        display: flex !important;
        justify-content: center !important;
        gap: 15px !important;
    }

    .footer-title,
    .footer-links h4,
    .footer-contact h4,
    .footer-socials h4 {
        font-size: 0.95rem !important;
        margin-bottom: 8px !important;
    }

    .footer-link,
    .contact-link,
    .contact-label,
    .footer-links a,
    .footer-contact p {
        font-size: 0.78rem !important;
        line-height: 1.35 !important;
    }
    
    .contact-item {
        margin-bottom: 10px !important;
        display: flex !important;
        align-items: flex-start !important;
        gap: 8px !important;
    }
}

/* ── CAREERS PAGE FIXES ── */
@media (max-width: 768px) {
    /* Fix hero stretch */
    .careers-hero {
        padding: 120px 15px 40px !important;
        min-height: auto !important;
        height: auto !important;
    }

    .careers-hero .hero-title {
        font-size: 2.2rem !important;
        line-height: 1.2 !important;
        margin-bottom: 10px !important;
    }
    
    .careers-hero .hero-description {
        font-size: 0.9rem !important;
        margin-bottom: 15px !important;
        line-height: 1.4 !important;
    }

    /* Make stats banner horizontal */
    .stats-banner {
        flex-direction: row !important;
        gap: 10px !important;
        padding: 15px 10px !important;
        border-radius: 15px !important;
        margin-top: -30px !important;
        align-items: center !important;
    }
    
    .stats-banner .stat-item {
        border-bottom: none !important;
        border-right: 1px solid #e2e8f0 !important;
        padding-bottom: 0 !important;
        width: auto !important;
        flex: 1 !important;
    }
    
    .stats-banner .stat-item:last-child {
        border-right: none !important;
    }
    
    .stats-banner .stat-value {
        font-size: 1.2rem !important;
    }
    
    .stats-banner .stat-label {
        font-size: 0.65rem !important;
    }
    
    /* Fix opportunities section stretching */
    .openings-section {
        padding: 40px 0 !important;
    }
    
    .job-card {
        padding: 20px !important;
        min-height: auto !important;
        height: auto !important;
    }
    
    .job-title {
        font-size: 1.2rem !important;
        margin-bottom: 10px !important;
    }
    
    .job-meta {
        margin-bottom: 15px !important;
        flex-wrap: wrap !important;
        gap: 10px !important;
    }
    
    .job-description {
        font-size: 0.85rem !important;
        margin-bottom: 20px !important;
        line-height: 1.5 !important;
    }
    
    .apply-btn {
        padding: 10px 20px !important;
        font-size: 0.9rem !important;
    }
}
