/* ========================================
   RESPONSIVE CSS - Hỗ trợ đa thiết bị
   Website bán điều hòa không khí CoolMart
   
   Breakpoints:
   - Extra Large: >= 1400px (Desktop lớn)
   - Large: 1200px - 1399px (Desktop)
   - Medium-Large: 992px - 1199px (Laptop/Tablet ngang)
   - Medium: 768px - 991px (Tablet)
   - Small: 576px - 767px (Điện thoại lớn: iPhone Plus, Galaxy Note)
   - Extra Small: 414px - 575px (Điện thoại trung bình: iPhone Pro Max)
   - Mini: 375px - 413px (Điện thoại nhỏ: iPhone, Galaxy S)
   - Tiny: <= 374px (Điện thoại rất nhỏ: iPhone SE, Galaxy A)
   ======================================== */

/* ========================================
   BASE MOBILE IMPROVEMENTS
   ======================================== */

/* Touch-friendly tap targets - tối thiểu 44px */
@media (pointer: coarse) {
    button,
    a.btn,
    input[type="submit"],
    input[type="button"],
    .header-action-item,
    .cart-toggle,
    .search-toggle {
        min-height: 44px;
        min-width: 44px;
    }

    /* Tăng kích thước checkbox/radio cho touch */
    input[type="checkbox"],
    input[type="radio"] {
        width: 22px;
        height: 22px;
    }
}

/* Safe area cho điện thoại có notch (iPhone X+) */
@supports (padding: max(0px)) {
    .header,
    .header-main {
        padding-left: max(15px, env(safe-area-inset-left));
        padding-right: max(15px, env(safe-area-inset-right));
    }

    .footer {
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }

    .mobile-nav {
        padding-top: max(20px, env(safe-area-inset-top));
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
}

/* Prevent horizontal scroll */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* Smooth scrolling disabled cho mobile để tránh lag */
@media (max-width: 768px) {
    html {
        scroll-behavior: auto;
    }
}

/* ========================================
   EXTRA LARGE DEVICES (>= 1400px)
   Desktop lớn, màn hình rộng
   ======================================== */
@media (min-width: 1400px) {
    .container {
        max-width: 1380px;
    }

    .product-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .banner-content h1 {
        font-size: 56px;
    }

    .category-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* ========================================
   LARGE DEVICES (1200px - 1399px)
   Desktop chuẩn
   ======================================== */
@media (max-width: 1399px) {
    .container {
        max-width: 1140px;
    }

    .product-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }

    .banner-content h1 {
        font-size: 44px;
    }
}

/* ========================================
   MEDIUM-LARGE DEVICES (992px - 1199px)
   Laptop, Tablet ngang
   ======================================== */
@media (max-width: 1199px) {
    .container {
        max-width: 960px;
        padding: 0 20px;
    }

    /* Header */
    .header-main .container {
        gap: 20px;
    }

    .search-box {
        max-width: 400px;
    }

    .header-action-item .text-wrap {
        display: none;
    }

    /* Navigation */
    .nav-menu > li > a {
        padding: 14px 16px;
        font-size: 13px;
    }

    .mega-menu {
        grid-template-columns: repeat(3, 1fr);
        min-width: 650px;
        padding: 25px;
    }

    /* Products */
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }

    .product-card .current-price {
        font-size: 18px;
    }

    /* Features */
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Category */
    .category-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    /* Footer */
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 40px;
    }

    /* Banner */
    .banner-content h1 {
        font-size: 38px;
    }

    .banner-content p {
        font-size: 16px;
    }

    /* Two column layout */
    .two-column-layout {
        gap: 25px;
    }

    .sidebar {
        width: 280px;
    }
}

/* ========================================
   MEDIUM DEVICES (768px - 991px)
   Tablet dọc
   ======================================== */
