/* --- General Styling & Variables --- */
:root {
    --color-primary: #c00;
    --color-secondary: #b38b4c;
    --color-dark: #1a1a1a;
    --color-light: #fff;
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Roboto', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background-color: var(--color-dark);
    color: var(--color-light);
    line-height: 1.6;
}

h1, h2, h3 {
    font-family: var(--font-heading);
    font-weight: 700;
}

h2 {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 2rem;
}

a {
    color: var(--color-light);
    text-decoration: none;
}

ul { list-style: none; }
img { max-width: 100%; display: block; }
section { padding: 5rem 5%; }

.btn {
    display: inline-block;
    padding: 0.8rem 2rem;
    border: 1px solid var(--color-light);
    border-radius: 5px;
    transition: background-color 0.3s, color 0.3s;
    font-weight: bold;
}
.btn:hover {
    background-color: var(--color-light);
    color: var(--color-dark);
}

/* --- Header & Navigation --- */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background-color: rgba(0, 0, 0, 0.85);
    padding: 1rem 5%;
    border-bottom: 1px solid #333;
}
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
/* --- Logo trên Header --- */
nav .logo img {
    height: 75px; /* Tăng chiều cao logo */
    width: auto;  /* Chiều rộng tự động điều chỉnh */
    object-fit: contain;
}
nav .main-nav {
    display: flex;
    gap: 2rem;
}
nav .main-nav li a {
    font-weight: bold;
    letter-spacing: 1px;
    transition: color 0.3s;
}
nav .main-nav li a:hover {
    color: var(--color-secondary);
}
.mobile-nav-toggle { display: none; } /* Sẽ được bật trong responsive */

/* --- Footer --- */
footer {
    background-color: #000;
    padding: 4rem 5% 1rem;
    border: none;
}
.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #333;
    flex-wrap: wrap;
    gap: 2rem;
}
.footer-left {
    flex: 1.5; min-width: 250px;
    display: flex; align-items: center; gap: 1.5rem;
}
.footer-left div { text-align: left; }
.footer-center { flex: 1; min-width: 200px; text-align: center; }
.footer-right { flex: 1; min-width: 200px; text-align: center; }
.footer-logo img {
    height: 120px; /* Logo ở footer có thể lớn hơn một chút */
    width: auto;
    object-fit: contain;
}
.footer-right a { font-size: 1.5rem; margin: 0 0.5rem; }
.footer-bottom {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: #888;
    flex-wrap: wrap;
    gap: 1rem;
    border: none;
}

/* --- Back to Top Button --- */
#back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--color-primary);
    color: var(--color-light);
    width: 40px;
    height: 40px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    text-decoration: none;
    opacity: 0; /* Mặc định ẩn */
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 999;
}
#back-to-top.show {
    opacity: 1;
    visibility: visible;
}

/* --- Menu Section Styling (Tái sử dụng & điều chỉnh) --- */
#menu-slider-section {
    background: var(--color-primary);
    padding: 4rem 5%;
    position: relative;
    overflow: hidden;
}

#menu-slider-section::before, #menu-slider-section::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 150px;
    background: url('../images/menu-bg-trim.jpg') no-repeat center center;
    background-size: cover;
    opacity: 0.1;
    z-index: 0;
}
#menu-slider-section::before { top: 0; }
#menu-slider-section::after { bottom: 0; }

#menu-slider-section h2 {
    color: var(--color-light);
    font-size: 2.8rem;
    font-style: italic;
    margin-bottom: 3rem;
    position: relative;
    z-index: 1;
}

/* --- GLOBAL RESPONSIVE STYLES --- */
/* For tablets and smaller devices */
@media (max-width: 992px) {
    .nav-phone { display: none; }
    .mobile-nav-toggle {
        display: block;
        background: none; border: none; color: var(--color-light);
        font-size: 1.8rem; cursor: pointer; z-index: 1001;
    }
    nav .main-nav {
        display: flex; flex-direction: column; justify-content: center;
        align-items: center; position: fixed; top: 0; right: -100%;
        width: 100%; height: 100vh; background-color: rgba(0, 0, 0, 0.98);
        transition: right 0.4s ease-in-out; gap: 3rem; z-index: 1000;
    }
    nav .main-nav.active { right: 0; }
    nav .main-nav li a { font-size: 1.5rem; }
}

/* For mobile phones */
@media (max-width: 768px) {
    .footer-content, .footer-bottom {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .footer-left { flex-direction: column; }
    .footer-left div { text-align: center; }
    .footer-logo { margin-bottom: 1rem; }
}

@media (max-width: 576px) {
    h1 { font-size: 2.5rem; }
    h2 { font-size: 2rem; }
    section { padding: 4rem 5%; }
}

@media (max-width: 768px) {
    nav .logo img {
        height: 60px; /* Giảm kích thước trên di động */
    }
}

/* --- Image Loading Optimization & Effect --- */

/* 1. Tạo placeholder cho container chứa ảnh */
.grid-item, .category {
    background-color: #f0f0f0; /* Màu nền xám nhạt cho khung chờ */
    border-radius: 8px; /* Tùy chọn: Bo tròn góc cho đẹp hơn */
    overflow: hidden; /* Đảm bảo ảnh không tràn ra ngoài nếu có bo góc */
}

/* 2. Tạo hiệu ứng mờ dần (fade-in) cho ảnh khi tải xong */
img {
    opacity: 1;
    transition: opacity 0.5s ease-in-out;
}

/* 3. Đảm bảo ảnh hiển thị đúng kích thước trong container */
.grid-item img, .category img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Giúp ảnh lấp đầy container mà không bị méo */
}

/* ================================================= */
/* == Bố cục LƯỚI HOÀN HẢO cho trang Category == */
/* ================================================= */

#dish-list-container .imaged-dishes-grid {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important; /* Căn giữa toàn bộ lưới */
    gap: 2rem !important;
    padding: 0 1rem !important;
}

#dish-list-container .dish-card {
    background-color: #181818;
    border: 1px solid #333;
    border-radius: 8px;
    text-align: center;
    overflow: hidden;
    transition: transform 0.3s, border-color 0.3s;
    cursor: pointer;
    display: flex !important;
    flex-direction: column !important;

    /* THAY ĐỔI CHÍNH: Tạo bố cục 3 cột trên màn hình lớn */
    flex: 0 1 350px; /* Kích thước cơ bản cho mỗi thẻ */
    min-width: 280px;
}

/* Thêm style cho thẻ ảo (vô hình) */
#dish-list-container .dish-card.phantom {
    visibility: hidden;
    border: none;
    background: none;
    cursor: default;
}

#dish-list-container .dish-card:hover {
    transform: translateY(-5px);
    border-color: var(--color-secondary);
}

#dish-list-container .dish-card.phantom:hover {
    transform: none; /* Thẻ ảo không có hiệu ứng hover */
}

/* Các style còn lại giữ nguyên */
#dish-list-container .dish-card .dish-card-img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

#dish-list-container .dish-card .dish-card-info {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

#dish-list-container .dish-card .dish-card-info h4 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    color: var(--color-light);
    margin-bottom: 0.5rem;
}

#dish-list-container .dish-card .dish-card-info .translation {
    font-size: 0.9em;
    font-style: italic;
    color: #999;
    display: block;
    margin-bottom: 1rem;
}

#dish-list-container .dish-card .dish-card-info .price {
    font-weight: bold;
    color: var(--color-primary);
    font-size: 1.3rem;
    margin-top: auto;
}