/**
 * TECHNOVA — Responsive mobile cho toàn bộ giao diện client
 */

/*
 * Offcanvas Bootstrap 5 — CSS theme cũ (bootstrap.min.css) không có style offcanvas,
 * nên #eucMobileMenu bị hiện như cột trái trên desktop. Bổ sung CSS tối thiểu.
 */
#eucMobileMenu.offcanvas {
    position: fixed;
    bottom: 0;
    z-index: 1045;
    display: flex;
    flex-direction: column;
    max-width: 100%;
    visibility: hidden;
    background-color: #fff;
    background-clip: padding-box;
    outline: 0;
    transition: transform 0.3s ease-in-out;
}

#eucMobileMenu.offcanvas-end {
    top: 0;
    right: 0;
    left: auto;
    width: min(320px, 88vw);
    height: 100vh;
    transform: translateX(100%);
    border-left: 1px solid rgba(0, 0, 0, 0.08);
}

#eucMobileMenu.offcanvas.show {
    visibility: visible;
    transform: translateX(0);
}

.offcanvas-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1040;
    background-color: rgba(0, 0, 0, 0.45);
}

.offcanvas-backdrop.fade {
    opacity: 0;
}

.offcanvas-backdrop.show {
    opacity: 1;
}

#eucMobileMenu .offcanvas-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #eee;
}

#eucMobileMenu .offcanvas-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

#eucMobileMenu .offcanvas-body {
    flex-grow: 1;
    padding: 1.25rem;
    overflow-y: auto;
}

#eucMobileMenu .offcanvas-body a {
    color: #081828;
    text-decoration: none;
    font-weight: 500;
}

#eucMobileMenu .offcanvas-body a:hover {
    color: #007BFF;
}

#eucMobileMenu .btn-close {
    box-sizing: content-box;
    width: 1em;
    height: 1em;
    padding: 0.25em;
    color: #000;
    background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M.293.293a1 1 0 011.414 0L8 6.586 14.293.293a1 1 0 111.414 1.414L9.414 8l6.293 6.293a1 1 0 01-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 01-1.414-1.414L6.586 8 .293 1.707a1 1 0 010-1.414z'/%3e%3c/svg%3e") center / 1em auto no-repeat;
    border: 0;
    border-radius: 0.25rem;
    opacity: 0.6;
    cursor: pointer;
}

/* ── Base & viewport safety ── */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

html,
body {
    overflow-x: hidden;
    max-width: 100%;
}

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

/* Tránh zoom iOS khi focus input */
@media (max-width: 767.98px) {
    input,
    select,
    textarea,
    .form-control {
        font-size: 16px !important;
    }
}

/* ── Container & section spacing ── */
@media (max-width: 767.98px) {
    .container {
        padding-left: 16px;
        padding-right: 16px;
    }

    .section {
        padding-top: 40px;
        padding-bottom: 40px;
    }

    .breadcrumbs {
        padding: 20px 0;
    }

    .breadcrumbs .page-title {
        font-size: 1.35rem !important;
        margin-bottom: 8px;
    }

    .breadcrumbs .breadcrumb-nav {
        justify-content: flex-start !important;
        flex-wrap: wrap;
        gap: 4px;
    }

    .breadcrumbs .row.align-items-center > [class*="col-"]:first-child {
        margin-bottom: 4px;
    }
}

/* ── Header mobile ── */
@media (max-width: 991.98px) {
    .header .nav-hotline {
        display: none !important;
    }

    .middle-right-area {
        display: flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        flex-wrap: nowrap !important;
        gap: 8px !important;
    }

    .middle-right-area .d-lg-none {
        margin-right: 0 !important;
    }

    .wl-container {
        margin-right: 8px !important;
    }

    .navbar-cart .cart-items {
        margin-right: 0 !important;
    }
}

