/* =========================================================
 * Custom Menu Template (Thực đơn)
 * ========================================================= */

.tv-cmenu-wrapper {
    font-family: 'Be Vietnam Pro', sans-serif;
    background: #f8f9fa; /* Nền nhạt cho phần dưới */
    min-height: 100vh;
}

/* --- Hero Section --- */
.tv-cmenu-hero {
    background-color: #660000;
    padding: 60px 20px;
    text-align: center;
    position: relative;
    /* Có thể thêm background pattern/image mờ ở đây */
}

.tv-cmenu-hero-inner {
    max-width: 800px;
    margin: 0 auto;
}

.tv-cmenu-title {
    color: #f69320;
    font-size: 48px;
    font-weight: 800;
    margin-bottom: 16px;
    text-transform: none;
}

.tv-cmenu-desc {
    color: #fff;
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 30px;
    opacity: 0.9;
}

.tv-cmenu-search {
    max-width: 500px;
    margin: 0 auto;
}

.tv-cmenu-search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.tv-cmenu-search-box input {
    width: 100%;
    height: 48px;
    border-radius: 99px;
    border: none;
    padding: 0 50px 0 24px;
    font-size: 15px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transition: all 0.3s;
}

.tv-cmenu-search-box input:focus {
    background: rgba(255, 255, 255, 0.15);
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 168, 39, 0.5);
}

.tv-cmenu-search-box input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.tv-cmenu-search-btn {
    position: absolute;
    right: 16px;
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
}

/* --- Sticky Navbar --- */
.tv-cmenu-nav-wrapper {
    background: #f69320;
    position: sticky;
    top: 0; /* Cho sticky header */
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    /* Adjust top if Flatsome header is sticky */
}

/* Fallback for Flatsome sticky header (approx 90px) */
body.has-sticky-header .tv-cmenu-nav-wrapper {
    top: 90px;
}
@media (max-width: 849px) {
    body.has-sticky-header .tv-cmenu-nav-wrapper {
        top: 60px; /* Mobile header height approx */
    }
}

.tv-cmenu-nav {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    display: flex;
    align-items: center;
}

.tv-cmenu-nav-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-x: auto;
    scroll-behavior: smooth;
    -ms-overflow-style: none; /* IE/Edge */
    scrollbar-width: none; /* Firefox */
}

.tv-cmenu-nav-list::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.tv-cmenu-nav-item {
    flex-shrink: 0;
}

.tv-cmenu-nav-item a {
    display: block;
    padding: 16px 20px;
    color: rgba(19, 78, 52, 0.7);
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
    transition: all 0.2s;
    white-space: nowrap;
}

.tv-cmenu-nav-item a:hover {
    color: #660000;
}

.tv-cmenu-nav-item.active a {
    color: #660000;
    border-bottom: 3px solid #660000;
}

/* Arrows for Nav */
.tv-cmenu-nav-arrow {
    background: transparent;
    border: none;
    color: #660000;
    font-size: 16px;
    cursor: pointer;
    padding: 0 15px;
    height: 100%;
    position: absolute;
    top: 0;
    z-index: 2;
    background: linear-gradient(to right, #f69320, rgba(255,168,39,0));
}
.tv-cmenu-nav-arrow.right {
    right: 0;
    background: linear-gradient(to left, #f69320, rgba(255,168,39,0));
}
.tv-cmenu-nav-arrow.left {
    left: 0;
}

/* --- Content Sections --- */
.tv-cmenu-content {
    padding: 40px 20px;
}

.tv-cmenu-container {
    max-width: 1200px;
    margin: 0 auto;
}

.tv-cmenu-section {
    margin-bottom: 50px;
}

.tv-cmenu-section-title {
    color: #660000;
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 24px;
    position: relative;
    display: inline-block;
}

/* --- Product Cards Grid --- */
.tv-cmenu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}

@media (max-width: 767px) {
    .tv-cmenu-grid {
        grid-template-columns: 1fr;
    }
}

/* Custom Card Layout (Horizontal) */
.tv-cmenu-card {
    display: flex;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    height: 120px;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid #f0f0f0;
}

.tv-cmenu-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.08);
}

.tv-cmenu-card-img {
    width: 120px;
    flex-shrink: 0;
}

.tv-cmenu-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tv-cmenu-card-info {
    padding: 12px 16px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
}

.tv-cmenu-card-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin: 0 0 6px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tv-cmenu-card-price {
    color: #660000;
    font-weight: 800;
    font-size: 15px;
}
.tv-cmenu-card-price .amount {
    font-weight: inherit;
    color: inherit;
}

.tv-cmenu-card-btn {
    position: absolute;
    bottom: 12px;
    right: 16px;
    background: #d19a29 !important; /* Yellow/Gold */
    color: #fff !important;
    border: 2px solid #fff !important; /* White border */
    border-radius: 50% !important;
    width: 44px !important;
    height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
    margin: 0 !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15) !important;
    text-transform: none !important;
    text-decoration: none !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
}

.tv-cmenu-card-btn:hover {
    transform: scale(1.08);
    background: #b58320 !important;
    color: #fff !important;
}

/* Loading state for Add to cart button */
.tv-cmenu-card-btn.loading {
    opacity: 1 !important;
    pointer-events: none;
    color: transparent !important;
    width: 44px !important; /* Force keep size */
    height: 44px !important;
    padding: 0 !important;
    top: auto !important;
    left: auto !important;
    bottom: 12px !important;
    right: 16px !important;
    transform: none !important;
}

/* Fix for Flatsome wrapping the button in a relative div during AJAX */
.tv-cmenu-card-info > div:not(.tv-cmenu-card-price),
.tv-cmenu-card-info .add-to-cart-button,
.tv-cmenu-card-info .add-to-cart-grid {
    position: static !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 0 !important;
    height: 0 !important;
}

