/* menu.css - Final Version with Symmetrical Mobile Grid Fix */

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

:root {
    --primary-red: #d9203e;   
    --dark-red: #a3182f;      
    --deep-maroon: #500000;   
    --light-red: #ff5f52;     
    --pale-red: #ffebee;      
    --white: #FFFFFF;
    --off-white: #fafafa;
    --dark-gray: #222222;     
    --medium-gray: #555555;   
    --shadow: 0 4px 20px rgba(217, 32, 62, 0.25);
    --transition: all 0.3s ease;
}

html { overflow-x: hidden; }
body { font-family: 'Montserrat', sans-serif; line-height: 1.5; color: var(--dark-gray); background-color: var(--white); overflow-x: hidden; -webkit-tap-highlight-color: transparent; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; width: 100%; }

/* Typography */
h1, h2, h3, h4 { font-family: 'Cinzel', serif; font-weight: 700; }
h1 { font-size: 2.5rem; } h2 { font-size: 2rem; } h3 { font-size: 1.4rem; } p { font-size: 0.95rem; line-height: 1.6; }

/* Buttons */
.btn { display: inline-block; padding: 12px 25px; border-radius: 50px; text-decoration: none; font-weight: 600; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 1px; transition: var(--transition); border: none; cursor: pointer; font-family: 'Montserrat', sans-serif; text-align: center; white-space: nowrap; }
.btn-primary { background: linear-gradient(135deg, var(--primary-red), var(--dark-red)); color: var(--white); box-shadow: var(--shadow); }
.btn-primary:hover { background: linear-gradient(135deg, var(--dark-red), var(--primary-red)); transform: translateY(-2px); box-shadow: 0 8px 25px rgba(217, 32, 62, 0.4); }

/* Menu Header */
.menu-header { padding: 110px 0 50px; background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), url('https://images.unsplash.com/photo-1501443762994-82bd5dace89a?auto=format&fit=crop&q=80&w=1920'); background-size: cover; background-position: center; color: var(--white); text-align: center; }
.menu-title { font-size: 2.8rem; margin-bottom: 10px; text-shadow: 0 4px 10px rgba(0,0,0,0.5); }
.menu-subtitle { color: rgba(255, 255, 255, 0.9); margin-bottom: 25px; font-size: 1rem; }
.header-cta { margin-bottom: 25px; }
.header-cta .btn { padding: 10px 30px; font-size: 0.95rem; box-shadow: 0 5px 15px rgba(0,0,0,0.3); }

