:root {
    --bg: #f6f6f6;
    --surface: #ffffff;
    --text: #515151;
    --text-muted: #666666;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --accent: #2563eb;
    --header-height: 7vh;
    --radius: 10px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: IRANSansWeb, Tahoma, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-tap-highlight-color: transparent;
}

button {
    font: inherit;
    border: 0;
    background: none;
    padding: 0;
    cursor: pointer;
}

.text-center { text-align: center; }

.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    min-height: 52px;
    padding: 4px 12px;
    background: var(--surface);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    direction: rtl;
    gap: 8px;
}

.burger-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    touch-action: manipulation;
}

.burger-btn:active {
    background: rgba(0, 0, 0, 0.06);
}

.burger-icon,
.burger-icon::before,
.burger-icon::after {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
}

.burger-icon {
    position: relative;
}

.burger-icon::before,
.burger-icon::after {
    content: '';
    position: absolute;
    left: 0;
}

.burger-icon::before {
    top: -7px;
}

.burger-icon::after {
    top: 7px;
}

.store-title {
    flex: 1;
    margin: 0;
    padding: 0 8px;
    font-size: 1rem;
    color: var(--text);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.main-section {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    overflow: auto;
    padding: 12px;
    background: var(--bg);
}

.sub-header {
    align-items: center;
    margin-bottom: 12px;
    direction: ltr;
}

.nav-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    background: url('../img/back.png') center/30px no-repeat;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    touch-action: manipulation;
}

.nav-btn.visible {
    opacity: 1;
    pointer-events: auto;
}

.nav-btn.click-animation {
    animation: btn-click 0.2s ease;
}

@keyframes btn-click {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(0.85); opacity: 0.6; }
}

.page-title {
    direction: rtl;
}

.page-title h4 {
    margin: 0;
    font-size: 0.95rem;
}

.page-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    background: url('../img/category.png') center/contain no-repeat;
}

[hidden] {
    display: none !important;
}

#categories-panel {
    display: flex;
    flex-wrap: wrap;
    direction: rtl;
}

.foods-panel {
    direction: rtl;
}

.food-details-panel {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: auto;
    max-height: calc(100% - 60px);
    margin-bottom: 20px;
}

.category-item {
    display: block;
    width: 85%;
    margin: 0 auto 24px;
    padding: 16px 8px 12px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    aspect-ratio: 1;
    max-width: 140px;
}

.category-image,
.food-image {
    width: 48px;
    height: 48px;
    margin: 0 auto 10px;
    background-position: center;
    background-size: contain;
    background-repeat: no-repeat;
}

.category-item h5 {
    margin: 0;
    font-size: 0.75rem;
    line-height: 1.4;
}

.foods-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.food-tile {
    display: block;
    width: 100%;
    padding: 10px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.food-image {
    width: 100%;
    height: 75px;
    margin-bottom: 8px;
}

.food-tile h4 {
    margin: 0 0 6px;
    font-size: 0.9rem;
}

.food-contents {
    margin: 0 0 6px;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.food-price {
    margin: 0;
    font-size: 0.82rem;
    color: #444;
}

.food-detail-image {
    display: block;
    width: 100%;
    max-height: 40vh;
    object-fit: contain;
    margin: 0 auto;
    padding: 16px 16px 0;
}

.food-detail-body {
    padding: 16px 20px 24px;
    text-align: right;
}

.food-detail-body h3,
.food-detail-body h4 {
    margin: 0 0 12px;
    color: var(--text);
}

.food-detail-body p {
    margin: 0 0 16px;
    line-height: 1.7;
    color: var(--text-muted);
}

.side-menu {
    position: fixed;
    top: 0;
    bottom: 0;
    right: -65%;
    width: 65%;
    max-width: 320px;
    padding: 56px 5% 8%;
    background: #f0f0f0;
    z-index: 40;
    transition: right 0.2s ease;
    direction: rtl;
    box-shadow: -4px 0 16px rgba(0, 0, 0, 0.12);
}

.side-menu.show {
    right: 0;
}

.side-menu.hide {
    right: -65%;
}

.side-menu a {
    display: block;
    text-align: right;
    text-decoration: none;
    color: var(--accent);
    font-family: IRANSansWebBold, IRANSansWeb, sans-serif;
    border-bottom: 1px solid #c3c3c3;
    padding: 15px 0;
}

.side-menu a:first-of-type {
    border-top: 1px solid #c3c3c3;
    margin-top: 0;
}

.side-menu-muted {
    color: #111 !important;
    font-size: 0.95rem;
    text-align: center !important;
}

.side-menu-close {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    touch-action: manipulation;
}

.side-menu-close:active {
    background: rgba(0, 0, 0, 0.08);
}

.side-menu-close-icon,
.side-menu-close-icon::before,
.side-menu-close-icon::after {
    display: block;
    width: 20px;
    height: 2px;
    background: #333;
    border-radius: 2px;
}

.side-menu-close-icon {
    position: relative;
}

.side-menu-close-icon::before,
.side-menu-close-icon::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
}

.side-menu-close-icon::before {
    transform: rotate(45deg);
}

.side-menu-close-icon::after {
    transform: rotate(-45deg);
}

.welcome-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
}

.welcome-logo {
    width: 96px;
    margin-bottom: 16px;
}

.welcome-example code {
    background: #eee;
    padding: 2px 8px;
    border-radius: 6px;
}

.lazy-bg.is-loaded,
.lazy-img.is-loaded {
    opacity: 1;
}

.lazy-bg {
    opacity: 0.2;
    transition: opacity 0.25s ease;
}

.lazy-img {
    opacity: 0;
    transition: opacity 0.25s ease;
}

@media (min-width: 576px) {
    .category-item {
        max-width: 160px;
    }
}
