/* ═══════════════════════════════════════════════════
   AISMISR — Mobile Responsive (project_manager1 pattern)
   ═══════════════════════════════════════════════════ */

:root {
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --bottom-nav-h: 64px;
}

@media all and (display-mode: standalone) {
    body {
        padding-top: var(--safe-top);
    }
}

/* ══════════════════════════════════════════════════
   MOBILE LAYOUT (max-width: 1024px)
   ══════════════════════════════════════════════════ */
@media (max-width: 1024px) {
    body {
        padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom));
    }

    body.mobile-nav-open {
        overflow: hidden;
    }

    body.mobile-nav-open #mobileBottomNav {
        display: none;
    }

    .container {
        padding-left: max(16px, var(--safe-left));
        padding-right: max(16px, var(--safe-right));
    }

    /* ── Bottom Navigation ── */
    #mobileBottomNav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 8998;
        height: calc(var(--bottom-nav-h) + var(--safe-bottom));
        padding-bottom: var(--safe-bottom);
        background: var(--bg-card);
        border-top: 1px solid var(--border);
        display: flex;
        align-items: stretch;
        justify-content: space-around;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    }

    #mobileBottomNav a,
    #mobileBottomNav button {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        padding: 8px 4px;
        color: var(--text-muted);
        font-size: 10px;
        font-weight: 700;
        font-family: var(--font-main);
        text-decoration: none;
        background: none;
        border: none;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        min-height: 44px;
    }

    #mobileBottomNav a.active,
    #mobileBottomNav button.active {
        color: var(--cyan);
    }

    #mobileBottomNav .mobile-nav-icon {
        font-size: 1.25rem;
        line-height: 1;
    }

    /* ── Hero & sections ── */
    .hero {
        min-height: 100svh;
        padding-top: calc(64px + var(--safe-top));
        padding-bottom: 32px;
    }

    .hero-title {
        font-size: clamp(1.75rem, 8vw, 2.4rem);
        line-height: 1.25;
    }

    .hero-desc {
        font-size: 0.95rem;
    }

    .section-title {
        font-size: clamp(1.45rem, 6vw, 1.85rem);
    }

    .section-header {
        margin-bottom: 40px;
    }

    .about-metrics {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .clients-section {
        padding: 40px 0;
    }

    .page-hero,
    .page-hero-image {
        min-height: auto;
        padding-top: calc(80px + var(--safe-top));
        padding-bottom: 48px;
    }

    .page-hero-image {
        min-height: 320px;
    }

    .careers,
    .careers-positions,
    .careers-apply {
        overflow-x: clip;
    }

    .careers .container,
    .careers-positions .container,
    .careers-apply .container {
        min-width: 0;
    }

    .contact-form-wrap {
        padding: 24px 16px;
        max-width: 100%;
        min-width: 0;
    }

    /* ── Forms (iOS zoom fix) ── */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="password"],
    input[type="search"],
    select,
    textarea {
        font-size: 16px !important;
    }

    button,
    .btn,
    [type="submit"],
    [type="button"] {
        min-height: 44px;
    }

    .phone-input-group {
        flex-direction: column;
    }

    .country-code-select {
        flex: none;
        width: 100%;
    }

    /* ── Modals ── */
    .modal-dialog {
        width: calc(100vw - 24px);
        max-width: calc(100vw - 24px);
        max-height: calc(100vh - 32px - var(--safe-top) - var(--safe-bottom));
        overflow-y: auto;
        margin: 16px 12px;
        padding: 24px 18px;
    }

    .modal-overlay {
        padding: var(--safe-top) 0 var(--safe-bottom);
        align-items: flex-start;
    }

    .eid-popup {
        align-items: center;
        padding: max(12px, var(--safe-top)) 10px max(12px, var(--safe-bottom));
    }

    .eid-popup-dialog {
        width: min(calc(100vw - 20px), 420px);
        max-width: min(calc(100vw - 20px), 420px);
        max-height: calc(100vh - 24px - var(--safe-top) - var(--safe-bottom));
        margin: 0;
        overflow-y: auto;
    }

    .eid-popup-footer {
        padding: 12px 14px 14px;
    }

    .eid-popup--en .eid-popup-close {
        left: auto;
        right: 10px;
    }

    .eid-popup-btn {
        width: 100%;
        min-width: 0;
    }

    .eid-popup-close {
        top: 10px;
        left: 10px;
        width: 36px;
        height: 36px;
        font-size: 1.35rem;
    }

    /* ── Float actions above bottom nav ── */
    .float-actions {
        bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 12px);
        left: max(16px, var(--safe-left));
        gap: 10px;
    }

    .scroll-top {
        bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 12px);
        left: max(16px, var(--safe-left));
    }

    .whatsapp-float {
        bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 12px);
        left: max(16px, var(--safe-left));
    }

    .footer {
        padding-bottom: 24px;
    }

    .cta-card {
        padding: 32px 20px;
    }

    .blog-grid,
    .services-grid {
        grid-template-columns: 1fr !important;
    }

    .hidden-mobile {
        display: none !important;
    }
}

