/**
 * mobile-responsive.css
 * Global mobile optimization, off-canvas navigation drawer, and overflow prevention
 */

/* 1. Viewport & Overflow Safety */
html, body {
    max-width: 100%;
    overflow-x: hidden !important;
    top: 0px !important;
    margin-top: 0px !important;
}

.goog-te-banner-frame,
.goog-te-banner-frame.skiptranslate,
iframe.goog-te-banner-frame,
.goog-te-banner,
.skiptranslate > iframe,
iframe[id*=":1.container"],
iframe[id*=":2.container"],
iframe[src*="translate.google"],
#goog-gt-tt,
.goog-te-balloon-frame {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    width: 0 !important;
}

.skiptranslate {
    display: none !important;
}

*, *::before, *::after {
    box-sizing: border-box;
}

img, svg, video {
    max-width: 100%;
    height: auto;
}

/* 2. Responsive Table Wrapper */
.table-responsive-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1.5rem;
    border-radius: 16px;
}

/* 3. Mobile Header & Hamburger Toggle */
.mobile-nav-toggle {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: #ffffff;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.mobile-nav-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.site-header.scrolled .mobile-nav-toggle {
    color: #020617;
}

@media (max-width: 991px) {
    .site-header nav,
    .desktop-nav,
    .nav-links,
    nav.d-none,
    nav.d-lg-block {
        display: none !important;
    }
    
    .mobile-nav-toggle {
        display: inline-flex !important;
    }
    
    .nav-container {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        height: 56px !important;
        padding: 0 16px !important;
        max-width: 100% !important;
    }
    
    .nav-actions {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
    }

    .nav-actions .btn-primary {
        padding: 6px 12px !important;
        font-size: 0.8rem !important;
    }
    
    .site-header {
        padding: 6px 0 !important;
        background: rgba(7, 14, 24, 0.98) !important;
        backdrop-filter: blur(12px) !important;
        -webkit-backdrop-filter: blur(12px) !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    }
    
    .logo img {
        height: 36px !important;
        max-width: 130px !important;
    }
}

@media (max-width: 576px) {
    .nav-actions .btn-primary {
        display: none !important; /* Hide quote button on tiny screens to preserve logo and drawer button */
    }
    .mobile-drawer-quote-btn {
        display: block !important;
    }
}

/* 4. Off-Canvas Mobile Navigation Drawer */
.mobile-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(2, 6, 23, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

.mobile-drawer {
    position: fixed;
    top: 0;
    right: -100%;
    width: 88%;
    max-width: 380px;
    height: 100%;
    background: #0b192c;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5);
    transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    border-left: 1px solid rgba(0, 174, 239, 0.2);
    overflow-y: auto;
}

.mobile-drawer.active {
    right: 0;
}

.mobile-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: #070e18;
}

.mobile-drawer-close {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font-size: 1.5rem;
    line-height: 1;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-drawer-close:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

.mobile-drawer-body {
    flex: 1;
    padding: 1.25rem 1.5rem;
    overflow-y: auto;
}

.mobile-menu-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.mobile-menu-item > a,
.mobile-menu-item > .mobile-accordion-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    color: #e2e8f0;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 12px;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-menu-item > a:hover,
.mobile-menu-item > .mobile-accordion-toggle:hover,
.mobile-menu-item.active > .mobile-accordion-toggle {
    background: rgba(0, 174, 239, 0.12);
    color: #00aef0;
}

.mobile-accordion-toggle svg {
    transition: transform 0.3s ease;
    color: #94a3b8;
}

.mobile-menu-item.open > .mobile-accordion-toggle svg {
    transform: rotate(180deg);
    color: #00aef0;
}

.mobile-submenu {
    list-style: none;
    padding: 0.35rem 0 0.5rem 1.25rem;
    margin: 0;
    display: none;
    flex-direction: column;
    gap: 0.25rem;
    border-left: 2px solid rgba(0, 174, 239, 0.25);
    margin-left: 1rem;
    margin-top: 0.25rem;
}

.mobile-menu-item.open > .mobile-submenu {
    display: flex;
}

.mobile-submenu a {
    display: block;
    padding: 0.55rem 0.85rem;
    color: #94a3b8;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.mobile-submenu a:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
    padding-left: 1.1rem;
}

.mobile-drawer-footer {
    padding: 1.5rem;
    background: #070e18;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* 5. Mobile Chatbot & Modal Optimizations */
@media (max-width: 576px) {
    #chatbot-window {
        right: 0 !important;
        left: auto !important;
        bottom: 74px !important;
        width: calc(100vw - 32px) !important;
        max-width: 380px !important;
        height: 72vh !important;
        max-height: 520px !important;
    }
    #chatbot-toggle {
        width: 56px !important;
        height: 56px !important;
    }
}