@media (max-width: 575.98px) {
    body {
        padding-top: 110px !important;
    }

    .header-middle {
        padding-top: 8px !important;
        padding-bottom: 8px !important;
    }

    .wl-icon {
        height: 36px !important;
        width: 36px !important;
        line-height: 36px !important;
        font-size: 16px !important;
    }

    .navbar-cart .cart-items .main-btn {
        height: 36px !important;
        width: 36px !important;
        line-height: 36px !important;
    }

    .wl-dropdown {
        width: min(300px, calc(100vw - 24px)) !important;
        right: 0 !important;
        left: auto !important;
    }

    .wl-dropdown::before {
        right: 12px !important;
    }

    #mobile-search-box {
        padding: 12px 16px !important;
    }

    .navbar-nav .nav-item .sub-menu {
        max-height: 70vh;
        overflow-y: auto;
    }
}

/* ── Footer mobile ── */
@media (max-width: 767.98px) {
    .footer-newsletter .title {
        font-size: 1.1rem !important;
        text-align: center;
    }

    .footer-newsletter .title span {
        display: block;
        margin-top: 6px;
        font-size: 0.85rem;
    }

    .newsletter-form-head .newsletter-form {
        flex-direction: column !important;
        gap: 10px;
    }

    .newsletter-form-head .newsletter-form input {
        width: 100% !important;
        border-radius: 8px !important;
    }

    .newsletter-form-head .newsletter-form .button {
        width: 100% !important;
    }

    .newsletter-form-head .newsletter-form .button .btn {
        width: 100% !important;
    }

    .footer-middle .single-footer {
        margin-bottom: 24px;
    }

    .footer-bottom .inner-content {
        text-align: center;
    }

    .footer-bottom .payment-gateway,
    .footer-bottom .copyright,
    .footer-bottom .socila {
        justify-content: center !important;
        text-align: center;
        margin-bottom: 12px;
    }
}

/* ── Tables (đơn hàng, checkout) ── */
@media (max-width: 767.98px) {
    .table-responsive {
        -webkit-overflow-scrolling: touch;
        border-radius: 8px;
    }

    .table-responsive .table {
        font-size: 13px;
        min-width: 520px;
    }

    .table-responsive .table th,
    .table-responsive .table td {
        padding: 10px 8px;
        white-space: nowrap;
    }
}

/* ── Cửa hàng / sản phẩm ── */
@media (max-width: 991.98px) {
    .product-grids .product-topbar {
        flex-direction: column;
        align-items: stretch !important;
        gap: 12px;
    }

    .product-grids .product-topbar .sorting,
    .product-grids .product-topbar .nav {
        width: 100%;
        justify-content: space-between;
    }

    .product-sidebar {
        margin-bottom: 24px;
    }

    .product-sidebar .single-widget {
        margin-bottom: 16px;
    }
}

@media (max-width: 575.98px) {
    #nav-grid .shop-product-thumb {
        padding: 10px !important;
    }

    .product-grids .single-product .product-info {
        padding: 12px !important;
    }

    .product-grids .single-product .product-info .title a {
        font-size: 13px !important;
    }
}

/* ── Chi tiết sản phẩm ── */
@media (max-width: 767.98px) {
    .item-details .product-images .main-img img {
        max-height: 320px !important;
        height: auto !important;
    }

    .product-images .images img {
        width: 72px !important;
        height: 72px !important;
    }

    .product-info-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        padding-bottom: 4px;
    }

    .product-info-tabs .nav-link {
        padding: 10px 14px !important;
        font-size: 13px !important;
        white-space: nowrap;
    }

    .product-action-row > [class*="col-"] {
        margin-bottom: 10px;
    }

    .product-action-row .btn,
    .product-action-row .wish-button .btn {
        min-height: 44px;
    }

    .product-qty-stepper {
        max-width: 100%;
    }

    .product-spec-table th,
    .product-spec-table td {
        display: block;
        width: 100% !important;
        font-size: 13px;
        padding: 10px 12px !important;
    }

    .product-spec-table tr {
        display: block;
        margin-bottom: 8px;
        border-bottom: 1px solid #e8eef8;
    }

    .product-spec-table th {
        background: #f0f6ff;
        border-bottom: none;
    }
}

/* ── Giỏ hàng & wishlist ── */
@media (max-width: 767.98px) {
    .cart-item-card {
        padding: 12px !important;
    }

    .cart-img-wrapper {
        width: 70px !important;
        height: 70px !important;
    }
}