@media (max-width: 991px) {
    .container {
        max-width: 720px;
        padding: 0 15px;
    }

    /* Top bar - ẩn trên tablet */
    .top-bar {
        display: none;
    }

    /* Header */
    .header-main {
        padding: 12px 0;
    }

        .header-main .container {
            flex-wrap: wrap;
        }

    .logo-icon {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }

    .logo-text .brand {
        font-size: 20px;
    }

    .logo-text .tagline {
        font-size: 10px;
    }

    .search-box {
        order: 3;
        flex-basis: 100%;
        max-width: 100%;
        margin-top: 12px;
    }

        .search-box input {
            padding: 12px 18px;
        }

    /* Main Navigation - ẩn, hiển thị mobile menu */
    .main-nav {
        display: none;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    /* Products */
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }

    .product-card .product-info {
        padding: 15px;
    }

    .product-card .product-name {
        font-size: 14px;
        min-height: 42px;
    }

    .product-card .current-price {
        font-size: 16px;
    }

    .product-card .old-price {
        font-size: 12px;
    }

    .product-card .product-actions {
        display: none;
    }

    /* Two column layout - chuyển thành 1 cột */
    .two-column-layout {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .sidebar {
        width: 100%;
        order: 2;
    }

    /* Product Detail */
    .product-detail-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .product-detail-info h1 {
        font-size: 24px;
    }

    .product-detail-info .current-price {
        font-size: 28px;
    }

    /* Category */
    .category-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }

    .category-card {
        padding: 20px 15px;
    }

    /* Features - 1 cột */
    .features-grid {
        grid-template-columns: 1fr;
    }

    /* Banner */
    .banner-slide {
        min-height: 400px;
    }

    .banner-content {
        max-width: 100%;
        padding: 30px 0;
    }

        .banner-content h1 {
            font-size: 32px;
        }

        .banner-content p {
            font-size: 15px;
        }

        .banner-content .btn-group {
            flex-direction: column;
            gap: 12px;
        }

        .banner-content .btn {
            width: 100%;
            justify-content: center;
            padding: 14px 25px;
        }

    /* Section Headers */
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

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

        .section-title::before {
            width: 4px;
            height: 24px;
        }

    /* Footer */
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .footer-about {
        text-align: center;
    }

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

    .footer-bottom .container {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }

    /* Toolbar */
    .toolbar {
        flex-wrap: wrap;
        gap: 10px;
    }

    .toolbar-left,
    .toolbar-right {
        width: 100%;
        justify-content: space-between;
    }

    /* Pagination */
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }

    /* Mini cart dropdown - ẩn hover, chuyển sang click */
    .mini-cart-dropdown {
        display: none;
    }

    /* Product tabs */
    .product-tabs .tab-nav {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

        .product-tabs .tab-nav::-webkit-scrollbar {
            display: none;
        }

        .product-tabs .tab-nav button {
            white-space: nowrap;
            flex-shrink: 0;
            padding: 14px 20px;
        }
}

/* ========================================
   SMALL DEVICES (576px - 767px)
   Điện thoại lớn (iPhone Plus, Pro Max, Galaxy Note)
   ======================================== */
