/* =====================================================
   MiATech Mobile-First Enhancement
   Comprehensive mobile UX: header, nav, bottom bar, 
   product cards, footer, and all pages
   ===================================================== */

/* ===== MOBILE HEADER OVERHAUL (≤768px) ===== */
@media (max-width: 768px) {

    /* --- Header structure --- */
    .xoan-header {
        border-radius: 0;
        padding-bottom: 0;
        overflow: hidden;
    }

    .xoan-main-header {
        gap: 8px;
        height: 56px;
        padding: 0 4px;
    }

    /* --- Logo compact --- */
    .xoan-logo {
        gap: 6px;
        flex-shrink: 0;
    }

    .xoan-logo img {
        height: 34px !important;
        max-width: 130px !important;
    }

    .logo-icon-wrap {
        width: 36px;
        height: 36px;
        border-radius: 10px;
        font-size: 16px;
    }

    .logo-text {
        font-size: 18px;
        letter-spacing: -0.5px;
    }

    /* --- Search bar compact --- */
    .xoan-search {
        flex: 1;
        min-width: 0;
    }

    .xoan-search-form {
        padding: 2px 2px 2px 10px;
        border-radius: 8px;
    }

    .xoan-search-form input {
        height: 34px;
        font-size: 12px;
    }

    .xoan-search-form input::placeholder {
        font-size: 11px;
    }

    .search-icon-left {
        font-size: 12px;
        margin-right: 6px;
    }

    .xoan-search-form button {
        height: 30px;
        width: 30px;
        padding: 0;
        border-radius: 8px;
        min-width: 30px;
        justify-content: center;
    }

    /* --- Hide desktop actions, show only cart icon --- */
    .xoan-actions {
        gap: 4px;
        flex-shrink: 0;
    }

    .xoan-action-item.hotline-action,
    .xoan-action-item:nth-child(2) {
        display: none;
    }

    .xoan-action-item.cart-action {
        padding: 4px;
    }

    .xoan-action-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    .xoan-cart-badge {
        min-width: 16px;
        height: 16px;
        font-size: 9px;
        top: -2px;
        right: -2px;
        border-width: 1.5px;
    }

    /* --- Navigation menu: hide on mobile, use slide menu instead --- */
    .xoan-category-menu {
        display: none !important;
    }

    .floating-badge {
        font-size: 7px;
        padding: 1px 4px;
        top: -4px;
        right: -2px;
    }

    /* --- Flash messages compact --- */
    .alert {
        font-size: 13px;
        padding: 10px 14px;
        margin: 8px 0;
    }
}

/* ===== MOBILE BOTTOM NAVIGATION BAR ===== */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #E8420B;
    border-top: none;
    box-shadow: 0 -4px 16px rgba(232, 66, 11, 0.3);
    z-index: 9999;
    padding: 4px 0;
    padding-bottom: calc(4px + env(safe-area-inset-bottom, 0));
    border-radius: 20px 20px 0 0;
}

@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: flex;
    }

    /* Prevent horizontal overflow from slide menu */
    html, body {
        overflow-x: hidden !important;
    }

    /* Add bottom padding to main content to avoid overlap */
    body {
        padding-bottom: 64px;
    }

    /* Hide desktop floating buttons */
    .floating-buttons {
        bottom: 72px;
    }
}

.mobile-bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 4px;
    text-decoration: none;
    color: rgba(255,255,255,0.75);
    font-size: 10px;
    font-weight: 600;
    transition: color 0.2s;
    position: relative;
}

.mobile-bottom-nav a.active,
.mobile-bottom-nav a:hover {
    color: #fff;
}

.mobile-bottom-nav a i {
    font-size: 20px;
    line-height: 1;
    transition: transform 0.2s;
}

.mobile-bottom-nav a.active i {
    transform: scale(1.1);
}

.mobile-bottom-nav a span {
    line-height: 1;
}

