/* Global Styles */
:root {
    --primary-color: #e74c3c;
    --secondary-color: #2c3e50;
    --accent-color: #f39c12;
    --light-color: #ecf0f1;
    --dark-color: #2c3e50;
    --text-color: #333;
    --text-light: #7f8c8d;
    --white: #fff;
    --box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
    --header-top-height: 60px;
    --category-nav-height: 60px;
    --header-height: calc(var(--header-top-height) + var(--category-nav-height));
}

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

body {
    font-family: 'Poppins', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: #f9f9f9;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
}

/* Ensure content doesn't jump when mobile menu opens */
body.menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Header & Navigation */
body {
    padding-top: calc(var(--header-height) + 30px);
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #f9f9f9;
}

.header {
    background-color: var(--white);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(0);
    will-change: transform;
    height: var(--header-height);
    display: flex;
    flex-direction: column;
    padding-bottom: 5px;
}

.header.hide {
    transform: translateY(calc(-100% + 1px)); /* Slight offset to prevent 1px gap */
}

.header.show {
    transform: translateY(0);
}

/* Ensure content doesn't jump when header shows/hides */
@supports (position: sticky) {
    body {
        padding-top: 0;
    }
    
    .header {
        position: sticky;
        top: 0;
    }
    
    .header.hide {
        transform: translateY(-100%);
    }
}

.header-top {
    display: flex;
    justify-content: center;
    align-items: center;
    height: var(--header-top-height);
    padding: 0 15px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

/* Category Navigation */
.category-nav-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    background-color: var(--white);
    border-bottom: 1px solid #f0f0f0;
    padding: 15px 0;
    margin-top: 15px;
}

.category-nav {
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.category-scroll {
    display: flex;
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 10px 40px; /* Space for arrows */
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
}

/* Hide scrollbar for Chrome, Safari and Opera */
.category-scroll::-webkit-scrollbar {
    display: none;
}

/* Hide scrollbar for IE, Edge and Firefox */
.category-scroll {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

.category-link {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 16px;
    margin: 0 5px;
    border-radius: 20px;
    background: white;
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border: 1px solid #eee;
    height: auto;
    min-width: auto;
    width: auto;
    flex-shrink: 0;
}

.category-link i {
    font-size: 1.1rem;
    margin-bottom: 3px;
    color: var(--primary-color);
    display: block;
    height: 1.1rem;
    line-height: 1.1rem;
}

.category-link.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 5px rgba(231, 76, 60, 0.3);
}

.category-link.active i {
    color: white;
}

.category-link.active i {
    color: white;
}

.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid #eee;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    z-index: 10;
    opacity: 0.9;
    transition: all 0.3s ease;
    outline: none;
}

.nav-arrow:hover {
    background: #f8f8f8;
    transform: translateY(-50%) scale(1.05);
}

.nav-prev {
    left: 5px;
}

.nav-next {
    right: 5px;
}

/* Ensure menu content starts below header */
.menu-section {
    padding: 30px 0;
    position: relative;
    z-index: 1;
    margin-top: 10px;
}

.category {
    margin-bottom: 5rem;
}

.category-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
    color: var(--secondary-color);
    position: relative;
    display: inline-block;
    left: 50%;
    transform: translateX(-50%);
}

.category-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--primary-color);
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    padding: 1rem 0;
    margin: 0 auto;
    width: 100%;
    max-width: 1200px;
}

.menu-item {
    background: var(--white);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 380px;
    position: relative;
    border: 1px solid #f0f0f0;
    margin: 0;
    width: 100%;
    max-width: 100%;
}

.menu-item:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.item-image {
    height: 200px;
    overflow: hidden;
    position: relative;
    background: #f8f9fa;
}
.item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.menu-item:hover .item-image img {
    transform: scale(1.05);
}

.item-details {
    padding: 1.2rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    padding-bottom: 50px;
    min-height: 180px;
}

.item-details h3 {
    font-size: 1rem;
    margin: 0 0 6px 0;
    color: #2c3e50;
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 2.6em;
}

.item-description {
    color: #7f8c8d;
    font-size: 0.85rem;
    margin-bottom: 8px;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    max-height: 4.2em;
    flex-grow: 1;
    max-height: 4.5em;
    position: relative;
    min-height: 4.5em;
}

@supports not (-webkit-line-clamp: 4) {
    .item-description {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 4;
        overflow: hidden;
    }
}

