/*
 * Responsive Styles
 */

/* ========== MOBILE SEARCH BOX IN MENU ========== */
.mobile-search-box {
    padding: 12px 16px;
    background: #f5f5f5;
    border-bottom: 1px solid #eee;
}

.mobile-search-box form {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #ddd;
}

.mobile-search-box input[type="text"] {
    flex: 1;
    border: none !important;
    padding: 12px 14px !important;
    font-size: 14px !important;
    outline: none !important;
    background: #fff !important;
    box-shadow: none !important;
    margin: 0 !important;
    min-height: auto !important;
}

.mobile-search-box input[type="text"]::placeholder {
    color: #999;
}

.mobile-search-box button {
    background: linear-gradient(135deg, #B8956C, #D4B896);
    border: none !important;
    padding: 12px 16px !important;
    color: #fff;
    cursor: pointer;
    transition: opacity 0.2s ease;
    font-size: 16px;
}

.mobile-search-box button:hover {
    opacity: 0.9;
}

/* ========== MOBILE MENU SLIDE-IN ========== */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

.mobile-menu-panel {
    position: fixed;
    top: 0;
    right: -300px;
    width: 300px;
    height: 100%;
    background: #fff;
    z-index: 9999;
    overflow-y: auto;
    transition: right 0.3s ease;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.15);
}

.mobile-menu-panel.active {
    right: 0;
}

.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    color: #fff;
}

.mobile-menu-title {
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
}

.mobile-menu-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.mobile-menu-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Menu chính */
.mobile-main-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    border-bottom: 1px solid #eee;
}

.mobile-main-menu li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: #333;
    font-size: 15px;
    font-weight: 600;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.2s ease;
}

.mobile-main-menu li a:hover,
.mobile-main-menu li a:active {
    background: #f8f8f8;
    color: #B8956C;
}

.mobile-main-menu li a i {
    width: 20px;
    color: #B8956C;
    font-size: 16px;
}

/* Danh mục title */
.mobile-cat-title {
    padding: 14px 20px;
    background: linear-gradient(135deg, #B8956C 0%, #D4B896 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Danh mục menu */
.mobile-cat-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-cat-menu > li > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    color: #444;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.2s ease;
}

.mobile-cat-menu > li > a:hover,
.mobile-cat-menu > li > a:active {
    background: #faf8f5;
    color: #B8956C;
}

.mobile-cat-menu .toggle-sub {
    font-size: 12px;
    color: #999;
    transition: transform 0.3s ease;
}

.mobile-cat-menu > li.submenu-open > a .toggle-sub {
    transform: rotate(180deg);
    color: #B8956C;
}

/* Submenu */
.mobile-sub-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: none;
    background: #f8f8f8;
}

.mobile-cat-menu > li.submenu-open > .mobile-sub-menu {
    display: block;
}

.mobile-sub-menu li a {
    display: block;
    padding: 10px 20px 10px 35px;
    color: #666;
    font-size: 13px;
    border-bottom: 1px solid #eee;
    transition: all 0.2s ease;
}

.mobile-sub-menu li a:hover,
.mobile-sub-menu li a:active {
    color: #B8956C;
    background: #f0ebe5;
}

/* Body lock khi menu mở */
body.mobile-menu-open {
    overflow: hidden;
}

/* Ẩn mobile menu trên desktop */
.mobile-menu-overlay,
.mobile-menu-panel {
    display: none;
}

@media (max-width: 992px) {
    .mobile-menu-overlay,
    .mobile-menu-panel {
        display: block;
    }

    /* Ẩn main-nav hoàn toàn trên mobile - dùng mobile menu riêng */
    .main-nav {
        display: none !important;
    }
}

