/* ===== Dishes Page (Compact 3-Column Horizontal Scroll) ===== */
.dishes-page {
    display: none;
    grid-template-columns: repeat(3, 150px);
    gap: 15px;
    padding: 20px;
    width: max-content;
    max-width: 100%;
    margin: 80px auto 120px auto;
    min-height: calc(100vh - 200px);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
}

.dishes-page::-webkit-scrollbar {
    display: none;
}

.dishes-page.visible {
    display: grid;
}

/* Center grid on large screens */
@media (min-width: 1200px) {
    .dishes-page {
        margin-left: calc(50% - 600px);
    }
}

/* ===== Compact Dish Cards ===== */
.dish-card {
    background: #ffffff;
    border-radius: 10px;
    padding: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    width: 150px;
    height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.dish-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.dish-card img {
    width: 100%;
    height: 120px;
    object-fit: contain;
    border-radius: 8px;
}

/* ===== Smart Dish Name ===== */
.dish-name {
    font-family: 'EB Garamond', serif;
    font-weight: 600;
    color: #333;
    width: 100%;
    text-align: center;
    margin: 8px 0 4px 0;
    padding: 0 5px;
    font-size: clamp(0.6rem, 2.5vw, 0.9rem);
    display: block;
    overflow: visible;
    line-height: 1.3;
    max-height: none;
    word-break: break-word;
    hyphens: auto;
    white-space: normal;
}

/* ===== Dish Price ===== */
.dish-price {
    font-size: 0.9rem;
    color: #ffffff;
    background-color: #2d6b31;
    font-weight: 700;
    padding: 0.4rem 0.8rem;
    border-radius: 25px;
    margin-top: 0.3rem;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.dish-price:hover {
    background-color: #3a7a3e;
    transform: scale(1.05);
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
    .dishes-page {
        grid-template-columns: repeat(3, 120px);
        padding: 15px;
    }
    .dish-card {
        width: 120px;
        height: 190px;
    }
    .dish-card img {
        height: 100px;
    }
    .dish-price {
        font-size: 0.8rem;
        padding: 0.3rem 0.7rem;
    }
}

@media (max-width: 400px) {
    .dishes-page {
        grid-template-columns: repeat(3, 140px);
        gap: 10px;
        padding: 15px;
    }
    .dish-card {
        width: 140px;
        height: 210px;
    }
    .dish-card img {
        height: 110px;
    }
}

/* ===== Detailed View  ===== */
.dish-detail {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.dish-detail.visible {
    display: flex;
}

.dish-detail-content {
    background: rgba(0, 0, 0, 0.8);
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    text-align: center;
    display: flex;
    flex-direction: column; 
    align-items: center;
    justify-content: center;
    max-width: 600px;
    padding: 1rem;
}

#detail-image {
    width: 100%;
    max-height: 300px;
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    animation: imageFadeIn 0.4s ease-out;
    margin-top: 20px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

#detail-name {
    font-size: 1.8rem;
    color: white;
    margin-bottom: 1rem;
    animation: nameFadeIn 0.4s ease-out;
    line-height: 1.2;
}

#detail-description {
    font-size: 1.1rem;
    color: #ddd;
    max-width: 600px;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    animation: descriptionFadeIn 0.4s ease-out;
}

#detail-price {
    font-size: 1.5rem;
    color: #ffd700;
    margin: 1rem 0;
    animation: priceFadeIn 0.4s ease-out;
}

.close-button {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: #ffffff;
    color: #2d3436;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.close-button:hover {
    background: #2d6b31;
    color: white;
    transform: rotate(90deg);
}

/* ===== Mobile Detail View ===== */
@media (max-width: 768px) {
    .dish-detail-content {
        padding: 1.5rem;
        max-width: 90%;
    }
    #detail-name {
        font-size: 1.5rem;
    }
    #detail-description {
        font-size: 1rem;
    }
    #detail-price {
        font-size: 1.3rem;
    }
    .close-button {
        top: 1rem;
        right: 1rem;
        width: 35px;
        height: 35px;
    }
}

/* ===== Back Button ===== */
.back-button {
    position: fixed;
    top: 2rem;
    left: 2rem;
    background: #ffffff;
    color: #2d3436;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1100;
}

.back-button.visible {
    display: flex;
}

.back-button:hover {
    background: #2d6b31;
    color: white;
    transform: translateX(-5px);
}

.dish-detail.visible ~ .back-button {
    display: none;
}

/* ===== Animations ===== */
@keyframes modalIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes imageFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes nameFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes descriptionFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes priceFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
