:root {
    /* Bảng màu */
    --primary: #D84315;
    --primary-dark: #BF360C;
    --secondary: #FFF8E1;
    --text-dark: #3E2723;
    --text-gray: #5D4037;
    --white: #FFFFFF;
    --gray-light: #EEEEEE;
    --success: #2E7D32;
    --border: #E0E0E0;
    --error: #d32f2f;
    
    /* Khoảng cách & Bo góc */
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    
    --header-height: 60px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
    font-family: 'Inter', sans-serif;
    background-color: var(--secondary);
    color: var(--text-dark);
    margin: 0;
    padding: 0;
    padding-bottom: 80px;
}

h1, h2, h3 { font-family: 'Playfair Display', serif; font-weight: 700; margin: 0; }
.container { max-width: 800px; margin: 0 auto; padding: 0 16px; }

/* Đầu trang */
.main-header {
    background: var(--white);
    height: var(--header-height);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 5px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
}
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.brand-text h1 { font-size: 1.2rem; color: var(--primary); }
.brand-text span { font-size: 0.75rem; color: var(--text-gray); display: block; font-family: 'Inter', sans-serif;}
.header-cart-icon { position: relative; font-size: 1.5rem; color: var(--text-dark); cursor: pointer; }
.badge {
    position: absolute; top: -5px; right: -8px;
    background: var(--primary); color: white;
    font-size: 0.7rem; font-weight: bold;
    padding: 2px 6px; border-radius: 10px;
}

/* Banner */
.hero {
    background: linear-gradient(rgba(0,0,0,0.4), rgba(0,0,0,0.4)), url('https://quynhontourist.vn/wp-content/uploads/2023/01/bun-rieu-cha-ca-tai-09-ha-huy-tap.jpg');
    background-size: cover;
    background-position: center;
    padding: 40px 16px;
    text-align: center;
    color: white;
    margin-bottom: 20px;
}
.hero h2 { font-size: 1.8rem; margin-bottom: 8px; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }
.hero p { font-size: 1rem; opacity: 0.9; margin: 0; }

/* Tìm kiếm & Lọc */
.sticky-nav-wrapper {
    position: sticky;
    top: var(--header-height);
    z-index: 90;
    background: var(--secondary);
    padding: 10px 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.search-box { position: relative; margin-bottom: 12px; }
.search-box input {
    width: 100%;
    padding: 12px 16px 12px 40px;
    border: 1px solid var(--border);
    border-radius: 25px;
    font-size: 0.95rem;
    outline: none;
    background: var(--white);
    transition: 0.3s;
}
.search-box input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(216, 67, 21, 0.1); }
.search-box i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #999; }

.category-scroll {
    display: flex; gap: 10px; overflow-x: auto; padding-bottom: 5px; scrollbar-width: none;
}
.category-scroll::-webkit-scrollbar { display: none; }
.cat-pill {
    white-space: nowrap; border: none; background: var(--white); padding: 8px 16px;
    border-radius: 20px; font-size: 0.9rem; color: var(--text-gray); cursor: pointer; transition: 0.2s;
}
.cat-pill.active { background: var(--primary); color: var(--white); font-weight: 500; }

/* Lưới sản phẩm */
.menu-grid {
    display: grid; grid-template-columns: 1fr; gap: 16px; margin-bottom: 40px;
}
@media (min-width: 600px) { .menu-grid { grid-template-columns: repeat(2, 1fr); } }