/* Tablet (992px and below) */
@media (max-width: 992px) {
    /* Typography Scale Down */
    h1 { font-size: 32px; }
    h2 { font-size: 26px; }
    h3 { font-size: 22px; }

    .tp-product-sidebar,
    .tp-product-share {
        display: none !important;
    }

    /* Header */
    .top-bar .top-left span {
        font-size: 12px;
    }

    .search-box,
    .contact-box,
    .header-actions {
        display: none;
    }

    /* Mobile Header Layout: Nav (left) | Logo (center) | Cart (right) */
    .main-header .container {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: relative;
    }

    .mobile-toggle {
        display: flex;
        order: 1;
        flex-shrink: 0;
    }

    .logo {
        order: 2;
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
    }

    .mobile-cart-icon {
        display: flex;
        order: 3;
        flex-shrink: 0;
    }

    /* Ẩn menu ngang trên mobile */
    .main-menu-horizontal {
        display: none;
    }

    /* Hero Grid - Chuyển sang 1 cột, ẩn khoảng trống menu */
    .hero-grid-inner {
        flex-direction: column;
    }

    .hero-grid-inner::before {
        display: none;
    }

    /* Product Grid */
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-md);
    }

    /* Sản phẩm bán chạy - chỉ hiện 6 sản phẩm trên mobile */
    .featured-grid .product-card:nth-child(n+7) {
        display: none;
    }

    .related.products ul.products,
    .upsells.products ul.products {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Footer */
    .footer-grid {
        grid-template-columns: 1fr;
        gap: var(--space-xl);
        text-align: center;
    }

    .footer-title::after {
        left: 50%;
        transform: translateX(-50%);
    }

    .footer-info p {
        justify-content: center;
    }

    .footer-links a {
        justify-content: center;
    }

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

    /* Solid Bottom Contact Bar Layout */
    body {
        padding-bottom: 96px !important;
    }

    .float-contact {
        left: 20px;
        right: 20px;
        bottom: 30px;
        width: calc(100% - 40px);
        flex-direction: row;
        gap: 12px;
        z-index: 99999;
        background: transparent;
        box-shadow: none;
        height: auto;
        padding: 0;
        margin: 0;
    }

    .float-contact a {
        flex: 1;
        height: 48px;
        border-radius: 24px !important; /* Rounded pill shape buttons */
        font-size: 14px;
        padding: 0 16px;
        margin: 0;
        justify-content: center;
        gap: 8px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .float-contact .btn-phone {
        background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
        animation: none !important;
    }

    .float-contact .btn-phone i {
        font-size: 16px;
    }

    .float-contact .btn-zalo {
        background: linear-gradient(135deg, #0068ff 0%, #004ecc 100%);
    }

    .float-contact .btn-zalo .zalo-icon {
        width: 24px;
        height: 24px;
        background: #fff;
        color: #0068ff;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 12px;
        font-weight: 900;
    }

    .float-contact .btn-messenger {
        display: none !important;
    }

    .back-to-top {
        right: var(--space-md);
        bottom: 64px; /* Position above solid bottom bar */
        width: 44px;
        height: 44px;
        font-size: 18px;
    }

    /* WooCommerce */
    form.woocommerce-checkout {
        grid-template-columns: 1fr;
    }

    #order_review {
        position: static;
    }

    .shop-toolbar-premium {
        flex-direction: column;
        gap: var(--space-md);
        text-align: center;
    }

    .page-header-premium .page-title {
        font-size: 28px;
    }
}

/* Mobile (576px and below) */
@media (max-width: 576px) {
    /* Typography */
    h1 { font-size: 26px; }
    h2 { font-size: 22px; }
    h3 { font-size: 18px; }

    /* Container */
    .container,
    .azezy-container {
        padding: 0 var(--space-sm);
    }

    /* Header */
    .top-bar {
        padding: 6px 0;
    }

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

    .top-bar .top-right {
        width: 100%;
        justify-content: center;
    }

    .main-header {
        padding: var(--space-md) 0;
    }

    .logo img {
        height: 45px;
    }

    /* Product Grid */
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-sm);
    }

    .product-card .product-title a {
        font-size: 13px;
    }

    .product-card .price-text,
    .product-card .price-text .woocommerce-Price-amount,
    .product-card .price,
    .product-card .price .woocommerce-Price-amount {
        font-size: 14px !important;
        letter-spacing: -0.5px;
        white-space: nowrap;
    }

    /* Section Titles */
    .section-title-farmer h2,
    .section-header h2 {
        font-size: 22px;
    }

    /* Slider */
    .main-slider .slide-item img {
        aspect-ratio: 16 / 9;
    }

    .slider-dots {
        bottom: var(--space-md);
    }

    .slider-dots span {
        width: 10px;
        height: 10px;
    }

    /* Footer */
    .footer-top {
        padding: var(--space-2xl) 0;
    }

    /* Buttons */
    .view-all-bottom {
        padding: 10px var(--space-lg);
        font-size: 13px;
    }

    /* Floating Contact text replacement for compact mobile viewports */
    .float-contact .btn-phone .phone-number {
        font-size: 0;
    }
    .float-contact .btn-phone .phone-number::after {
        content: "Gọi ngay";
        font-size: 13px;
    }

    /* WooCommerce */
    .page-header-premium {
        padding: var(--space-xl) 0;
    }

    .page-header-premium .page-title {
        font-size: 24px;
    }

    .shop-toolbar-premium {
        padding: var(--space-md);
    }

    .woocommerce-ordering select {
        min-width: 100%;
    }

    .entry-summary {
        padding: var(--space-md);
    }

    .entry-summary .product_title {
        font-size: 22px;
    }

    .entry-summary .price {
        font-size: 22px;
    }

    .woocommerce-tabs ul.tabs {
        flex-wrap: wrap;
    }

    .woocommerce-tabs ul.tabs li a {
        padding: 10px var(--space-md);
        font-size: 13px;
    }

    .woocommerce-tabs .panel {
        padding: var(--space-md);
    }

    .related.products ul.products,
    .upsells.products ul.products {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-sm);
    }
}

/* Extra Small (375px and below) */
@media (max-width: 375px) {
    .product-grid {
        grid-template-columns: 1fr;
    }

    .product-card .product-img {
        aspect-ratio: 4 / 3;
    }
}

/* Print Styles */
@media print {
    .site-header,
    .main-nav,
    .float-contact,
    .back-to-top,
    .site-footer {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    a {
        color: black;
        text-decoration: underline;
    }
}