@media (max-width: 767px) {
    .container {
        max-width: 100%;
        padding: 0 15px;
    }

    /* Typography scaling */
    body {
        font-size: 14px;
    }

    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    h4 {
        font-size: 1.1rem;
    }

    /* Header */
    .header-main {
        padding: 10px 0;
    }

    .logo {
        gap: 10px;
    }

    .logo-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
        border-radius: 10px;
    }

    .logo-text .brand {
        font-size: 18px;
    }

    .logo-text .tagline {
        display: none;
    }

    .header-actions {
        gap: 8px;
    }

    .header-action-item .icon-wrap {
        width: 42px;
        height: 42px;
        font-size: 18px;
    }

    .header-action-item .badge {
        width: 18px;
        height: 18px;
        font-size: 10px;
    }

    .search-box input {
        padding: 10px 15px;
        font-size: 14px;
    }

    .search-box button {
        padding: 10px 18px;
    }

    /* Products Grid */
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .product-card {
        border-radius: 12px;
    }

        .product-card .product-image {
            padding: 12px;
        }

        .product-card .product-badges {
            top: 10px;
            left: 10px;
        }

        .product-card .badge {
            padding: 4px 8px;
            font-size: 10px;
        }

        .product-card .product-info {
            padding: 12px;
        }

        .product-card .product-category {
            font-size: 11px;
            margin-bottom: 5px;
        }

        .product-card .product-name {
            font-size: 13px;
            min-height: 38px;
            margin-bottom: 8px;
            line-height: 1.4;
        }

        .product-card .product-rating {
            margin-bottom: 8px;
        }

            .product-card .product-rating .stars {
                font-size: 11px;
            }

            .product-card .product-rating .count {
                font-size: 10px;
            }

        .product-card .product-price {
            flex-direction: column;
            align-items: flex-start;
            gap: 4px;
            margin-bottom: 10px;
        }

        .product-card .current-price {
            font-size: 15px;
        }

        .product-card .old-price {
            font-size: 11px;
        }

        .product-card .btn-add-cart {
            padding: 10px;
            font-size: 12px;
            border-radius: 8px;
        }

    /* Category Grid */
    .category-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .category-card {
        padding: 15px 10px;
        border-radius: 12px;
    }

        .category-card img {
            width: 50px;
            height: 50px;
        }

        .category-card h3 {
            font-size: 13px;
            margin: 10px 0 5px;
        }

        .category-card p {
            font-size: 11px;
        }

    /* Banner */
    .banner-slide {
        min-height: 350px;
    }

    .banner-content {
        padding: 20px 0;
    }

        .banner-content .subtitle {
            padding: 6px 14px;
            font-size: 12px;
            margin-bottom: 15px;
        }

        .banner-content h1 {
            font-size: 26px;
            margin-bottom: 15px;
            line-height: 1.3;
        }

        .banner-content p {
            font-size: 14px;
            margin-bottom: 20px;
        }

        .banner-content .btn {
            padding: 12px 20px;
            font-size: 13px;
        }

    .banner-nav {
        bottom: 20px;
    }

        .banner-nav button {
            width: 10px;
            height: 10px;
        }

    /* Section Headers */
    .section-title {
        font-size: 20px;
        padding-left: 12px;
    }

        .section-title::before {
            width: 3px;
            height: 20px;
        }

    .view-all-link {
        font-size: 13px;
    }

    /* Sidebar Widgets */
    .sidebar-widget {
        padding: 20px 15px;
    }

    .sidebar-widget-title {
        font-size: 16px;
        margin-bottom: 15px;
    }

    .category-list li a {
        padding: 10px 12px;
        font-size: 13px;
    }

    /* Product Detail */
    .product-detail-info h1 {
        font-size: 20px;
    }

    .product-detail-info .current-price {
        font-size: 24px;
    }

    .product-detail-info .old-price {
        font-size: 16px;
    }

    .product-detail-info .action-buttons {
        flex-direction: column;
        gap: 10px;
    }

    .product-detail-info .btn {
        width: 100%;
    }

    .product-tabs .tab-nav button {
        padding: 12px 16px;
        font-size: 13px;
    }

    .specs-table th,
    .specs-table td {
        padding: 10px 12px;
        font-size: 13px;
    }

    .specs-table th {
        width: 110px;
    }

    /* Footer */
    .footer-main {
        padding: 40px 0;
    }

    .footer-col h4 {
        font-size: 16px;
        margin-bottom: 15px;
    }

    .footer-links li a,
    .footer-contact li {
        font-size: 13px;
    }

    .footer-bottom {
        padding: 20px 0;
    }

        .footer-bottom p {
            font-size: 12px;
        }

    .payment-methods img {
        height: 25px;
    }

    /* Breadcrumb */
    .breadcrumb {
        padding: 15px 0;
        font-size: 12px;
    }

        .breadcrumb a,
        .breadcrumb span {
            padding: 0 6px;
        }

    /* Pagination */
    .pagination a,
    .pagination span {
        min-width: 38px;
        height: 38px;
        font-size: 13px;
    }

    /* Forms */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    input[type="password"],
    textarea,
    select {
        padding: 12px 14px;
        font-size: 14px;
        border-radius: 8px;
    }

    /* Buttons */
    .btn {
        padding: 12px 20px;
        font-size: 14px;
        border-radius: 8px;
    }

    .btn-lg {
        padding: 14px 24px;
        font-size: 15px;
    }

    /* Mobile Navigation */
    .mobile-nav {
        max-width: 300px;
    }

    .mobile-nav-header {
        padding: 15px;
    }

    .mobile-nav-menu > li > a {
        padding: 14px 15px;
        font-size: 14px;
    }

    .mobile-submenu li a {
        padding: 10px 15px 10px 35px;
        font-size: 13px;
    }
}

/* ========================================
   EXTRA SMALL DEVICES (414px - 575px)
   Điện thoại trung bình (iPhone Pro Max, Galaxy S Ultra)
   ======================================== */