/* Thẻ sản phẩm */
.product-card {
    background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
    display: flex; flex-direction: row; overflow: hidden; height: 120px; transition: 0.2s;
}
.card-img { width: 120px; position: relative; flex-shrink: 0; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.badge-best {
    position: absolute; top: 0; left: 0; background: #FFC107; color: #000;
    font-size: 0.6rem; font-weight: bold; padding: 2px 6px; border-bottom-right-radius: 8px;
}
.card-info {
    flex-grow: 1; padding: 10px 12px; display: flex; flex-direction: column; justify-content: space-between;
}
.product-name { font-size: 1rem; color: var(--text-dark); margin-bottom: 4px; line-height: 1.2; }
.product-desc { font-size: 0.8rem; color: #888; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-family: 'Inter', sans-serif;}
.card-bottom { display: flex; justify-content: space-between; align-items: center; margin-top: 5px; }
.price { font-weight: 700; color: var(--primary); }

/* Nút tăng giảm số lượng */
.qty-control {
    display: flex; align-items: center; background: var(--gray-light); border-radius: 20px; padding: 2px;
}
.qty-control button {
    width: 28px; height: 28px; border: none; border-radius: 50%; background: var(--white);
    color: var(--primary); display: flex; align-items: center; justify-content: center;
    cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.qty-control button:active { transform: scale(0.9); }
.qty-control input {
    width: 30px; text-align: center; border: none; background: transparent;
    font-weight: 600; font-size: 0.9rem; color: var(--text-dark);
}

/* Khu vực thanh toán */
.checkout-container {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px 20px;
    box-shadow: var(--shadow-md);
    margin-top: 20px;
    border: 1px solid var(--border);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--gray-light);
}

.section-title h2 {
    font-size: 1.4rem;
    color: var(--primary);
    background: transparent !important;
    line-height: 1.2;
}

.section-title i {
    color: var(--primary);
    font-size: 1.4rem;
    background: #FFF3E0;
    padding: 8px;
    border-radius: 8px;
}

.order-id-tag {
    text-align: center;
    font-size: 0.95rem;
    color: #666;
    margin-bottom: 20px;
    font-family: 'Courier New', monospace;
    background: var(--gray-light);
    padding: 6px;
    border-radius: 6px;
    display: inline-block;
    width: 100%;
}

/* Hóa đơn */
.order-receipt {
    background: #FAFAFA;
    border: 1px dashed #BDBDBD;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 30px;
}

#orderTable {
    width: 100%;
    border-collapse: collapse;
}

#orderTable th:nth-child(1) { width: 50%; text-align: left; }
#orderTable th:nth-child(2) { width: 20%; text-align: center; }
#orderTable th:nth-child(3) { width: 30%; text-align: right; }

#orderTable th {
    font-size: 0.8rem;
    color: #757575;
    font-weight: 600;
    text-transform: uppercase;
    padding-bottom: 10px;
    border-bottom: 1px solid #E0E0E0;
}

#orderTable td {
    padding: 12px 0;
    font-size: 0.95rem;
    color: var(--text-dark);
    border-bottom: 1px dashed #E0E0E0;
    vertical-align: middle;
}

#orderTable td:nth-child(1) { text-align: left; font-weight: 500; }
#orderTable td:nth-child(2) { text-align: center; color: #666; }
#orderTable td:nth-child(3) { text-align: right; font-weight: 600; }

#orderTable tfoot td {
    border-top: 2px solid var(--primary);
    border-bottom: none;
    padding-top: 15px;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--primary);
}

.form-group-wrapper h3 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-dark);
}
.form-group-wrapper {
    margin-top: 30px;
}

/* Form nhập liệu & Lỗi */
.input-group { position: relative; margin-bottom: 20px; }
.input-group input, .input-group textarea {
    width: 100%; padding: 12px 12px; border: 1px solid var(--border);
    border-radius: 8px; font-size: 1rem; background: transparent;
    outline: none; transition: 0.3s; font-family: 'Inter', sans-serif;
}
.input-group textarea { height: 80px; resize: none; }
.input-group label {
    position: absolute; left: 12px; top: 12px; color: #999; font-size: 1rem;
    pointer-events: none; transition: 0.3s; background: var(--white); padding: 0 4px;
}
.input-group input:focus, .input-group input:not(:placeholder-shown),
.input-group textarea:focus, .input-group textarea:not(:placeholder-shown) { border-color: var(--primary); }
.input-group input:focus ~ label, .input-group input:not(:placeholder-shown) ~ label,
.input-group textarea:focus ~ label, .input-group textarea:not(:placeholder-shown) ~ label {
    top: -10px; left: 10px; font-size: 0.8rem; color: var(--primary); font-weight: 600;
}
.error-msg { color: var(--error); font-size: 0.8rem; margin-top: 4px; display: none; }
.input-group.error input, .input-group.error textarea { border-color: var(--error); }
.input-group.error .error-msg { display: block; }