/* 6. Typography & Hero Adaptations */
@media (max-width: 768px) {
    .huge-title {
        font-size: 2.3rem !important;
        line-height: 1.15 !important;
        letter-spacing: -1px !important;
    }
    
    .large-title {
        font-size: 1.9rem !important;
        line-height: 1.2 !important;
    }

    .medium-title {
        font-size: 1.6rem !important;
        line-height: 1.25 !important;
    }

    .subtitle {
        font-size: 1.05rem !important;
        line-height: 1.5 !important;
    }

    .section-padding {
        padding: 4.5rem 0 !important;
    }

    .py-24 {
        padding-top: 4rem !important;
        padding-bottom: 4rem !important;
    }

    .py-16 {
        padding-top: 3rem !important;
        padding-bottom: 3rem !important;
    }
}

/* 7. Grid & Flex Breakpoints on Mobile */
@media (max-width: 991px) {
    .contact-grid,
    .two-col-grid {
        grid-template-columns: 1fr !important;
        gap: 2.5rem !important;
    }
}

@media (max-width: 768px) {
    /* Responsive forms */
    .form-grid-2col {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    /* Footer responsiveness */
    .footer-bottom-bar {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        gap: 1.25rem !important;
        padding-right: 0 !important;
    }
    
    .footer-legal-links {
        justify-content: center !important;
        flex-wrap: wrap !important;
    }
    
    /* Pre-footer Call to Action */
    .featured-prefooter .container > div {
        padding: 2.5rem 1.5rem !important;
    }

    /* Comparison tables horizontal scroll container */
    table {
        min-width: 600px;
    }

    /* Universal mobile grid and card overrides */
    .two-col-grid,
    .three-col-grid,
    .four-col-grid,
    .cards-grid,
    .services-grid,
    .features-grid,
    .industries-grid,
    .testimonials-grid,
    .values-grid,
    .process-grid,
    .leaders-grid {
        grid-template-columns: 1fr !important;
        gap: 1.25rem !important;
    }

    .metrics-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1.5rem 1rem !important;
    }

    [style*="repeat(auto-fit, minmax"],
    [style*="repeat(auto-fill, minmax"] {
        grid-template-columns: 1fr !important;
    }

    .light-card,
    .pillar-card,
    .service-bento-card {
        padding: 1.5rem 1.25rem !important;
        border-radius: 16px !important;
    }

    .container {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
        max-width: 100% !important;
    }

    section {
        overflow-x: hidden !important;
    }

    .section-padding {
        padding: 3.5rem 0 !important;
    }
}

@media (max-width: 480px) {
    .metrics-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
}

/* 8. Global Table Container Mobile Fix */
table {
    max-width: 100%;
}
@media (max-width: 768px) {
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* 9. Multi-Language & Spanish Translation Layout Guards */
html.translated-ltr, html.translated-rtl {
    margin-top: 0px !important;
    top: 0px !important;
}
body.translated-ltr, body.translated-rtl {
    top: 0px !important;
    margin-top: 0px !important;
    position: static !important;
}
.translated-ltr .site-header, .translated-rtl .site-header {
    top: 0 !important;
}
.translated-ltr button, .translated-rtl button,
.translated-ltr a, .translated-rtl a {
    word-break: normal;
    overflow-wrap: break-word;
}
.translated-ltr .huge-title, .translated-rtl .huge-title {
    hyphens: auto;
}

/* 10. Gallery & Media Responsive System */
@media (max-width: 991px) {
    .albums-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1.25rem !important;
    }
    .photos-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 1rem !important;
    }
}

