:root {
    --bg-color: #1A5D48;        /* Deep Green */
    --card-bg: #FDFBE0;         /* Cream */
    --text-color: #10382B;      /* Dark Green text */
    --accent-gold: #C8A359;     /* Gold highlights */
    --white: #ffffff;
    --font-main: 'Vazirmatn', sans-serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    padding-bottom: 50px;
}

/* >>> NEW WRAPPER STYLE <<< */
/* This handles the stickiness for the entire top block */
.sticky-header-group {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: var(--bg-color);
    box-shadow: 0 4px 6px rgba(0,0,0,0.2); /* Shadow applied to the whole group */
}

/* >>> HEADER <<< */
.main-header {
    /* Removed position:sticky here */
    position: relative;
    background: var(--bg-color);
    color: var(--card-bg);
    padding: 10px 15px;
    border-bottom: 2px solid var(--accent-gold);
}

.logo-area {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-direction: row-reverse; /* Logo on Left, Text on Right for RTL */
}

.site-logo {
    height: 60px;
    width: auto;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.3));
}

.header-text {
    text-align: right;
}

.main-header h1 {
    font-weight: 700;
    font-size: 1.4rem;
    margin-bottom: 2px;
}

.main-header p {
    font-weight: 300;
    font-size: 0.8rem;
    opacity: 0.8;
    letter-spacing: 1px;
    margin-bottom: 0;
}

/* >>> NAV BAR <<< */
.sticky-nav {
    /* Removed position:sticky and top offset here */
    position: relative;

    background: var(--bg-color);
    padding: 15px 10px;
    white-space: nowrap;
    overflow-x: auto;
    /* Removed z-index and box-shadow (now on the group) */
    -webkit-overflow-scrolling: touch;
    display: flex;
    gap: 10px;
    border-bottom: 1px solid var(--accent-gold);
}

.sticky-nav::-webkit-scrollbar {
    display: none;
}

.nav-btn {
    background: transparent;
    border: 1px solid var(--accent-gold);
    color: var(--card-bg);
    padding: 8px 16px;
    border-radius: 20px;
    font-family: var(--font-main);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-btn.active, .nav-btn:hover {
    background: var(--accent-gold);
    color: var(--bg-color);
}

/* Menu Layout */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.category-section {
    margin-bottom: 40px;
    /* Adjusted scroll margin: Header (~85px) + Nav (~60px) + Buffer */
    scroll-margin-top: 170px;
}

.category-title {
    color: var(--card-bg);
    font-size: 1.4rem;
    margin-bottom: 15px;
    border-bottom: 1px dashed var(--accent-gold);
    display: inline-block;
    padding-bottom: 5px;
}

/* Menu Items */
.menu-item {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--accent-gold);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.item-info {
    flex: 1;
    padding-left: 10px;
}

.item-name {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-color);
    margin-bottom: 4px;
}

.item-desc {
    font-size: 0.85rem;
    color: #555;
    font-weight: 300;
}

.item-price {
    font-weight: 700;
    font-size: 1rem;
    color: var(--bg-color);
    background: rgba(26, 93, 72, 0.1);
    padding: 5px 10px;
    border-radius: 8px;
    white-space: nowrap;
}

footer {
    text-align: center;
    color: var(--card-bg);
    padding: 20px;
    font-size: 0.8rem;
    opacity: 0.6;
}

/* Icons */
.header-icon {
    color: var(--accent-gold);
    width: 28px;
    height: 28px;
    vertical-align: middle;
}

.nav-icon {
    width: 18px;
    height: 18px;
    stroke-width: 2px;
    color: var(--accent-gold);
    transition: all 0.3s ease;
}

.nav-btn.active .nav-icon,
.nav-btn:hover .nav-icon {
    color: var(--bg-color);
}

/* Loading */
.loading-container {
    text-align: center;
    margin-top: 60px;
    color: var(--accent-gold);
    opacity: 0.7;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    margin-bottom: 15px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* >>> NEW ITEM IMAGE STYLES <<< */
.item-image {
    width: 75px;          /* Fixed square size */
    height: 75px;
    object-fit: cover;    /* Crops image perfectly without stretching */
    border-radius: 8px;   /* Rounded corners */
    margin-left: 15px;    /* Space between image and text (RTL) */
    border: 1px solid var(--accent-gold);
    flex-shrink: 0;       /* Prevents image from shrinking on small screens */
    background-color: #fff;
}