@media (max-width: 575px) {
    .container {
        padding: 0 12px;
    }

    /* Header */
    .logo-icon {
        width: 38px;
        height: 38px;
        font-size: 16px;
        border-radius: 8px;
    }

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

    .header-actions {
        gap: 6px;
    }

    .header-action-item .icon-wrap {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .mobile-menu-toggle {
        width: 40px;
        height: 40px;
    }

    .search-box {
        margin-top: 10px;
    }

        .search-box input {
            padding: 10px 12px;
            font-size: 13px;
        }

        .search-box button {
            padding: 10px 15px;
            font-size: 14px;
        }

    /* Products */
    .product-grid {
        gap: 10px;
    }

    .product-card .product-image {
        padding: 10px;
    }

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

    .product-card .product-name {
        font-size: 12px;
        min-height: 34px;
    }

    .product-card .current-price {
        font-size: 14px;
    }

    .product-card .old-price {
        font-size: 10px;
    }

    .product-card .btn-add-cart {
        padding: 8px;
        font-size: 11px;
    }

    /* Category */
    .category-card {
        padding: 12px 8px;
    }

        .category-card img {
            width: 45px;
            height: 45px;
        }

        .category-card h3 {
            font-size: 12px;
        }

        .category-card p {
            font-size: 10px;
        }

    /* Banner */
    .banner-slide {
        min-height: 300px;
    }

    .banner-content h1 {
        font-size: 22px;
    }

    .banner-content p {
        font-size: 13px;
    }

    .banner-content .btn {
        padding: 10px 18px;
        font-size: 12px;
    }

    /* Section Headers */
    .section-title {
        font-size: 18px;
    }

    /* Sidebar */
    .sidebar-widget {
        padding: 15px 12px;
    }

    .sidebar-widget-title {
        font-size: 15px;
    }

    /* Product Detail */
    .product-detail-info h1 {
        font-size: 18px;
    }

    .product-detail-info .current-price {
        font-size: 22px;
    }

    .product-detail-info .old-price {
        font-size: 14px;
    }

    .product-tabs .tab-nav button {
        padding: 10px 14px;
        font-size: 12px;
    }

    /* Footer */
    .footer-main {
        padding: 30px 0;
    }

    .footer-col h4 {
        font-size: 15px;
    }

    /* Pagination */
    .pagination a,
    .pagination span {
        min-width: 36px;
        height: 36px;
        font-size: 12px;
    }

    /* Buttons */
    .btn {
        padding: 10px 16px;
        font-size: 13px;
    }
}

/* ========================================
   MINI DEVICES (375px - 413px)
   Điện thoại nhỏ (iPhone 12/13/14, Galaxy S)
   ======================================== */
@media (max-width: 413px) {
    .container {
        padding: 0 10px;
    }

    /* Header */
    .logo {
        gap: 8px;
    }

    .logo-icon {
        width: 36px;
        height: 36px;
        font-size: 15px;
    }

    .logo-text .brand {
        font-size: 15px;
    }

    .header-action-item .icon-wrap {
        width: 38px;
        height: 38px;
        font-size: 15px;
    }

    .header-action-item .badge {
        width: 16px;
        height: 16px;
        font-size: 9px;
        top: -3px;
        right: -3px;
    }

    /* Products - có thể chuyển sang 1 cột */
    .product-grid {
        gap: 8px;
    }

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

    .product-card .product-name {
        font-size: 11px;
        min-height: 30px;
        -webkit-line-clamp: 2;
    }

    .product-card .product-rating {
        display: none;
    }

    .product-card .product-price {
        margin-bottom: 8px;
    }

    .product-card .current-price {
        font-size: 13px;
    }

    .product-card .old-price {
        font-size: 9px;
    }

    .product-card .btn-add-cart {
        padding: 7px;
        font-size: 10px;
    }

    /* Category */
    .category-card {
        padding: 10px 6px;
    }

        .category-card img {
            width: 40px;
            height: 40px;
        }

        .category-card h3 {
            font-size: 11px;
            margin: 8px 0 3px;
        }

        .category-card p {
            display: none;
        }

    /* Banner */
    .banner-slide {
        min-height: 280px;
    }

    .banner-content h1 {
        font-size: 20px;
    }

    .banner-content p {
        font-size: 12px;
        margin-bottom: 15px;
    }

    .banner-content .subtitle {
        padding: 5px 12px;
        font-size: 11px;
    }

    .banner-content .btn {
        padding: 10px 16px;
        font-size: 11px;
    }

    /* Section */
    .section-title {
        font-size: 16px;
        padding-left: 10px;
    }

        .section-title::before {
            width: 3px;
            height: 18px;
        }

    .view-all-link {
        font-size: 12px;
    }

    /* Product Detail */
    .product-detail-info h1 {
        font-size: 16px;
    }

    .product-detail-info .current-price {
        font-size: 20px;
    }

    /* Pagination - chỉ hiện một số trang */
    .pagination a:not(.prev):not(.next):not(.active),
    .pagination span.dots {
        display: none;
    }

    .pagination a.prev,
    .pagination a.next,
    .pagination a.active,
    .pagination span.current {
        display: flex;
    }
}

/* ========================================
   TINY DEVICES (<= 374px)
   Điện thoại rất nhỏ (iPhone SE, Galaxy A series)
   ======================================== */
@media (max-width: 374px) {
    .container {
        padding: 0 8px;
    }

    /* Header - rất compact */
    .header-main {
        padding: 8px 0;
    }

    .logo-icon {
        width: 34px;
        height: 34px;
        font-size: 14px;
    }

    .logo-text .brand {
        font-size: 14px;
    }

    .header-action-item .icon-wrap {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .mobile-menu-toggle {
        width: 36px;
        height: 36px;
    }

        .mobile-menu-toggle span {
            width: 20px;
        }

    /* Search */
    .search-box input {
        padding: 8px 10px;
        font-size: 12px;
    }

    .search-box button {
        padding: 8px 12px;
        font-size: 13px;
    }

    /* Products - chuyển sang 1 cột cho dễ nhìn */
    .product-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .product-card {
        display: flex;
        flex-direction: row;
        align-items: stretch;
    }

        .product-card .product-image {
            width: 120px;
            flex-shrink: 0;
            padding: 10px;
        }

        .product-card .product-badges {
            top: 5px;
            left: 5px;
        }

        .product-card .badge {
            padding: 3px 6px;
            font-size: 9px;
        }

        .product-card .product-info {
            flex: 1;
            display: flex;
            flex-direction: column;
            justify-content: center;
            padding: 10px;
        }

        .product-card .product-name {
            font-size: 13px;
            min-height: auto;
            margin-bottom: 6px;
            -webkit-line-clamp: 2;
        }

        .product-card .product-rating {
            display: flex;
            margin-bottom: 6px;
        }

        .product-card .product-price {
            flex-direction: row;
            align-items: center;
            gap: 8px;
        }

        .product-card .current-price {
            font-size: 15px;
        }

        .product-card .old-price {
            font-size: 11px;
        }

        .product-card .btn-add-cart {
            padding: 8px 12px;
            font-size: 11px;
            align-self: flex-start;
        }

    /* Category - 2 cột nhỏ hơn */
    .category-grid {
        gap: 8px;
    }

    .category-card {
        padding: 8px 5px;
    }

        .category-card img {
            width: 35px;
            height: 35px;
        }

        .category-card h3 {
            font-size: 10px;
        }

    /* Banner - rất compact */
    .banner-slide {
        min-height: 250px;
    }

    .banner-content h1 {
        font-size: 18px;
    }

    .banner-content p {
        font-size: 11px;
    }

    .banner-content .subtitle {
        font-size: 10px;
        padding: 4px 10px;
    }

    .banner-content .btn {
        padding: 8px 14px;
        font-size: 10px;
    }

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

    /* Sidebar */
    .sidebar-widget {
        padding: 12px 10px;
    }

    .sidebar-widget-title {
        font-size: 14px;
    }

    .category-list li a {
        padding: 8px 10px;
        font-size: 12px;
    }

    /* Product Detail */
    .product-detail-info h1 {
        font-size: 15px;
    }

    .product-detail-info .current-price {
        font-size: 18px;
    }

    .product-detail-info .old-price {
        font-size: 12px;
    }

    .product-tabs .tab-nav {
        padding: 0;
    }

        .product-tabs .tab-nav button {
            padding: 8px 10px;
            font-size: 11px;
        }

    .specs-table th,
    .specs-table td {
        padding: 8px;
        font-size: 12px;
    }

    .specs-table th {
        width: 90px;
    }

    /* Footer */
    .footer-main {
        padding: 25px 0;
    }

    .footer-col h4 {
        font-size: 14px;
        margin-bottom: 12px;
    }

    .footer-links li a,
    .footer-contact li {
        font-size: 12px;
    }

    .footer-bottom p {
        font-size: 11px;
    }

    .payment-methods img {
        height: 22px;
    }

    /* Buttons */
    .btn {
        padding: 8px 14px;
        font-size: 12px;
    }

    /* Breadcrumb */
    .breadcrumb {
        font-size: 11px;
        padding: 12px 0;
    }

    /* Mobile Navigation */
    .mobile-nav {
        max-width: 280px;
    }

    .mobile-nav-menu > li > a {
        padding: 12px;
        font-size: 13px;
    }
}

/* ========================================
   LANDSCAPE MODE - Điện thoại nằm ngang
   ======================================== */
@media (max-height: 500px) and (orientation: landscape) {
    .banner-slide {
        min-height: 100vh;
    }

    .banner-content {
        padding: 15px 0;
    }

        .banner-content h1 {
            font-size: 24px;
            margin-bottom: 10px;
        }

        .banner-content p {
            font-size: 13px;
            margin-bottom: 15px;
        }

        .banner-content .btn {
            padding: 10px 20px;
        }

    /* Product grid - hiển thị nhiều cột hơn khi nằm ngang */
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Sticky header - giảm height */
    .header-main {
        padding: 8px 0;
    }

    .logo-icon {
        width: 35px;
        height: 35px;
    }

    .header-action-item .icon-wrap {
        width: 35px;
        height: 35px;
    }

    /* Hide search on landscape mobile */
    .search-box {
        display: none;
    }

    /* Footer - compact */
    .footer-main {
        padding: 20px 0;
    }
}

/* ========================================
   HIGH DPI SCREENS (Retina)
   ======================================== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Thinner borders for retina */
    .product-card,
    .category-card,
    .sidebar,
    input,
    select,
    textarea {
        border-width: 0.5px;
    }
}

/* ========================================
   DARK MODE SUPPORT (Optional)
   ======================================== */
@media (prefers-color-scheme: dark) {
    /* Uncomment để enable dark mode
    :root {
        --light-color: #1a1a2e;
        --white: #16213e;
        --dark-color: #e9ecef;
        --gray: #adb5bd;
        --gray-light: #2a2a4a;
        --gray-dark: #d4d4d4;
    }
    */
}

/* ========================================
   REDUCED MOTION
   Hỗ trợ người dùng không thích animation
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

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

    .banner-content .subtitle,
    .banner-content h1,
    .banner-content p,
    .banner-content .btn-group {
        animation: none;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
    .header,
    .top-bar,
    .main-nav,
    .footer,
    .mobile-nav,
    .mobile-nav-overlay,
    .search-box,
    .product-actions,
    .btn-add-cart,
    .pagination,
    .breadcrumb {
        display: none !important;
    }

    body {
        font-size: 12pt;
        color: #000;
        background: #fff;
    }

    .container {
        max-width: 100%;
        padding: 0;
    }

    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .product-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ========================================
   SPECIFIC COMPONENT FIXES FOR MOBILE
   ======================================== */

/* Cart Page Mobile */
@media (max-width: 767px) {
    .cart-table {
        display: block;
    }

        .cart-table thead {
            display: none;
        }

        .cart-table tbody {
            display: block;
        }

        .cart-table tr {
            display: flex;
            flex-wrap: wrap;
            padding: 15px;
            border-bottom: 1px solid var(--gray-light);
            position: relative;
        }

        .cart-table td {
            border: none;
            padding: 5px 0;
        }

            .cart-table td.product-thumbnail {
                width: 80px;
            }

            .cart-table td.product-name {
                flex: 1;
                padding-left: 15px;
            }

            .cart-table td.product-price,
            .cart-table td.product-quantity,
            .cart-table td.product-subtotal {
                width: 33.33%;
            }

            .cart-table td.product-remove {
                position: absolute;
                top: 10px;
                right: 10px;
            }

    /* Checkout Mobile */
    .checkout-grid {
        grid-template-columns: 1fr;
    }

    .checkout-sidebar {
        order: -1;
        margin-bottom: 20px;
    }

    /* Contact Form Mobile */
    .contact-grid {
        grid-template-columns: 1fr;
    }

    .contact-info {
        order: -1;
    }

    /* Blog Mobile */
    .blog-grid {
        grid-template-columns: 1fr;
    }

    .blog-sidebar {
        margin-top: 30px;
    }

    /* Comments Mobile */
    .comment-list .comment-reply {
        margin-left: 20px;
    }

    .comment .comment-avatar {
        width: 40px;
        height: 40px;
    }

    .comment-form .form-row {
        flex-direction: column;
        gap: 15px;
    }
}

/* ========================================
   ACCESSIBILITY IMPROVEMENTS
   ======================================== */

/* Focus states cho keyboard navigation */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Skip link cho screen readers */
.skip-link {
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: white;
    padding: 10px 20px;
    z-index: 10000;
    border-radius: 0 0 8px 8px;
}

    .skip-link:focus {
        top: 0;
    }

/* Better touch targets */
@media (max-width: 767px) {
    .footer-links li a,
    .mobile-nav-menu > li > a {
        padding-top: 12px;
        padding-bottom: 12px;
    }
}