/* VEG BADGE */
.veg-badge { display: inline-block; background: rgba(0, 0, 0, 0.65); color: #81c784; padding: 8px 18px; border-radius: 30px; font-size: 0.95rem; font-weight: 600; margin-top: 15px; border: 1px solid rgba(129, 199, 132, 0.3); backdrop-filter: blur(5px); letter-spacing: 0.5px; }

/* SEARCH BAR ANIMATIONS */
.search-container { position: relative; max-width: 350px; margin: 0 auto 25px; transition: max-width 0.5s cubic-bezier(0.25, 0.8, 0.25, 1); }
.search-container:focus-within { max-width: 450px; }
.search-icon { position: absolute; left: 22px; top: 50%; transform: translateY(-50%); color: var(--medium-gray); transition: all 0.3s ease; font-size: 1.1rem; }
.search-container:focus-within .search-icon { color: var(--primary-red); transform: translateY(-50%) scale(1.15); }
.menu-search { width: 100%; padding: 14px 20px 14px 50px; border-radius: 50px; border: 2px solid transparent; background: rgba(255, 255, 255, 0.95); font-family: 'Montserrat', sans-serif; font-size: 0.95rem; outline: none; transition: all 0.4s ease; box-shadow: 0 4px 15px rgba(0,0,0,0.1); color: var(--dark-gray); }
.menu-search:focus { border-color: var(--primary-red); background: var(--white); box-shadow: 0 8px 25px rgba(217, 32, 62, 0.25); transform: translateY(-3px); }
.menu-search::placeholder { color: var(--medium-gray); opacity: 0.8; }

/* Filters */
.filter-wrapper { position: relative; width: 100%; max-width: 1000px; margin: 0 auto; margin-bottom: 35px; }
.menu-category-filter { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.filter-btn { padding: 8px 20px; background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.4); color: var(--white); border-radius: 30px; cursor: pointer; font-weight: 600; transition: var(--transition); backdrop-filter: blur(5px); font-size: 0.85rem; }
.filter-btn:hover, .filter-btn.active { background: var(--white); color: var(--primary-red); border-color: var(--white); }

/* Mobile Scroll Hint */
.mobile-scroll-hint { display: none; }

/* Menu Grid (minmax fixes the unequal width bug!) */
.menu-items { padding: 40px 0; background: var(--off-white); }
.menu-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.menu-category { margin-bottom: 60px; transition: opacity 0.3s ease, transform 0.3s ease; }
.category-title { color: var(--dark-red); margin-bottom: 30px; display: flex; align-items: center; gap: 12px; font-size: 1.8rem; }
.category-title i { color: var(--primary-red); font-size: 1.6rem; }

/* ========================================= */
/* 3D FLIP CARD STYLES                       */
/* ========================================= */
.menu-item {
    perspective: 1000px; 
    background: transparent !important; 
    box-shadow: none !important;
    height: 100%; /* Forces cards in the same row to be equal height */
    min-width: 0; /* Prevents blowout */
    display: flex;
    flex-direction: column;
}

.flipper {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
    transform-style: preserve-3d; 
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    flex-grow: 1; /* Flipper fills the height */
}

.menu-item:hover .flipper {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(217, 32, 62, 0.15);
}

.flipper.is-flipped {
    transform: rotateY(180deg);
}

.menu-item:hover .flipper.is-flipped {
    transform: translateY(-5px) rotateY(180deg);
}

.front, .back {
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden; 
    border-radius: 12px;
    background: var(--white);
    overflow: hidden;
    position: relative; 
}

/* Make front a flex column so details push down */
.front {
    display: flex;
    flex-direction: column;
}

/* FRONT INFO BUTTON */
.info-btn {
    position: absolute;
    bottom: 15px; 
    right: 15px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--pale-red); 
    color: var(--primary-red);
    border: 1px solid rgba(217, 32, 62, 0.2);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.info-btn:hover {
    background: var(--primary-red);
    color: var(--white);
    transform: scale(1.15) rotate(15deg); 
    box-shadow: 0 6px 15px rgba(217, 32, 62, 0.3);
}

/* BACK OF CARD STYLES */
.back {
    position: absolute;
    top: 0;
    left: 0;
    transform: rotateY(180deg);
    background: var(--pale-red);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--primary-red);
}

.back-content {
    padding: 25px;
    text-align: center;
}
.back-content h3 { color: var(--dark-red); font-size: 1.2rem; margin-bottom: 12px; font-family: 'Cinzel', serif;}
.back-content p { color: var(--medium-gray); font-size: 0.95rem; margin-bottom: 25px; line-height: 1.5; font-family: 'Montserrat', sans-serif;}

.back-btn { 
    background: var(--primary-red); 
    color: white; 
    border: none; 
    padding: 10px 25px; 
    border-radius: 30px; 
    cursor: pointer; 
    transition: 0.3s; 
    font-weight: 600; 
    font-family: 'Montserrat', sans-serif;
    margin-top: 10px;
}
.back-btn:hover { background: var(--dark-red); transform: scale(1.05); }

/* FRONT CONTENT (Original Layouts) */
.item-image { height: 180px; position: relative; overflow: hidden; background-color: #f0f0f0; flex-shrink: 0; }
.item-image img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.5s ease; }
.menu-item:hover .item-image img { transform: scale(1.1); }

.item-badge { position: absolute; top: 12px; right: 12px; background: var(--primary-red); color: var(--white); padding: 4px 10px; border-radius: 15px; font-size: 0.7rem; font-weight: 600; z-index: 2; }