@media (max-width: 768px) {
    .gallery-hero {
        padding: 5.5rem 1rem 2.5rem !important;
    }
    .gallery-main-section {
        padding: 2.5rem 0 !important;
    }
    .albums-grid {
        grid-template-columns: 1fr !important;
        gap: 1.15rem !important;
        margin-bottom: 3rem !important;
    }
    .album-img-wrap {
        height: 190px !important;
    }
    .gallery-tabs-wrap {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        justify-content: flex-start !important;
        padding: 4px 6px 14px 6px !important;
        margin-bottom: 1.5rem !important;
        gap: 8px !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
    }
    .gallery-tabs-wrap::-webkit-scrollbar {
        display: none !important;
    }
    .gallery-tab-btn {
        flex-shrink: 0 !important;
        white-space: nowrap !important;
        padding: 7px 14px !important;
        font-size: 0.84rem !important;
    }
    .photos-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.65rem !important;
        margin-bottom: 3rem !important;
    }
    .photo-item {
        height: 170px !important;
        border-radius: 10px !important;
    }
    .photo-overlay {
        opacity: 1 !important;
        background: linear-gradient(to top, rgba(7, 14, 24, 0.9) 0%, rgba(7, 14, 24, 0.3) 50%, transparent 80%) !important;
        padding: 0.7rem 0.6rem !important;
    }
    .photo-cat-badge {
        font-size: 0.62rem !important;
        margin-bottom: 2px !important;
    }
    .photo-title {
        font-size: 0.78rem !important;
        line-height: 1.25 !important;
    }
    .photo-zoom-icon {
        display: none !important;
    }
    .gallery-bottom-cta {
        margin-top: 3rem !important;
        padding: 2.25rem 1.25rem !important;
        border-radius: 16px !important;
    }
}

/* ==========================================================================
   10. Quote Iframe Modal Overhaul (Desktop & Mobile)
   ========================================================================== */
#quoteModal.quote-modal-backdrop,
#quoteModal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(8, 17, 34, 0.85) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    z-index: 999999 !important; /* Above chatbot (10000) and all headers */
    align-items: center !important;
    justify-content: center !important;
    padding: 20px !important;
    box-sizing: border-box !important;
}

#quoteModal .quote-modal-dialog,
#quoteModal > div {
    background: #ffffff !important;
    width: 95% !important;
    max-width: 920px !important;
    height: 88vh !important;
    max-height: 720px !important;
    min-height: 520px !important;
    border-radius: 20px !important;
    position: relative !important;
    overflow: hidden !important;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.15) !important;
    display: flex !important;
    flex-direction: column !important;
    animation: quoteModalFadeUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.quote-modal-header {
    padding: 0.85rem 1.4rem !important;
    background: linear-gradient(135deg, #071527 0%, #0d2744 100%) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex-shrink: 0 !important;
    z-index: 3 !important;
}

.quote-modal-title-wrap {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
}

.quote-modal-icon {
    width: 34px !important;
    height: 34px !important;
    border-radius: 10px !important;
    background: linear-gradient(135deg, #00AEEF 0%, #0077b6 100%) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(0, 174, 239, 0.35) !important;
    flex-shrink: 0 !important;
}

.quote-modal-title {
    margin: 0 !important;
    font-size: 1.05rem !important;
    font-weight: 700 !important;
    color: #ffffff !important;
    line-height: 1.2 !important;
}

.quote-modal-sub {
    font-size: 0.74rem !important;
    color: #38bdf8 !important;
    font-weight: 500 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    margin-top: 2px !important;
}

.quote-modal-ext-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: #e0f2fe !important;
    font-size: 0.78rem !important;
    font-weight: 600 !important;
    padding: 6px 12px !important;
    border-radius: 100px !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
    white-space: nowrap !important;
}
.quote-modal-ext-btn:hover {
    background: rgba(0, 174, 239, 0.3) !important;
    border-color: #00AEEF !important;
    color: #ffffff !important;
}

.quote-modal-close {
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    background: rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
    font-size: 1.4rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    line-height: 1 !important;
    padding: 0 !important;
}

.quote-modal-close:hover {
    background: rgba(255, 255, 255, 0.22) !important;
    transform: scale(1.05) !important;
}

.quote-modal-body {
    flex: 1 !important;
    min-height: 0 !important;
    position: relative !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    background: #ffffff !important;
    -webkit-overflow-scrolling: touch !important;
}

.quote-modal-body iframe,
#quoteModal iframe {
    width: 100% !important;
    height: 100% !important;
    min-height: 520px !important;
    border: none !important;
    display: block !important;
    background: #ffffff !important;
}