.mobile-nav-badge {
    position: absolute;
    top: 2px;
    right: calc(50% - 16px);
    background: var(--primary);
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Home center floating button */
.mobile-bottom-nav .home-center-btn {
    position: relative;
    margin-top: -20px;
}
.home-btn-circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #fff, #ffe0d0);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    border: 3px solid rgba(255,255,255,0.4);
    transition: transform 0.2s, box-shadow 0.2s;
}
.home-btn-circle i {
    font-size: 22px !important;
    color: #E8420B;
}
.mobile-bottom-nav .home-center-btn span {
    color: #fff;
    font-weight: 700;
    margin-top: 2px;
}
.mobile-bottom-nav .home-center-btn:active .home-btn-circle {
    transform: scale(0.9);
}
.mobile-bottom-nav .home-center-btn.active .home-btn-circle {
    box-shadow: 0 4px 20px rgba(234, 88, 12, 0.6);
    transform: scale(1.05);
}

/* ===== HOMEPAGE MOBILE ENHANCEMENTS ===== */
@media (max-width: 768px) {

    /* --- Hero section --- */
    .hero-section {
        padding: 8px 0 0;
    }

    .hero-grid {
        height: 200px;
        border-radius: 12px;
    }

    .hero-slider {
        border-radius: 12px;
    }

    /* --- Trust features --- */
    .trust-grid,
    .feature-grid {
        gap: 8px;
    }

    .trust-item,
    .feature-item {
        padding: 10px 8px;
        gap: 8px;
        border-radius: 10px;
    }

    .trust-icon,
    .feature-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    .trust-text h4,
    .feature-text h4 {
        font-size: 12px;
    }

    .trust-text p,
    .feature-text p {
        font-size: 10px;
    }

    /* --- Section headers --- */
    .section-header {
        padding: 12px 0;
        margin-bottom: 8px;
    }

    .section-title {
        font-size: 16px;
    }

    /* --- Product cards enhanced mobile --- */
    .product-grid,
    .xoan-product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .product-card,
    .xoan-product-card {
        border-radius: 10px;
    }

    .product-info {
        padding: 8px 10px;
    }

    .product-name {
        font-size: 13px;
        line-height: 1.3;
        min-height: auto;
        -webkit-line-clamp: 2;
    }

    .price-sale {
        font-size: 15px;
    }

    .price-original {
        font-size: 11px;
    }

    .price-discount {
        font-size: 10px;
        padding: 1px 4px;
    }

    /* --- Flash sale --- */
    .flash-sale-section {
        margin: 8px 0;
        border-radius: 12px;
    }

    .flash-sale-header {
        padding: 10px 12px;
        border-radius: 12px 12px 0 0;
    }

    .flash-sale-products {
        padding: 10px;
    }

    /* --- Container padding --- */
    .container {
        padding: 0 10px;
    }

    /* --- Footer mobile enhancement --- */
    .site-footer {
        margin-top: 24px;
    }

    .site-footer::before {
        height: 3px;
    }

    .footer-top {
        padding: 24px 0 16px;
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 16px;
    }

    /* Logo column spans full width */
    .footer-col:first-child {
        grid-column: 1 / -1;
        text-align: center;
        padding-bottom: 12px;
        border-bottom: 1px solid rgba(255,255,255,0.1);
        margin-bottom: 4px;
    }

    .footer-logo {
        justify-content: center;
    }

    .footer-logo img {
        height: 50px !important;
    }

    .footer-desc {
        font-size: 12px;
        margin-bottom: 10px;
        max-width: 320px;
        margin-left: auto;
        margin-right: auto;
    }

    .footer-social {
        gap: 8px;
        justify-content: center;
    }

    .social-link {
        width: 34px;
        height: 34px;
        border-radius: 8px;
        font-size: 14px;
    }

    .footer-title {
        font-size: 13px;
        margin-bottom: 8px;
        padding-bottom: 6px;
    }

    .footer-links a {
        font-size: 12px;
        padding: 4px 0;
    }

    .footer-links a i {
        font-size: 9px;
    }

    .footer-contact li {
        font-size: 12px;
        gap: 8px;
        margin-bottom: 6px;
    }

    .footer-contact li i {
        font-size: 12px;
        width: 14px;
    }

    /* Contact column spans full width */
    .footer-col:last-child {
        grid-column: 1 / -1;
        padding-top: 10px;
        border-top: 1px solid rgba(255,255,255,0.1);
    }

    .footer-col:last-child .footer-contact {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px 12px;
    }

    .footer-bottom {
        padding: 10px 0;
        padding-bottom: calc(10px + 64px);
        font-size: 11px;
    }

    .footer-logo .logo-name {
        font-size: 18px;
    }

    /* --- Promo banners: stack vertically on mobile --- */
    .promo-banners-section {
        margin-top: 10px !important;
    }
    .promo-banners-section .container > div {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }
    .promo-banners-section img {
        border-radius: 8px;
    }

    /* --- Hero section: hide sidebar, full width slider --- */
    .hero-grid {
        grid-template-columns: 1fr !important;
    }
    .hero-sidebar {
        display: none !important;
    }

    /* --- Product card mobile tweaks --- */
    .xoan-product-card .product-image-wrapper {
        position: relative;
    }
    .xoan-product-card .savings-label {
        font-size: 9px !important;
        padding: 2px 6px !important;
        border-radius: 4px;
    }
    .xoan-product-card .version-badge {
        font-size: 9px !important;
        padding: 2px 5px !important;
    }
    .product-name-xoan {
        font-size: 12px !important;
        line-height: 1.3;
        -webkit-line-clamp: 2;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .price-current {
        font-size: 14px !important;
    }
    .price-old {
        font-size: 10px !important;
    }
    .product-bottom-row {
        gap: 4px;
        align-items: center;
    }
    .add-to-cart-circle {
        width: 28px !important;
        height: 28px !important;
        min-width: 28px;
        max-width: 28px;
        min-height: 28px;
        max-height: 28px;
        font-size: 11px !important;
        opacity: 1 !important;
        transform: scale(1) !important;
        flex-shrink: 0;
        aspect-ratio: 1 / 1;
        border-radius: 50% !important;
        background: #E8420B !important;
        color: #fff !important;
        align-self: center;
        padding: 0 !important;
    }

    /* --- Promo label on product card --- */
    .product-info-wrapper > div[style*="font-size: 11px"] {
        font-size: 9px !important;
        line-height: 1.2;
    }

    /* --- Section block headers --- */
    .block-header,
    .flash-sale-header {
        padding: 8px 12px !important;
        min-height: auto;
    }
    .block-title,
    .flash-text {
        font-size: 13px !important;
    }
    .block-brand-icon {
        font-size: 16px !important;
    }
    .btn-view-all,
    .flash-sale-viewall {
        font-size: 11px !important;
        padding: 4px 10px !important;
    }

    /* --- Flash sale countdown compact --- */
    .flash-sale-countdown {
        gap: 4px;
    }
    .countdown-label {
        font-size: 10px !important;
        display: none;
    }
    .countdown-box {
        width: 24px !important;
        height: 24px !important;
        font-size: 11px !important;
        border-radius: 4px !important;
    }
    .countdown-sep {
        font-size: 12px !important;
    }

    /* --- Why choose section compact --- */
    .why-choose-section {
        padding: 20px 0;
    }
    .why-choose-header h2 {
        font-size: 18px;
    }
    .why-choose-header p {
        font-size: 12px;
    }
    .why-choose-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
    .why-item {
        padding: 14px 10px;
    }
    .why-item h3 {
        font-size: 12px;
    }
    .why-item p {
        font-size: 10px;
        display: none;
    }
    .why-icon {
        width: 36px !important;
        height: 36px !important;
        font-size: 16px !important;
    }

    /* --- Announcement bar compact --- */
    .xoan-top-bar {
        font-size: 11px !important;
        padding: 4px 0 !important;
    }
    .xoan-top-bar .top-left,
    .xoan-top-bar .top-right .top-email {
        display: none !important;
    }
}

/* ===== PRODUCT DETAIL MOBILE ===== */
@media (max-width: 768px) {
    .detail-section,
    .xoan-detail-section {
        padding: 4px 0 80px;
    }

    .detail-grid,
    .xoan-detail-grid {
        grid-template-columns: 1fr !important;
        gap: 8px;
        padding: 0;
    }

    /* Compact image gallery */
    .xoan-gallery {
        margin-bottom: 0;
    }

    .xoan-main-image {
        border-radius: 10px;
        padding: 8px;
        max-height: 260px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .xoan-main-image img {
        max-height: 240px;
        object-fit: contain;
    }

    .xoan-thumb-strip {
        gap: 4px !important;
        margin-top: 6px !important;
    }

    .xoan-thumb {
        width: 44px !important;
        height: 44px !important;
    }

    .thumb-color-label {
        font-size: 8px !important;
    }

    .detail-main-image {
        border-radius: 10px;
        padding: 8px;
    }

    /* Compact title */
    .detail-title,
    .xoan-product-title {
        font-size: 16px !important;
        line-height: 1.3;
        margin-bottom: 4px !important;
    }

    /* Compact countdown */
    .xoan-detail-countdown {
        padding: 6px 10px !important;
        margin-bottom: 6px !important;
    }

    .countdown-label-text {
        font-size: 11px !important;
    }

    .dc-box {
        width: 24px !important;
        height: 24px !important;
        font-size: 12px !important;
    }

    /* Compact variant groups */
    .xoan-variant-group {
        margin-bottom: 6px !important;
    }

    .xoan-variant-label {
        font-size: 12px !important;
        margin-bottom: 4px !important;
    }

    .xoan-chip-row {
        gap: 5px !important;
    }

    .xoan-chip {
        padding: 5px 10px !important;
        font-size: 11px !important;
        border-radius: 6px !important;
    }

    .xoan-chip.chip-color-img {
        padding: 4px 8px !important;
        gap: 4px !important;
    }

    .xoan-chip.chip-color-img .chip-thumb {
        width: 28px !important;
        height: 28px !important;
    }

    .xoan-chip.chip-color-img .chip-color-name {
        font-size: 10px !important;
    }

    .xoan-chip.chip-appearance {
        padding: 5px 8px !important;
    }

    .appear-grade {
        font-size: 11px !important;
    }

    .appear-desc {
        font-size: 9px !important;
    }

    /* Compact price box */
    .detail-price-box,
    .xoan-price-box {
        padding: 8px 10px !important;
        flex-direction: row !important;
        gap: 6px;
        align-items: center;
    }

    .xoan-stock-badge {
        font-size: 9px !important;
        padding: 2px 6px !important;
    }

    .detail-price-box .price-sale,
    .xoan-price-main {
        font-size: 20px !important;
    }

    .xoan-price-old {
        font-size: 13px !important;
    }

    .xoan-price-right {
        display: none;
    }

    /* Compact action buttons */
    .xoan-actions-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 6px;
        margin-top: 6px !important;
    }

    .xoan-btn-buy,
    .xoan-btn-installment {
        padding: 10px 8px !important;
    }

    .xoan-btn-buy strong,
    .xoan-btn-installment strong {
        font-size: 13px !important;
    }

    .xoan-btn-buy small,
    .xoan-btn-installment small {
        font-size: 9px !important;
    }

    /* Hide non-essential on mobile */
    .xoan-business-box {
        display: none;
    }

    .xoan-hot-indicator {
        font-size: 11px !important;
        padding: 6px 10px !important;
        margin-top: 6px !important;
    }

    .xoan-tradein-label,
    .xoan-tradein-text,
    .xoan-tradein-value {
        font-size: 10px !important;
    }

    .xoan-desc-card {
        margin-top: 10px !important;
        padding: 12px !important;
    }

    .detail-top-bar {
        display: none;
    }

    /* Product image gallery mobile */
    .xoan-gallery-main {
        border-radius: 10px;
    }
    .xoan-gallery-thumbs {
        gap: 4px;
    }
    .xoan-gallery-thumb {
        width: 44px;
        height: 44px;
        border-radius: 6px;
    }

    /* Specs table */
    .xoan-specs-table td,
    .xoan-specs-table th {
        padding: 6px 8px;
        font-size: 11px;
    }

    /* Sticky buy bar for detail page */
    .xoan-sticky-buy {
        position: fixed;
        bottom: 56px;
        left: 0;
        right: 0;
        z-index: 999;
        background: #fff;
        border-top: 1px solid rgba(0,0,0,0.08);
        padding: 8px 12px;
        box-shadow: 0 -4px 12px rgba(0,0,0,0.08);
        display: flex;
        gap: 8px;
    }
    .xoan-sticky-buy .btn {
        flex: 1;
        border-radius: 10px;
        font-size: 13px;
        padding: 10px;
    }
}

/* ===== CART & CHECKOUT MOBILE ===== */
@media (max-width: 768px) {
    .cart-section,
    .checkout-section {
        padding: 8px 0 80px;
    }

    .cart-section h1 {
        font-size: 20px !important;
        margin-bottom: 12px !important;
    }
    .cart-section h1 span {
        font-size: 14px !important;
    }

    .cart-container,
    .checkout-grid {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }

    .cart-card,
    .cart-items-card,
    .checkout-card {
        padding: 12px;
        border-radius: 12px;
    }

    .cart-item {
        padding: 10px 0;
        gap: 10px;
    }

    .cart-item-image {
        width: 64px;
        height: 64px;
        border-radius: 8px;
        flex-shrink: 0;
    }

    .cart-item-name {
        font-size: 13px;
        -webkit-line-clamp: 2;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .cart-item-price {
        font-size: 15px;
    }

    .cart-item-variant {
        font-size: 11px;
    }

    .cart-qty-control {
        height: 32px;
    }
    .cart-qty-control button {
        width: 32px;
        font-size: 14px;
    }
    .cart-qty-control input {
        width: 36px;
        font-size: 13px;
    }

    .cart-item-remove {
        font-size: 12px;
    }

    .order-summary,
    .cart-summary-card {
        padding: 14px;
        border-radius: 12px;
    }

    .btn-checkout {
        height: 48px;
        font-size: 14px;
        border-radius: 12px;
    }

    /* Checkout form */
    .checkout-form-group label {
        font-size: 13px;
    }
    .checkout-form-group input,
    .checkout-form-group select,
    .checkout-form-group textarea {
        font-size: 14px;
        padding: 10px 12px;
    }

    .breadcrumb {
        font-size: 12px;
        margin-bottom: 10px;
    }
}

/* ===== ACCOUNT PAGE MOBILE ===== */
@media (max-width: 768px) {
    .account-section {
        padding: 8px 0 80px;
    }

    .account-grid {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }

    .account-sidebar {
        border-radius: 12px;
        padding: 14px;
    }
    .account-sidebar .account-menu {
        display: flex;
        overflow-x: auto;
        gap: 6px;
        -webkit-overflow-scrolling: touch;
    }
    .account-sidebar .account-menu a {
        white-space: nowrap;
        padding: 8px 14px;
        font-size: 12px;
        border-radius: 20px;
        background: #f3f4f6;
    }
    .account-sidebar .account-menu a.active {
        background: var(--primary);
        color: #fff;
    }

    .account-content {
        border-radius: 12px;
        padding: 14px;
    }

    .account-content h2 {
        font-size: 18px;
    }

    /* Order history table */
    .order-table {
        font-size: 12px;
    }
    .order-table th,
    .order-table td {
        padding: 8px 6px;
    }
}

/* ===== SEARCH PAGE MOBILE ===== */
@media (max-width: 768px) {
    .search-section {
        padding: 8px 0 80px;
    }

    .search-results-header {
        font-size: 14px;
    }

    .filter-bar {
        flex-direction: column;
        gap: 8px;
    }

    .filter-bar select {
        width: 100%;
    }

    .search-section h1 {
        font-size: 18px;
    }
}

/* ===== ORDER TRACKING MOBILE ===== */
@media (max-width: 768px) {
    .tracking-section {
        padding: 10px 0 80px;
    }

    .tracking-form {
        flex-direction: column;
    }

    .tracking-form input {
        padding: 12px;
        font-size: 14px;
    }

    .tracking-form button {
        height: 46px;
        border-radius: 10px;
    }

    .tracking-result {
        padding: 14px;
    }
    .tracking-timeline {
        padding-left: 20px;
    }
}

/* ===== STATIC PAGES MOBILE ===== */
@media (max-width: 768px) {
    .static-page-section {
        padding: 10px 0 80px;
    }
    .static-page-section .container {
        padding: 0 12px;
    }
    .static-page-section h1 {
        font-size: 20px;
    }
    .static-page-content {
        padding: 14px;
        border-radius: 12px;
        font-size: 14px;
    }
    .static-page-content img {
        max-width: 100%;
        height: auto;
        border-radius: 8px;
    }
}

/* ===== AUTH PAGES MOBILE ===== */
@media (max-width: 768px) {
    body.auth-page {
        padding-bottom: 60px;
    }
    body.auth-page .xoan-header {
        position: relative;
    }
    body.auth-page .xoan-announcement-bar {
        display: none;
    }
    body.auth-page .site-footer {
        display: none;
    }
}

/* ===== PAGINATION MOBILE ===== */
@media (max-width: 768px) {
    .pagination {
        gap: 4px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .page-btn {
        min-width: 36px;
        height: 36px;
        font-size: 13px;
    }
}

/* ===== ORDER TRACKING MOBILE ===== */
@media (max-width: 768px) {
    .tracking-section {
        padding: 10px 0;
    }

    .tracking-form {
        flex-direction: column;
    }

    .tracking-form input {
        padding: 12px;
        font-size: 14px;
    }

    .tracking-form button {
        height: 46px;
        border-radius: 10px;
    }
}

/* ===== EXTRA SMALL SCREENS (≤480px) ===== */
@media (max-width: 480px) {
    .xoan-main-header {
        height: 50px;
        gap: 6px;
    }

    .logo-icon-wrap {
        width: 32px;
        height: 32px;
        border-radius: 8px;
        font-size: 14px;
    }

    .logo-text {
        font-size: 16px;
    }

    .xoan-search-form input {
        height: 30px;
        font-size: 11px;
    }

    .xoan-search-form button {
        height: 26px;
        width: 26px;
    }

    .xoan-action-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .hero-grid {
        height: 180px;
    }

    .container {
        padding: 0 8px;
    }

    .section-title {
        font-size: 15px;
    }

    /* Tighter product cards */
    .product-info {
        padding: 6px 8px;
    }

    .product-name {
        font-size: 12px;
        -webkit-line-clamp: 1;
    }

    .price-sale {
        font-size: 14px;
    }

    .price-original {
        font-size: 10px;
    }

    /* Swiper navigation arrows */
    .swiper-button-prev,
    .swiper-button-next {
        width: 28px;
        height: 28px;
    }

    .swiper-button-prev::after,
    .swiper-button-next::after {
        font-size: 12px;
    }
}

/* ===== iOS SAFE AREA SUPPORT ===== */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .mobile-bottom-nav {
        padding-bottom: calc(4px + env(safe-area-inset-bottom));
    }

    @media (max-width: 768px) {
        body {
            padding-bottom: calc(64px + env(safe-area-inset-bottom));
        }
    }
}

/* ===== SMOOTH SCROLL & TOUCH OPTIMIZATIONS ===== */
@media (max-width: 768px) {
    /* Better touch targets */
    a, button {
        min-height: 36px;
    }

    /* Smooth momentum scrolling */
    .xoan-category-menu,
    .flash-sale-products .swiper-wrapper,
    .quick-select-scroll {
        -webkit-overflow-scrolling: touch;
    }

    /* Disable hover effects on touch */
    @media (hover: none) {
        .product-card:hover,
        .xoan-product-card:hover {
            transform: none;
            box-shadow: var(--shadow-card);
        }

        .policy-card:hover {
            transform: none;
        }

        .stat-item:hover {
            transform: none;
        }
    }
}

/* ===== MOBILE SLIDE-OUT MENU (xoanstore style) ===== */
.mobile-slide-menu {
    position: fixed;
    top: 0;
    left: -85%;
    width: 85%;
    max-width: 360px;
    height: 100vh;
    background: linear-gradient(180deg, #ea580c 0%, #c2410c 100%);
    z-index: 10001;
    display: flex;
    flex-direction: column;
    transition: left 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 4px 0 20px rgba(0,0,0,0.3);
    overflow: hidden;
}
.mobile-slide-menu.open {
    left: 0;
}

/* Menu Header */
.msm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 16px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}
.msm-user {
    display: flex;
    align-items: center;
    gap: 12px;
}
.msm-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}
.msm-avatar i {
    font-size: 24px;
    color: #fff;
}
.msm-name {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    display: block;
}
a.msm-name { text-decoration: none; }
a.msm-name:hover { text-decoration: underline; }
.msm-link {
    font-size: 12px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
}
.msm-link:hover { color: #fff; }
.msm-close {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.msm-close:hover { background: rgba(255,255,255,0.3); }

/* Menu Body */
.msm-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
    -webkit-overflow-scrolling: touch;
}
.msm-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    transition: background 0.2s;
}
.msm-item:hover { background: rgba(255,255,255,0.1); }
.msm-item i:first-child {
    width: 20px;
    text-align: center;
    font-size: 16px;
    color: rgba(255,255,255,0.8);
}
.msm-item span { flex: 1; }
.msm-arrow {
    font-size: 11px;
    color: rgba(255,255,255,0.4);
}

/* Menu Footer */
.msm-footer {
    display: flex;
    gap: 0;
    border-top: 1px solid rgba(255,255,255,0.15);
}
.msm-footer-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 10px;
    color: #fff;
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    transition: background 0.2s;
    line-height: 1.3;
}
.msm-footer-btn:first-child {
    border-right: 1px solid rgba(255,255,255,0.15);
    background: rgba(0,0,0,0.1);
}
.msm-footer-btn:last-child {
    background: rgba(0,0,0,0.05);
}
.msm-footer-btn:hover { background: rgba(255,255,255,0.1); }
.msm-footer-btn i { font-size: 18px; }
.msm-footer-btn strong { font-weight: 800; }

