﻿@media (max-width: 900px) {
    html,
    body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        background: #fff;
    }

    body {
        color: #10243b;
        font-size: 14px;
        line-height: 1.58;
        -webkit-text-size-adjust: 100%;
    }

    img,
    video,
    iframe {
        max-width: 100%;
    }

    .container {
        width: min(100% - 28px, 720px);
    }

    .site-header {
        height: 64px;
        border-bottom: 1px solid #e4ebf1;
        box-shadow: 0 6px 22px rgba(8, 43, 80, .08);
    }

    .nav-wrap {
        gap: 12px;
    }

    .brand {
        min-width: 0;
        max-width: calc(100% - 58px);
    }

    .brand-mark {
        margin-right: 8px;
        font-size: 30px;
        line-height: 1;
    }

    .brand-logo-img {
        height: 36px;
        max-width: 136px;
        margin-right: 8px;
    }

    .brand b {
        display: block;
        font-size: 18px;
        line-height: 1.08;
        white-space: nowrap;
    }

    .brand small {
        display: block;
        max-width: 145px;
        margin-top: 4px;
        overflow: hidden;
        color: #53677a;
        font-size: 7px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .menu-btn {
        display: grid;
        place-items: center;
        width: 44px;
        height: 44px;
        margin-left: auto;
        border-radius: 10px;
        color: #10243b;
    }

    .main-nav {
        top: 64px;
        max-height: calc(100vh - 64px);
        overflow-y: auto;
        padding: 8px 14px 14px;
        border-bottom: 1px solid #e4ebf1;
    }

    .main-nav a {
        min-height: 42px;
        padding: 10px 12px;
        border-radius: 8px;
        font-size: 13px;
    }

    .main-nav a.active,
    .main-nav a:hover {
        background: #f2f6f9;
    }

    .section,
    .home-category-section,
    .home-products,
    .home-usecases,
    .home-realwork,
    .blog-index-section,
    .article-reading-section,
    .catalog-section,
    .product-description-section,
    .related-products,
    .accessory-upsell,
    .product-reviews {
        padding: 30px 0;
    }

    .page-hero,
    .page-hero.compact,
    .catalog-head,
    .article-header,
    .article-hero {
        padding: 22px 0 18px;
        background: #f3f7fa;
    }

    .breadcrumb {
        margin-bottom: 8px;
        font-size: 11px;
        line-height: 1.4;
    }

    .eyebrow {
        margin-bottom: 6px;
        font-size: 10px;
        letter-spacing: .08em;
    }

    .hero h1,
    .page-hero h1,
    .catalog-head h1,
    .shop-intro h1,
    .home-hero-copy h1,
    .blog-index-copy h1,
    .article-header h1,
    .article-hero h1,
    .product-detail-info h1 {
        letter-spacing: 0;
        overflow-wrap: anywhere;
    }

    .page-hero h1,
    .catalog-head h1,
    .home-hero-copy h1,
    .blog-index-copy h1,
    .article-header h1,
    .article-hero h1 {
        font-size: clamp(25px, 7.5vw, 32px);
        line-height: 1.18;
        margin-bottom: 8px;
    }

    .page-hero p,
    .catalog-head p,
    .home-hero-copy > p,
    .blog-index-copy p,
    .article-summary,
    .article-hero p {
        max-width: none;
        color: #53677a;
        font-size: 13px;
        line-height: 1.55;
    }

    .section-heading,
    .home-section-head,
    .blog-list-head,
    .product-editor-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
        margin-bottom: 16px;
    }

    .section-heading h2,
    .home-section-head h2,
    .blog-list-head h2,
    .section-title,
    .content-page h2,
    .article-content h2 {
        font-size: 22px;
        line-height: 1.28;
        letter-spacing: 0;
    }

    .btn {
        min-height: 44px;
        border-radius: 8px;
        padding: 10px 14px;
        font-size: 13px;
    }

    .actions,
    .hero-actions,
    .shop-intro-actions {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
        width: 100%;
    }

    .actions .btn,
    .hero-actions .btn,
    .shop-intro-actions .btn {
        width: 100%;
    }

    .split-content,
    .contact-grid,
    .detail-grid,
    .checkout-grid,
    .article-hero-grid,
    .article-layout,
    .article-reading-layout,
    .realwork-layout,
    .catalog-layout {
        grid-template-columns: 1fr !important;
        gap: 22px;
    }

    .service-grid,
    .process-grid,
    .why-grid,
    .space-grid,
    .gallery-page-grid,
    .post-grid,
    .blog-grid,
    .home-review-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .product-grid,
    .home-product-grid,
    .catalog-results .product-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .product-card,
    .home-product-card,
    .blog-card,
    .post-card,
    .service-grid > a,
    .process-grid article,
    .why-grid article,
    .quote-form,
    .contact-card,
    .article-toc,
    .article-support {
        border-radius: 10px;
    }

    .product-card img,
    .home-product-image img,
    .catalog-results .product-card img,
    .blog-card-media img,
    .post-card-image img {
        height: auto;
        aspect-ratio: 4 / 3;
        object-fit: cover;
    }

    .product-body,
    .blog-card-body {
        padding: 10px;
    }

    .home-product-info {
        padding: 11px;
    }

    .blog-card h2,
    .post-card h2 {
        min-height: 0;
        font-size: 16px;
        line-height: 1.35;
        overflow-wrap: anywhere;
    }

    /* Two cards now share the row that used to belong to one, so titles get a
       hard 2-line clamp instead of just wrapping — otherwise a long product
       name pushes the price/button out of view and the two cards in a row
       end up different heights. */
    .product-body h2,
    .product-body h3,
    .home-product-info h3 {
        display: -webkit-box;
        min-height: 0;
        overflow: hidden;
        font-size: 13px;
        line-height: 1.35;
        overflow-wrap: anywhere;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }

    .product-body p {
        display: none;
    }

    .home-product-info p,
    .blog-card p,
    .post-card p {
        display: -webkit-box;
        min-height: 0;
        overflow: hidden;
        color: #53677a;
        font-size: 12px;
        line-height: 1.5;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }

    .price-row {
        align-items: stretch;
        flex-direction: column;
        gap: 6px;
        margin-top: 8px;
    }

    .price-row strong {
        font-size: 14px;
    }

    .price-row a {
        display: flex;
        justify-content: center;
        width: 100%;
        min-height: 34px;
        align-items: center;
        border-radius: 7px;
        font-size: 11px;
    }

    .catalog-head {
        border-bottom: 1px solid #e1e8ee;
    }

    .catalog-categories {
        position: sticky;
        top: 64px;
        z-index: 25;
        padding: 8px 0;
        background: rgba(255, 255, 255, .97);
        border-bottom: 1px solid #e1e8ee;
        backdrop-filter: blur(10px);
    }

    .catalog-categories > .container {
        width: 100%;
        padding: 0 12px 4px;
        display: flex;
        gap: 8px;
        overflow-x: auto;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
    }

    .catalog-categories > .container::-webkit-scrollbar {
        display: none;
    }

    .catalog-categories a {
        display: flex;
        flex: 0 0 auto;
        min-width: 118px;
        min-height: 44px;
        align-items: center;
        justify-content: center;
        padding: 9px 12px;
        border-radius: 10px;
        text-align: center;
        scroll-snap-align: start;
    }

    .catalog-categories a > span,
    .catalog-categories small {
        display: none;
    }

    .catalog-categories b {
        font-size: 12px;
        line-height: 1.2;
    }

    .accessory-filter > .container {
        width: 100%;
        padding-left: 12px;
        padding-right: 12px;
    }

    .catalog-sidebar {
        position: static !important;
        order: -1;
        padding: 14px;
        border-radius: 12px;
        box-shadow: 0 10px 28px rgba(8, 43, 80, .07);
    }

    .catalog-sidebar form {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .catalog-sidebar label {
        margin: 0;
        font-size: 11px;
    }

    .catalog-sidebar input,
    .catalog-sidebar select {
        min-height: 42px;
        margin-top: 4px;
        border-radius: 8px;
        padding: 9px 10px;
    }

    .catalog-sidebar .btn {
        grid-column: 1 / -1;
        margin-top: 0;
    }

    .theme-custom-content {
        padding: 28px 0;
        background: #fff;
    }

    .theme-custom-content .content-page {
        padding: 18px;
        border: 1px solid #e1e8ee;
        border-radius: 12px;
        background: #f7fafc;
    }

    .content-render p,
    .content-render li,
    .article-content,
    .content-page p,
    .content-page li {
        color: #40566d;
        font-size: 14px;
        line-height: 1.75;
    }

    .home-hero-grid {
        grid-template-columns: 1fr;
        min-height: 0;
        gap: 20px;
        padding: 28px 0;
    }

    .hero-product {
        grid-template-columns: 1fr;
        border-radius: 12px;
    }

    .hero-product-image img {
        height: auto;
        aspect-ratio: 4 / 3;
    }

    .hero-product-info {
        padding: 16px;
    }

    .home-category-grid,
    .usecase-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .home-category-grid > a {
        grid-template-columns: 34px 1fr;
        min-width: 0;
        padding: 11px;
    }

    .home-category-grid > a > span {
        width: 34px;
        height: 34px;
        font-size: 18px;
    }

    .home-category-grid i,
    .home-category-grid small {
        display: none;
    }

    .usecase-grid > a {
        height: 136px;
        border-radius: 10px;
    }

    .realwork-gallery {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 120px 120px;
    }

    .realwork-gallery a:first-child {
        grid-column: 1 / -1;
        grid-row: auto;
    }

    .article-cover,
    .article-featured-image,
    .article-hero img {
        aspect-ratio: 16 / 9;
        border-radius: 10px;
        margin-top: 18px;
    }

    .article-sidebar,
    .product-detail-info,
    .order-summary {
        position: static !important;
        top: auto;
    }

    .article-bottom-cta,
    .cta-band > .container,
    .cart-total {
        align-items: stretch;
        flex-direction: column;
    }

    .article-bottom-cta .btn,
    .cta-band .btn {
        width: 100%;
    }

    .product-main-image img {
        height: auto;
        aspect-ratio: 4 / 3;
    }

    .product-detail-info h1 {
        font-size: clamp(24px, 7vw, 30px);
        line-height: 1.22;
    }

    .detail-price {
        margin-bottom: 12px;
        font-size: 23px;
    }

    .product-detail-info form {
        display: grid;
        grid-template-columns: 1fr 96px;
        gap: 10px;
        align-items: end;
        margin-top: 14px;
    }

    .product-detail-info form label {
        margin: 0;
        font-size: 11px;
        font-weight: 700;
    }

    .product-detail-info form select,
    .product-detail-info form input {
        width: 100%;
        margin-top: 4px;
    }

    .product-detail-info form .btn {
        grid-column: 1 / -1;
        width: 100%;
    }

    .product-detail-info > .btn-outline {
        width: 100%;
        margin-top: 10px;
    }

    .review-layout {
        grid-template-columns: 1fr;
        gap: 22px;
    }

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

    .review-form .form-grid .full {
        grid-column: auto;
    }

    .quote-form,
    .contact-card,
    .product-description-section .content-page,
    .article-toc,
    .article-support {
        padding: 16px;
    }

    .website-footer,
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .footer {
        padding-top: 30px;
    }

    .footer p,
    .footer a {
        font-size: 13px;
    }

    .floating-zalo {
        right: 12px;
        bottom: 12px;
        padding: 8px;
    }

    .floating-zalo span {
        width: 34px;
        height: 34px;
    }

    .floating-zalo b {
        display: none;
    }
}