.quote-modal-loader {
    position: absolute !important;
    inset: 0 !important;
    background: #ffffff !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 12px !important;
    z-index: 2 !important;
    transition: opacity 0.3s ease !important;
}

.quote-loader-spinner {
    width: 38px !important;
    height: 38px !important;
    border: 3px solid rgba(0, 174, 239, 0.18) !important;
    border-top-color: #00AEEF !important;
    border-radius: 50% !important;
    animation: quoteSpin 0.75s linear infinite !important;
}

.quote-modal-loader span {
    font-size: 0.88rem !important;
    font-weight: 600 !important;
    color: #475569 !important;
    font-family: inherit !important;
}

/* Ensure Chatbot is completely hidden and inaccessible while Quote Modal is open */
body.quote-modal-active #rocket-chatbot-wrapper {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

@keyframes quoteSpin {
    to { transform: rotate(360deg); }
}

@keyframes quoteModalFadeUp {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(14px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Mobile & Tablet Full-Screen Experience (No dark borders, No clipping, Full phone viewport) */
@media (max-width: 768px) {
    #quoteModal.quote-modal-backdrop,
    #quoteModal {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        padding: 0 !important;
        margin: 0 !important;
        border-radius: 0 !important;
        background: #071527 !important;
        align-items: stretch !important;
        justify-content: flex-start !important;
        z-index: 999999 !important;
        overflow: hidden !important;
    }

    #quoteModal .quote-modal-dialog,
    #quoteModal > div {
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        max-height: 100vh !important;
        max-height: 100dvh !important;
        min-height: 100vh !important;
        min-height: 100dvh !important;
        border-radius: 0 !important;
        border: none !important;
        box-shadow: none !important;
        margin: 0 !important;
        padding: 0 !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .quote-modal-header {
        height: 52px !important;
        min-height: 52px !important;
        max-height: 52px !important;
        padding: 0 12px !important;
        border-radius: 0 !important;
        flex-shrink: 0 !important;
    }

    .quote-modal-icon {
        width: 28px !important;
        height: 28px !important;
        border-radius: 8px !important;
    }
    .quote-modal-icon svg {
        width: 15px !important;
        height: 15px !important;
    }

    .quote-modal-title {
        font-size: 0.95rem !important;
    }

    .quote-modal-sub {
        display: none !important; /* Hide subtitle on small mobile to maximize space */
    }

    .quote-modal-ext-btn {
        padding: 5px 9px !important;
        font-size: 0.74rem !important;
    }

    .quote-modal-close {
        width: 32px !important;
        height: 32px !important;
        font-size: 1.25rem !important;
    }

    .quote-modal-body {
        flex: 1 !important;
        width: 100vw !important;
        height: calc(100vh - 52px) !important;
        height: calc(100dvh - 52px) !important;
        position: relative !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        background: #ffffff !important;
    }

    .quote-modal-body iframe,
    #quoteModal iframe {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        min-height: 100% !important;
        display: block !important;
        border: none !important;
        background: #ffffff !important;
    }
}