/* Hide any loading text Flatsome might inject */
.tv-cmenu-card-btn.loading .loading-spin,
.tv-cmenu-card-btn.loading span,
.tv-cmenu-card-btn.loading i {
    display: none !important;
}

.tv-cmenu-card-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -8px;
    margin-left: -8px;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: tv-cmenu-spin 0.6s linear infinite;
    display: block !important;
}

@keyframes tv-cmenu-spin {
    to { transform: rotate(360deg); }
}

/* Prevent WooCommerce from hiding the button after adding, and hide the View Cart link */
.tv-cmenu-card-btn.added {
    display: flex !important;
}
.tv-cmenu-card-info .added_to_cart {
    display: none !important;
}
/* =========================================================
 * 6. Quick View Modal
 * ========================================================= */
.tv-cmenu-card {
    cursor: pointer;
}

.tv-cmenu-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tv-cmenu-modal-wrap {
    position: relative;
    width: 90%;
    max-width: 480px;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    animation: tvModalFadeIn 0.3s ease;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

@keyframes tvModalFadeIn {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.tv-cmenu-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    width: 36px;
    height: 36px;
    background: #fff;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    color: #333;
    font-size: 24px;
    font-weight: 300;
    line-height: 1;
}

.tv-cmenu-modal-content {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.tv-cmenu-modal-top {
    position: relative;
}

.tv-cmenu-modal-top img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
}

.tv-cmenu-modal-badge {
    position: absolute;
    bottom: 12px;
    left: 12px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.tv-cmenu-modal-body {
    padding: 24px;
}

.tv-cmenu-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px dashed #eee;
}

.tv-cmenu-modal-title-wrap {
    flex: 1;
    padding-right: 15px;
}

.tv-cmenu-modal-title {
    font-size: 20px;
    font-weight: 700;
    color: #333;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.tv-cmenu-modal-price {
    font-size: 16px;
    font-weight: 700;
    color: #134e34; /* Green matching screenshot */
}

.tv-cmenu-modal-price .amount {
    color: inherit;
    font-weight: inherit;
}

.tv-cmenu-modal-qty {
    display: flex;
    align-items: center;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}

.tv-cmenu-modal-qty .tv-qty-input {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.tv-qty-btn {
    background: #fff;
    border: none;
    width: 32px;
    height: 32px;
    font-size: 18px;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tv-qty-input {
    width: 40px !important;
    height: 32px !important;
    border: none !important;
    border-left: 1px solid #e0e0e0 !important;
    border-right: 1px solid #e0e0e0 !important;
    text-align: center !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #333 !important;
    -moz-appearance: textfield;
    padding: 0 !important;
    background: #fff !important;
    box-shadow: none !important;
    margin: 0 !important;
}
.tv-qty-input::-webkit-outer-spin-button,
.tv-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.tv-cmenu-modal-desc {
    font-size: 14px;
    color: #555;
    line-height: 1.6;
    margin-bottom: 30px;
}
.tv-cmenu-modal-desc p {
    margin-bottom: 12px;
}

.tv-cmenu-modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.tv-cmenu-modal-footer a.added_to_cart {
    display: inline-flex !important;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 800;
    color: #1a4332 !important;
    text-decoration: none !important;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
    cursor: pointer;
}

.tv-cmenu-modal-footer a.added_to_cart:hover {
    color: #ffa827 !important;
}

.tv-cmenu-modal-vat {
    font-size: 13px;
    color: #666;
}

.tv-cmenu-modal-add {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    background: #1a4332 !important; /* Dark green */
    color: #fff !important;
    padding: 10px 20px !important;
    border-radius: 99px !important;
    font-weight: 700 !important;
    font-size: 14px !important;
    text-decoration: none !important;
    border: none !important;
    margin: 0 !important;
    transition: background 0.2s !important;
}

.tv-cmenu-modal-add:hover {
    background: #123023 !important;
}

/* Spinner */
.tv-cmenu-loading,
.tv-cmenu-modal-message {
    min-height: 240px;
    padding: 72px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    text-align: center;
    color: #555;
}

.tv-cmenu-loading-text {
    font-size: 14px;
    font-weight: 700;
    color: #1a4332;
}

.tv-cmenu-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0,0,0,0.1);
    border-top-color: #660000;
    border-radius: 50%;
    animation: tv-cmenu-spin 1s linear infinite;
}

/* Fix flatsome injecting elements into the big button */
.tv-cmenu-modal-add.loading {
    opacity: 0.7 !important;
    pointer-events: none !important;
}
.tv-cmenu-modal-add.added {
    display: inline-flex !important;
}

/* Mobile optimizations */
@media (max-width: 600px) {
    .tv-cmenu-modal-wrap {
        width: 100%;
        max-width: 100%;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
    }
    .tv-cmenu-modal-top img {
        height: 280px;
    }
}

/* Hosting/mobile safety overrides: keep quick-view modal stable even when CSS is minified/merged. */
.tv-cmenu-modal-overlay[style*="display: block"],
.tv-cmenu-modal-overlay[style*="display:block"] {
    display: flex !important;
}
.tv-cmenu-modal-content {
    flex: 1 1 auto;
    max-height: 90vh;
    overflow-y: auto;
}
.tv-cmenu-modal-footer {
    gap: 16px;
}

@media (max-width: 600px) {
    .tv-cmenu-modal-overlay {
        align-items: flex-end;
    }
    .tv-cmenu-modal-content {
        max-height: 100dvh;
    }
    .tv-cmenu-modal-body {
        padding: 20px 24px 22px;
    }
    .tv-cmenu-modal-footer {
        align-items: center;
        gap: 12px;
    }
    .tv-cmenu-modal-add {
        flex-shrink: 0;
    }
}