@media (min-width: 1025px) {
    #mobileBottomNav,
    .mobile-backdrop,
    .nav-mobile-cta {
        display: none !important;
    }
}

@media (max-width: 480px) {
    :root {
        --section-py: 52px;
    }

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

    .hero-stats {
        flex-wrap: wrap;
        justify-content: center;
        gap: 16px;
    }

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

    .contact-form-wrap {
        padding: 20px 16px;
    }

    .form-thank-you {
        padding: 32px 20px;
    }

    .contact-map-wrap {
        aspect-ratio: 4 / 3;
        min-height: 240px;
    }

    .service-card-img,
    .project-card-img,
    .blog-card-img {
        height: 180px;
    }
}

@media (max-width: 380px) {
    #mobileBottomNav {
        font-size: 9px;
    }

    #mobileBottomNav .mobile-nav-icon {
        font-size: 1.1rem;
    }
}

@media (hover: none) and (pointer: coarse) {
    * {
        -webkit-tap-highlight-color: rgba(0, 212, 232, 0.12);
    }

    ::-webkit-scrollbar {
        width: 0;
        height: 0;
    }
}

/* ── PWA install banner ── */
#pwaInstallBanner {
    position: fixed;
    z-index: 9010;
    background: linear-gradient(135deg, #00b5c8, #008fa0);
    border-radius: 16px;
    padding: 14px 16px;
    display: none;
    align-items: flex-start;
    gap: 12px;
    box-shadow: 0 8px 30px rgba(0, 181, 200, 0.35);
    color: #fff;
}

#pwaInstallBanner.show {
    display: flex;
}

#pwaInstallBanner .pwa-install-icon img {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.2);
    display: block;
}

#pwaInstallBanner .pwa-install-body {
    flex: 1;
    min-width: 0;
}

#pwaInstallBanner .pwa-install-body h4 {
    font-size: 14px;
    font-weight: 800;
    margin: 0 0 2px;
}

#pwaInstallBanner .pwa-install-body p {
    font-size: 11px;
    opacity: 0.9;
    margin: 0;
    line-height: 1.5;
}

#pwaInstallBanner .pwa-install-hint {
    margin-top: 8px !important;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    font-size: 11px !important;
    line-height: 1.65 !important;
    opacity: 1 !important;
}

#pwaInstallBanner .pwa-install-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

#pwaInstallBanner .pwa-btn-install,
#pwaInstallBanner .pwa-btn-dismiss {
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font-main);
}

#pwaInstallBanner .pwa-btn-install {
    background: #fff;
    color: #008fa0;
}

#pwaInstallBanner .pwa-btn-dismiss {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

@media (max-width: 1024px) {
    #pwaInstallBanner {
        bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 8px);
        left: 12px;
        right: 12px;
    }
}

@media (min-width: 1025px) {
    #pwaInstallBanner {
        bottom: 24px;
        left: auto;
        right: 24px;
        max-width: 380px;
    }
}