.item-price {
    font-size: 1.2rem;
    color: #e74c3c;
    font-weight: 700;
    padding: 8px 16px;
    background-color: #fff8f8;
    border: 1px solid #ffdddd;
    border-radius: 6px;
    display: inline-block;
    margin-top: auto;
    margin-bottom: 0;
    align-self: flex-end;
    position: absolute;
    bottom: 15px;
    right: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.item-price:hover {
    background-color: #fff3e0;
    transform: translateY(-1px);
}

/* Product Popup */
.popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.popup.active {
    display: block;
    opacity: 1;
    visibility: visible;
}

.popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.popup-content {
    position: relative;
    background: white;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    margin: 5vh auto;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.popup.active .popup-content {
    transform: translateY(0);
}

.popup-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border: none;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    color: #333;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    padding: 0;
    margin: 0;
}

.popup-close:hover {
    background: #f44336;
    color: white;
    transform: rotate(90deg);
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.3);
}

.popup-close i {
    transition: transform 0.3s ease;
}

.popup-close:hover i {
    transform: scale(1.2);
}

/* Bottom close button */
.popup-close-bottom {
    display: none; /* Hidden by default, shown on mobile */
    width: 100%;
    padding: 12px 20px;
    margin-top: 20px;
    background-color: #f44336;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.popup-close-bottom:hover {
    background-color: #d32f2f;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.popup-close-bottom i {
    font-size: 18px;
}

/* Show bottom close button on mobile */
@media (max-width: 768px) {
    .popup-close {
        display: none; /* Hide top close button on mobile */
    }
    
    .popup-close-bottom {
        display: flex; /* Show bottom close button on mobile */
    }
}

.popup-image-container {
    width: 100%;
    height: 300px;
    overflow: hidden;
}

.popup-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.popup-details {
    padding: 25px;
    overflow-y: auto;
    max-height: calc(90vh - 300px);
}

.popup-details h3 {
    font-size: 1.8rem;
    margin-bottom: 15px;
    color: var(--secondary-color);
}

.popup-details p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 20px;
}

.popup-price {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-top: 20px;
}

@media (max-width: 768px) {
    .popup-content {
        width: 95%;
        margin: 2vh auto;
        max-height: 96vh;
    }
    
    .popup-image-container {
        height: 200px;
    }
    
    .popup-details {
        padding: 20px 15px;
        max-height: calc(96vh - 200px);
    }
    
    .popup-details h3 {
        font-size: 1.5rem;
    }
    
    .popup-price {
        font-size: 1.5rem;
    }
}

/* Footer */
.footer {
    background-color: var(--secondary-color);
    color: var(--light-color);
    padding: 4rem 0 1rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.footer-section h3 {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    position: relative;
    display: inline-block;
}

.footer-section h3::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 50px;
    height: 2px;
    background-color: var(--primary-color);
}

.footer-section p {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.social-links {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transition: var(--transition);
}

.social-links a:hover {
    background-color: var(--primary-color);
    transform: translateY(-3px);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.9rem;
    color: var(--text-light);
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 22px;
    cursor: pointer;
    z-index: 10010;
    padding: 15px 10px;
    margin-right: -10px;
    position: relative;
    transition: all 0.3s ease;
}

.mobile-menu-btn:hover {
    opacity: 0.8;
}

.mobile-menu-btn span {
    display: block;
    width: 100%;
    height: 3px;
    background-color: var(--primary-color);
    transition: var(--transition);
}

.mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .container {
        padding: 0 15px;
    }
    
    .menu-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 992px) {
    :root {
        --header-height: 70px;
    }
    
    .category-nav {
        padding-bottom: 10px;
    }
    
    .category-link {
        min-width: auto;
        padding: 6px 16px;
        font-size: 0.85rem;
        margin: 0 3px;
    }
    
    .category-link i {
        font-size: 1rem;
    }
    
    .nav-arrow {
        display: none;
    }
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 85%;
        max-width: 320px;
        height: 100vh;
        background-color: var(--white);
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        padding: 80px 20px 30px;
        box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15);
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 9999;
        overflow-y: auto;
        opacity: 0;
        visibility: hidden;
    }

    .nav-links.active {
        right: 0;
        opacity: 1;
        visibility: visible;
    }

    .nav-links::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background-color: rgba(0, 0, 0, 0.5);
        opacity: 0;
        visibility: hidden;
        transition: all 0.4s ease;
        z-index: -1;
    }

    .nav-links.active::before {
        opacity: 1;
        visibility: visible;
    }

    .nav-links a {
        width: 100%;
        padding: 15px 0;
        border-bottom: 1px solid #f5f5f5;
        font-size: 1.1rem;
        font-weight: 500;
        color: var(--dark-color);
        transition: all 0.3s ease;
        display: flex;
        align-items: center;
    }

    .nav-links a i {
        margin-right: 10px;
        font-size: 1.2rem;
        color: var(--primary-color);
    }

    .nav-links a:hover {
        color: var(--primary-color);
        padding-left: 10px;
    }

    .nav-links a::after {
        display: none;
    }

    .hero h1 {
        font-size: 2.5rem;
    }
}