/* Menu Overlay */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}
.mobile-menu-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* ===== MOBILE HOMEPAGE POLISH ===== */
@media (max-width: 768px) {

    /* Floating buttons smaller */
    .floating-contact a,
    .zalo-float,
    .phone-float,
    #scrollTopBtn {
        width: 42px !important;
        height: 42px !important;
        font-size: 18px !important;
    }

    /* Swiper arrows hide on mobile */
    .flash-next,
    .flash-prev,
    .swiper-button-next,
    .swiper-button-prev {
        display: none !important;
    }

    /* Product card grid - tighter on mobile */
    .product-grid {
        gap: 8px !important;
    }

    .xoan-product-card {
        border-radius: 10px;
    }

    /* Flash sale block */
    .flash-sale-block {
        border-radius: 10px !important;
    }

    .flash-sale-products {
        padding: 10px 8px !important;
    }

    /* News layout mobile */
    .news-layout {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    .news-featured-img {
        border-radius: 8px;
    }

    .news-featured h3 {
        font-size: 15px;
    }

    .news-sidebar-thumb {
        width: 100px !important;
        height: 65px !important;
        border-radius: 6px;
    }

    .news-sidebar-info h4 {
        font-size: 13px !important;
    }

    /* Trending section mobile */
    .trending-section {
        padding: 24px 0 !important;
    }

    .trending-header h2 {
        font-size: 18px !important;
    }

    .trending-tags {
        gap: 6px !important;
        padding: 0 4px;
    }

    .trending-tag {
        padding: 7px 12px !important;
        font-size: 11px !important;
        gap: 5px !important;
    }

    .tag-hot-badge {
        font-size: 8px !important;
        padding: 1px 4px !important;
    }

    /* Tech news header mobile */
    .tech-news-header {
        padding-bottom: 10px !important;
    }

    .tech-news-header h2 {
        font-size: 17px !important;
    }

    /* Why choose section mobile */
    .why-choose-section {
        padding: 30px 0 !important;
    }

    .why-badge {
        font-size: 11px !important;
        padding: 4px 12px !important;
    }

    .why-choose-header h2 {
        font-size: 22px !important;
    }

    .why-choose-header p {
        font-size: 12px !important;
    }

    .why-choose-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
    }

    .why-card {
        padding: 16px 12px !important;
        border-radius: 12px !important;
    }

    .why-card-icon {
        width: 42px !important;
        height: 42px !important;
        font-size: 18px !important;
        border-radius: 12px !important;
        margin-bottom: 10px !important;
    }

    .why-card h3 {
        font-size: 12px !important;
        margin-bottom: 4px !important;
    }

    .why-card p {
        font-size: 10px !important;
        line-height: 1.4 !important;
    }

    .why-card-number {
        font-size: 24px !important;
        top: 8px !important;
        right: 10px !important;
    }

    /* Promo banners mobile - keep side by side */
    .promo-banners-section {
        margin-top: 10px !important;
    }

    .promo-grid {
        display: flex !important;
        gap: 6px !important;
    }

    .promo-banner-item {
        border-radius: 8px;
    }

    /* Section block headers mobile */
    .block-header {
        padding: 12px 14px !important;
    }

    .block-title {
        font-size: 15px !important;
    }

    /* Hero section mobile */
    .hero-grid {
        grid-template-columns: 1fr !important;
    }

    .hero-sidebar {
        display: none !important;
    }
}