/* ── Blog: sidebar dưới nội dung, đã có col stack ── */
@media (max-width: 991.98px) {
    .blog-section.blog-list .col-lg-8 {
        margin-bottom: 8px;
    }

    .blog-section.blog-list .sidebar {
        margin-top: 8px;
    }

    .blog-section.blog-list .widget {
        padding: 20px;
    }
}

/* ── Liên hệ & giới thiệu ── */
@media (max-width: 767.98px) {
    .contact-hero {
        padding: 32px 0 40px !important;
    }

    .contact-hero h1 {
        font-size: 1.5rem !important;
    }

    .contact-hero .breadcrumb-nav {
        justify-content: flex-start !important;
        margin-top: 12px;
    }

    .contact-cards {
        margin-top: -24px !important;
    }

    .contact-form-box,
    .contact-map-wrap {
        padding: 20px 16px !important;
    }

    .about-hero {
        padding: 32px 0 40px !important;
    }

    .about-hero h1 {
        font-size: 1.5rem !important;
    }
}

/* ── Trang chủ (home-tech) bổ sung ── */
@media (max-width: 767.98px) {
    .home-tech .hero-area .hero-slider .single-slider .content h2 {
        font-size: 1.35rem !important;
    }

    .home-tech .hero-area .hero-slider .single-slider .content p {
        font-size: 0.9rem !important;
        margin-bottom: 16px !important;
    }

    .home-tech .hero-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .home-tech .hero-actions .btn {
        width: 100%;
        text-align: center;
    }

    .home-tech .tech-section-header {
        flex-direction: column;
        align-items: flex-start !important;
    }

    .home-tech .tech-flash-sale {
        padding: 20px 16px !important;
        margin-top: 16px;
    }

    .home-tech .tech-countdown .box h1 {
        font-size: 1.25rem !important;
    }

    .home-tech .tech-countdown {
        gap: 6px !important;
    }

    .home-tech .special-offer .row > .col-lg-8,
    .home-tech .special-offer .row > .col-lg-4 {
        padding-left: 12px;
        padding-right: 12px;
    }

    .home-tech .tech-rank-col {
        padding: 16px !important;
        margin-bottom: 12px;
    }
}

@media (max-width: 575.98px) {
    .home-tech .tech-usp-strip li {
        padding: 16px !important;
    }

    .home-tech .tech-usp-strip h5 {
        font-size: 13px !important;
    }

    .home-tech .tech-product-grid {
        gap: 12px !important;
    }

    .home-tech .tech-cat-grid {
        gap: 12px !important;
    }
}

/* ── Checkout ── */
@media (max-width: 767.98px) {
    .checkout-form .form-group,
    .checkout-form .col-md-6 {
        margin-bottom: 12px;
    }

    .order-summary-card {
        margin-top: 24px;
        position: static !important;
    }
}

/* ── Bảo hành ── */
@media (max-width: 767.98px) {
    .warranty-lookup-form .row > [class*="col-"] {
        margin-bottom: 12px;
    }
}

/* ── Nút & touch targets ── */
@media (max-width: 767.98px) {
    .btn {
        min-height: 42px;
        padding: 10px 16px;
    }

    .scroll-top {
        width: 44px !important;
        height: 44px !important;
        line-height: 44px !important;
        bottom: 88px !important;
        right: 16px !important;
    }

    #chat-widget-container {
        bottom: 16px !important;
        right: 16px !important;
    }

    #chat-btn {
        width: 52px !important;
        height: 52px !important;
    }

    #chat-box {
        width: calc(100vw - 24px) !important;
        max-width: 360px;
        right: 0 !important;
    }

    #euc-support-widget {
        bottom: 12px !important;
        right: 12px !important;
    }

    #chat-widget-container {
        bottom: 70px !important;
    }
}

/* ── Pagination ── */
@media (max-width: 575.98px) {
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
        gap: 4px;
    }

    .pagination .page-link {
        padding: 8px 12px;
        font-size: 13px;
    }
}

/* ── Modal ── */
@media (max-width: 575.98px) {
    .modal-dialog {
        margin: 12px;
        max-width: calc(100% - 24px);
    }
}

/* ── Overflow fixes (mega menu, carousel) ── */
@media (max-width: 991.98px) {
    .product-mega-menu .mega-columns {
        max-height: none;
    }

    .tns-outer {
        overflow: hidden;
    }
}