@media (max-width: 768px) {
    .category-nav-container {
        padding: 0 10px;
        margin-top: 10px;
        height: auto;
        position: sticky;
        top: var(--header-height);
        z-index: 90;
        background: white;
        box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    }
    
    .category-scroll {
        padding: 8px 0;
        gap: 6px;
    }
    
    .category-link {
        padding: 6px 14px;
        font-size: 0.8rem;
        margin: 0 2px;
    }
    
    .category-link i {
        font-size: 1rem;
        margin-bottom: 2px;
    }
    
    .menu-grid {
        grid-template-columns: 1fr;
        gap: 1.2rem;
        padding: 0 10px;
        margin: 0 auto;
        width: 100%;
        max-width: 500px;
        box-sizing: border-box;
    }
    
    .menu-item {
        min-height: auto;
        margin: 0 0 1rem 0;
        max-width: 100%;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    .item-details h3 {
        font-size: 1rem;
        -webkit-line-clamp: 2;
    }
    
    .item-description {
        font-size: 0.85rem;
        -webkit-line-clamp: 2;
    }
    
    .menu-item {
        min-height: auto;
        margin: 0 0 1rem 0;
        max-width: 100%;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    .item-details {
        min-height: auto;
        padding: 12px 12px 45px 12px;
        position: relative;
    }
    
    .item-image {
        height: 180px;
    }
    
    .container {
        padding: 0 8px;
        max-width: 100%;
        width: 100%;
        margin: 0 auto;
    }
    
    .price {
        position: absolute;
        bottom: 10px;
        right: 10px;
        font-size: 1rem;
        padding: 5px 12px;
        margin: 0;
        background: #fff8f8;
        border: 1px solid #ffdddd;
        border-radius: 20px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }
    
    .item-details h3 {
        font-size: 1.1rem;
        margin-bottom: 5px;
    }
    
    .item-description {
        font-size: 0.9rem;
        margin: 5px 0;
        -webkit-line-clamp: 3;
        max-height: 4.5em;
    }
    
    .price {
        bottom: 10px;
        right: 10px;
        font-size: 1.1rem;
        padding: 6px 12px;
    }
    
    .item-image {
        height: 160px;
    }
    .hero {
        min-height: 120px;
        height: auto;
        margin-top: 0;
        padding: 20px 0 30px;
        background: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)), 
                    url('https://images.unsplash.com/photo-1517248135467-4c7edcad34c4?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1470&q=80') no-repeat center center/cover;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
    }
    
    .hero-content {
        max-width: 800px;
        padding: 0 20px;
    }
    
    .hero-logo {
        max-width: 180px;
        height: auto;
        margin: 0 auto 15px;
        display: block;
        filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
    }

    .hero h1 {
        font-size: 1.8rem;
        margin-bottom: 0.5rem;
    }

    .hero p {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }

    .menu-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .category {
        margin-bottom: 3rem;
    }

    .category-title {
        font-size: 1.8rem;
        margin-bottom: 2rem;
    }

    .menu-item {
        display: flex;
        flex-direction: row;
        height: 120px;
        overflow: visible;
    }

    .item-image {
        width: 120px;
        height: 100%;
        border-radius: 10px 0 0 10px;
    }

    .item-info {
        flex: 1;
        padding: 1rem;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }

    .item-details h3 {
        font-size: 1.1rem;
        margin-bottom: 0.3rem;
    }

    .item-description {
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
        line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    .item-price {
        font-size: 1rem;
        padding: 0.2rem 0.8rem;
        align-self: flex-start;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .footer-section {
        margin-bottom: 1.5rem;
    }
}

/* Small devices (landscape phones, 576px and up) */
@media (max-width: 576px) {
    .hero {
        height: 35vh;
        margin-top: 60px;
    }

    .hero h1 {
        font-size: 1.5rem;
    }

    .hero p {
        font-size: 0.9rem;
    }

    .menu-item {
        height: auto;
        margin-bottom: 1.5rem;
    }

    .item-image {
        width: 100px;
        margin-bottom: 10px;
    }

    .item-info {
        padding: 0.5rem;
    }
    
    .item-details h3 {
        font-size: 1rem;
    }

    .item-details p {
        font-size: 0.75rem;
        -webkit-line-clamp: 1;
        line-clamp: 1;
        text-overflow: ellipsis;
    }

    .price {
        font-size: 0.9rem;
    }

    .footer-section h3 {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }

    .footer-section p {
        font-size: 0.9rem;
    }
}