/* App-style mobile shell: compact logo/cart header and persistent bottom nav. */
@media (max-width: 900px) {
    body {
        padding-bottom: calc(68px + env(safe-area-inset-bottom));
    }

    .site-header .nav-wrap {
        justify-content: space-between;
    }

    .site-header .brand {
        flex: 0 1 auto;
        max-width: calc(100% - 58px);
    }

    .site-header .menu-btn,
    .site-header .main-nav {
        display: none !important;
    }

    .site-header .header-cart-link {
        display: grid;
        flex: 0 0 40px;
        width: 40px;
        height: 40px;
        margin-left: auto;
    }

    .mobile-bottom-nav {
        position: fixed;
        z-index: 1100;
        right: 0;
        bottom: 0;
        left: 0;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        min-height: calc(64px + env(safe-area-inset-bottom));
        padding: 4px 4px env(safe-area-inset-bottom);
        border-top: 1px solid #dfe7ed;
        background: rgba(255, 255, 255, .98);
        box-shadow: 0 -8px 25px rgba(8, 43, 80, .09);
        backdrop-filter: blur(12px);
    }

    .mobile-bottom-nav > a,
    .mobile-bottom-nav > .mobile-more > button {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        gap: 3px;
        width: 100%;
        min-width: 0;
        min-height: 58px;
        padding: 5px 2px 4px;
        border: 0;
        border-radius: 8px;
        background: transparent;
        color: #6a7788;
        font-size: 10px;
        font-weight: 700;
        line-height: 1.1;
        text-align: center;
        white-space: nowrap;
    }

    .mobile-bottom-nav > a::before,
    .mobile-bottom-nav > .mobile-more > button::before {
        content: '';
        position: absolute;
        top: -4px;
        left: 50%;
        width: 0;
        height: 3px;
        border-radius: 0 0 4px 4px;
        background: var(--orange);
        transform: translateX(-50%);
        transition: width .18s ease;
    }

    .mobile-bottom-nav svg {
        width: 22px;
        height: 22px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.7;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .mobile-bottom-nav circle[r="1.5"] {
        fill: currentColor;
        stroke: none;
    }

    .mobile-bottom-nav > a.active,
    .mobile-bottom-nav > .mobile-more > button.active,
    .mobile-bottom-nav > .mobile-more.open > button {
        color: var(--orange);
    }

    .mobile-bottom-nav > a.active::before,
    .mobile-bottom-nav > .mobile-more > button.active::before,
    .mobile-bottom-nav > .mobile-more.open > button::before {
        width: 34px;
    }

    .mobile-more {
        position: relative;
        min-width: 0;
    }

    .mobile-more-menu {
        position: absolute;
        right: 7px;
        bottom: calc(100% + 10px);
        display: grid;
        width: 190px;
        padding: 7px;
        border: 1px solid #dce5ec;
        border-radius: 11px;
        background: #fff;
        box-shadow: 0 16px 38px rgba(8, 43, 80, .2);
        visibility: hidden;
        pointer-events: none;
        transform: translateY(7px) scale(.98);
        transform-origin: bottom right;
        transition: visibility .16s ease, transform .16s ease;
    }

    .mobile-more.open .mobile-more-menu {
        visibility: visible;
        pointer-events: auto;
        transform: translateY(0) scale(1);
    }

    .mobile-more-menu a {
        display: flex;
        align-items: center;
        min-height: 40px;
        padding: 9px 11px;
        border-radius: 7px;
        color: #263e55;
        font-size: 12px;
        font-weight: 700;
        text-transform: uppercase;
    }

    .mobile-more-menu a:hover,
    .mobile-more-menu a.active {
        background: #fff0e8;
        color: var(--orange);
    }

    .floating-zalo {
        bottom: calc(80px + env(safe-area-inset-bottom));
    }

    .floating-call {
        bottom: calc(136px + env(safe-area-inset-bottom));
    }

    .sticky-buybar {
        bottom: calc(68px + env(safe-area-inset-bottom));
    }

    body.has-sticky-buybar .floating-zalo {
        bottom: calc(80px + env(safe-area-inset-bottom) + var(--buybar-h, 0px));
    }

    body.has-sticky-buybar .floating-call {
        bottom: calc(136px + env(safe-area-inset-bottom) + var(--buybar-h, 0px));
    }
}

@media (max-width: 360px) {
    .mobile-bottom-nav > a,
    .mobile-bottom-nav > .mobile-more > button {
        font-size: 9px;
    }

    .mobile-bottom-nav svg {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 520px) {
    .container {
        width: calc(100% - 24px);
    }

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

    .catalog-categories a {
        min-width: 104px;
    }

    .home-category-grid,
    .usecase-grid {
        grid-template-columns: 1fr;
    }

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

    .product-detail-info form .btn {
        grid-column: auto;
    }

    .qty {
        width: 100% !important;
        margin: 4px 0 0;
    }

    .cart-row {
        grid-template-columns: 54px minmax(0, 1fr);
        gap: 10px;
    }

    .cart-row > strong,
    .cart-row > div:last-child {
        grid-column: 1 / -1;
    }

    .lookup-item {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }
}

/* Header, hotline & menu button on mobile — single source of truth (was duplicated
   3x across this file + style.css, with the hotline pill never actually hidden,
   which is why it collided with the hamburger menu on small screens). */
@media (max-width: 900px) {
    .hotline { display: none; }
    .menu-btn {
        display: grid;
        place-items: center;
        width: 40px;
        height: 40px;
        margin-left: auto;
        border: 1px solid #dce7ef;
        border-radius: 8px;
        background: #fff;
        color: #10243b;
    }
}

/* Form fields at 16px on mobile — anything smaller makes iOS Safari zoom the
   whole page in on focus, which then has to be manually zoomed back out.
   Affects checkout, contact, cart qty, product order form and reviews. */
@media (max-width: 900px) {
    input, select, textarea {
        font-size: 16px;
    }

    .cart-variants select {
        font-size: 16px;
    }
}

/* Floating action buttons on mobile: Zalo chat + one-tap call, stacked bottom
   right. Hotline lives only in the footer + hamburger menu at this width, so
   this is the one always-visible way to ring the shop from a phone. */
@media (max-width: 900px) {
    .floating-zalo {
        bottom: 12px;
    }

    .floating-call {
        position: fixed;
        z-index: 60;
        right: 12px;
        bottom: 68px;
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 8px;
        border-radius: 30px;
        background: #10243b;
        color: #fff;
        box-shadow: 0 10px 24px rgba(8, 43, 80, .28);
    }

    .floating-call span {
        display: grid;
        place-items: center;
        width: 34px;
        height: 34px;
        border-radius: 50%;
        background: #ff4d00;
        font-size: 16px;
    }

    .floating-call b {
        display: none;
    }

    body.has-sticky-buybar .floating-zalo,
    body.has-sticky-buybar .floating-call {
        bottom: calc(12px + var(--buybar-h, 0px));
    }

    body.has-sticky-buybar .floating-call {
        bottom: calc(68px + var(--buybar-h, 0px));
    }
}

/* Sticky "add to cart" bar for product pages — mirrors the pattern shoppers
   already know from Shopee/Tiki/Lazada: once the real order form scrolls out
   of view, price + CTA stay reachable with a thumb at the bottom of the
   screen instead of needing a trip back up the page. Built/shown via JS
   (product-detail.js) so it never appears on pages without an order form or
   on desktop, and never overlaps the real form while it's still on screen. */
@media (max-width: 900px) {
    .sticky-buybar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 55;
        display: none;
        align-items: center;
        gap: 10px;
        padding: 10px 14px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
        background: #fff;
        border-top: 1px solid #e1e8ee;
        box-shadow: 0 -8px 24px rgba(8, 43, 80, .12);
    }

    .sticky-buybar.show {
        display: flex;
    }

    .sticky-buybar-info {
        min-width: 0;
        flex: 1;
    }

    .sticky-buybar-info b {
        display: block;
        overflow: hidden;
        color: #ff4d00;
        font-size: 17px;
        line-height: 1.2;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .sticky-buybar-info small {
        display: block;
        overflow: hidden;
        color: #647386;
        font-size: 10px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .sticky-buybar button {
        flex: 0 0 auto;
        min-height: 44px;
        padding: 0 18px;
        border: 0;
        border-radius: 8px;
        background: #ff4d00;
        color: #fff;
        font-weight: 700;
        font-size: 13px;
        white-space: nowrap;
    }

    .sticky-buybar button:disabled {
        background: #c7cdd4;
    }
}

@media (min-width: 901px) {
    .sticky-buybar,
    .floating-call {
        display: none !important;
    }
}

/* Final mobile positioning overrides for the persistent app navigation. */
@media (max-width: 900px) {
    .site-header .menu-btn,
    .site-header .main-nav {
        display: none !important;
    }

    .floating-zalo {
        bottom: calc(80px + env(safe-area-inset-bottom));
    }

    .floating-call {
        bottom: calc(136px + env(safe-area-inset-bottom));
    }

    .sticky-buybar {
        bottom: calc(68px + env(safe-area-inset-bottom));
    }

    body.has-sticky-buybar .floating-zalo {
        bottom: calc(80px + env(safe-area-inset-bottom) + var(--buybar-h, 0px));
    }

    body.has-sticky-buybar .floating-call {
        bottom: calc(136px + env(safe-area-inset-bottom) + var(--buybar-h, 0px));
    }
}