/* Thanh toán */
.payment-methods { display: flex; flex-direction: column; gap: 10px; }
.payment-card {
    position: relative; border: 1px solid var(--border); border-radius: 8px;
    padding: 12px; cursor: pointer; transition: 0.2s;
}
.payment-card input { position: absolute; opacity: 0; }
.pay-content { display: flex; align-items: center; gap: 12px; }
.pay-content i { font-size: 1.2rem; color: #757575; }
.payment-card input:checked + .pay-content { color: var(--primary); font-weight: 600; }
.payment-card input:checked + .pay-content i { color: var(--primary); }
.payment-card:has(input:checked) { border-color: var(--primary); background: #FFF3E0; }

.qr-box {
    display: none; margin-top: 15px; text-align: center;
    background: #FAFAFA; padding: 15px; border-radius: 8px; border: 1px dashed var(--border);
}
.qr-box img { max-width: 180px; }

/* Thanh cố định dưới cùng */
.sticky-bottom-bar {
    position: fixed; bottom: 0; left: 0; right: 0; background: var(--white);
    padding: 12px 16px; box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    display: flex; justify-content: space-between; align-items: center; z-index: 100;
    transform: translateY(100%); transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.sticky-bottom-bar.active { transform: translateY(0); }
.bar-info { display: flex; flex-direction: column; }
.bar-count { font-size: 0.8rem; color: #666; }
.bar-total { font-weight: 800; color: var(--primary); font-size: 1.2rem; }
#btnScrollCheckout, #btnRealSubmit, .submit-btn-desktop {
    background: var(--primary); color: white; border: none; padding: 10px 24px;
    border-radius: 25px; font-weight: 600; font-size: 1rem; cursor: pointer;
    display: flex; align-items: center; gap: 8px;
}
#btnRealSubmit { background: var(--success); }
.submit-btn-desktop { width: 100%; justify-content: center; padding: 15px; margin-top: 20px; font-size: 1.1rem; }
@media(max-width: 768px) { .submit-btn-desktop { display: none; } }

/* Nút về đầu trang */
#backToTopBtn {
    position: fixed; bottom: 80px; right: 20px;
    width: 45px; height: 45px; border-radius: 50%;
    background: var(--primary); color: white; border: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    cursor: pointer; z-index: 99;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; transition: 0.3s; opacity: 0; visibility: hidden;
}
#backToTopBtn:hover { background: var(--primary-dark); transform: translateY(-3px); }
#backToTopBtn.show { opacity: 1; visibility: visible; }

/* Popup Thành công */
.popup-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6); z-index: 999; align-items: center; justify-content: center;
}
.popup-content {
    background: white; padding: 30px; border-radius: 16px; text-align: center; width: 85%; max-width: 320px;
    animation: popIn 0.3s;
}
@keyframes popIn { from{transform: scale(0.8); opacity: 0;} to{transform: scale(1); opacity: 1;} }
.icon-box { font-size: 3rem; color: var(--success); margin-bottom: 10px; }
.popup-content button {
    background: var(--text-dark); color: white; border: none; padding: 10px 30px; border-radius: 20px; cursor: pointer;
}

/* Popup Thông báo */
.notice-card {
    background: var(--secondary);
    border: 1px solid var(--primary);
    border-radius: 8px; width: 90%; max-width: 420px;
    position: relative; animation: popIn 0.4s; overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    display: flex; flex-direction: column;
}
.notice-header {
    padding: 20px 20px 10px 20px; text-align: center;
}
.notice-icon {
    font-size: 2.5rem; color: var(--primary); margin-bottom: 10px;
}
.notice-header h3 {
    font-family: 'Playfair Display', serif; color: var(--primary);
    font-size: 1.4rem; margin: 0;
}
.notice-divider {
    width: 60px; height: 3px; background: var(--primary);
    margin: 10px auto 0; border-radius: 2px;
}
.notice-body {
    padding: 0 25px 20px; color: var(--text-dark); font-size: 0.95rem;
    line-height: 1.6; text-align: justify;
}
.notice-body p { margin-bottom: 10px; }
.notice-body .sign-off { text-align: right; font-style: italic; font-weight: 500; margin-top: 15px; }
.notice-btn {
    background: var(--primary); color: white; border: none;
    padding: 15px; font-weight: 600; font-size: 1rem; cursor: pointer;
    transition: 0.3s; text-transform: uppercase; letter-spacing: 1px;
}
.notice-btn:hover { background: var(--primary-dark); }
.popup-close-icon {
    position: absolute; top: 10px; right: 15px; color: var(--text-gray);
    font-size: 1.8rem; cursor: pointer; transition: 0.2s; z-index: 2;
}
.popup-close-icon:hover { color: var(--primary); }

.hero-notice {
    margin-top: 16px;
    display: inline-block;
    background: rgba(0, 0, 0, 0.6);
    color: #FFEB3B;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.95rem;
    font-weight: 600;
    border: 1px solid rgba(255, 235, 59, 0.3);
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    animation: pulseNotice 2s infinite;
}

.hero-notice i {
    margin-right: 6px;
}

@keyframes pulseNotice {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 235, 59, 0.4); }
    70% { transform: scale(1.02); box-shadow: 0 0 0 6px rgba(255, 235, 59, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 235, 59, 0); }
}