/* Flexbox fixes to keep all cards uniform height */
.item-details { 
    padding: 18px; 
    display: flex; 
    flex-direction: column; 
    flex-grow: 1; /* Pushes the price to the very bottom automatically! */
}
.item-name { 
    color: var(--dark-red); 
    font-size: 1.1rem; 
    margin-bottom: 5px; 
    font-weight: 700; 
    word-break: break-word; /* Prevents long words from breaking the grid width */
    overflow-wrap: break-word;
    hyphens: auto;
}
.item-description { font-size: 0.85rem; color: var(--medium-gray); margin-bottom: 8px; line-height: 1.4; }
.item-price { color: var(--primary-red); font-weight: 700; font-size: 1.05rem; margin-top: auto; /* Always sits at the bottom */ }

/* COMPACT SIGNATURE ITEM (Mapped to new wrapper logic) */
.signature-item { 
    max-width: 550px; 
    margin: 0 auto 30px auto; 
}
.signature-item .front { 
    display: grid; /* Overrides the flex column to put image on the left */
    grid-template-columns: 1fr 1.2fr; 
    gap: 0; 
}
.signature-item .item-image { 
    height: 100%; 
    min-height: 200px;
    max-height: 220px; 
}
.signature-item .item-details { 
    padding: 20px; 
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
}
.signature-item .item-name { 
    font-size: 1.3rem; 
}

.menu-item:not(.signature-item) #dbc-desc {
    display: none;
}

/* Scroll Up Button */
.scroll-up-btn { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(100px); background: var(--primary-red); color: var(--white); border: none; padding: 10px 25px; border-radius: 30px; font-weight: 600; font-size: 0.85rem; box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3); cursor: pointer; z-index: 1000; transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); display: flex; align-items: center; gap: 8px; opacity: 0; }
.scroll-up-btn.visible { transform: translateX(-50%) translateY(0); opacity: 1; }
.scroll-up-btn:hover { background: var(--dark-red); transform: translateX(-50%) translateY(-3px); box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4); }

/* Responsive */
@media (max-width: 992px) {
    .menu-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } /* minmax enforces strict 50/50 sizing */
    .signature-item { max-width: 400px; }
    .signature-item .front { grid-template-columns: 1fr; }
    .signature-item .item-image { height: 200px; max-height: none; }
}

@media (max-width: 768px) {
    .menu-header { padding: 100px 0 30px; }
    .menu-title { font-size: 2rem; }
    .menu-subtitle { font-size: 0.9rem; padding: 0 10px; }
    
    .search-container { padding: 0 10px; max-width: 100%; }
    .search-container:focus-within { max-width: 100%; }
    
    .menu-category-filter { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; padding-bottom: 10px; width: 100%; padding-left: 10px; -webkit-overflow-scrolling: touch; }
    .filter-btn { flex: 0 0 auto; white-space: nowrap; font-size: 0.8rem; padding: 6px 16px; }

    /* 3 ARROWS SCROLL HINT (MOBILE) */
    .mobile-scroll-hint { display: flex; justify-content: center; position: absolute; left: 50%; bottom: -35px; background: transparent; color: var(--white); padding: 0; pointer-events: none; animation: bounceCenter 1.5s infinite; font-size: 1.4rem; z-index: 5; }
    .mobile-scroll-hint i { margin-left: -6px; opacity: 0.8; }
    .mobile-scroll-hint i:nth-child(1) { opacity: 0.4; margin-left: 0; }
    .mobile-scroll-hint i:nth-child(2) { opacity: 0.7; }
    .mobile-scroll-hint i:nth-child(3) { opacity: 1; }
    .mobile-scroll-hint.hidden { opacity: 0; transition: opacity 0.3s ease; }
    @keyframes bounceCenter { 0%, 100% { transform: translateX(-50%); } 50% { transform: translateX(-20%); } }

    .menu-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } /* minmax enforces strict 50/50 sizing */
    .category-title { font-size: 1.5rem; justify-content: center; margin-bottom: 25px; }
    
    .signature-item { max-width: 100%; } 
    
    /* Optimize Back card font sizes for small screens */
    .back-content { padding: 15px; }
    .back-content h3 { font-size: 1rem; margin-bottom: 8px;}
    .back-content p { font-size: 0.8rem; margin-bottom: 15px;}
    .back-btn { padding: 8px 15px; font-size: 0.8rem; }
}