@font-face {
    font-family: 'Artin';
    src: url('../Webfonts/woff/ArtinSharpFN-Black.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}

:root {
    --primary-color: #A01E21;
    --text-dark: #333;
    --text-muted: #888;
    --text-danger: #d32f2f;
    --bg-header: rgba(160, 30, 33, 0.1);
    --bg-card: rgba(255, 255, 255, 0.05);
    --bg-category: linear-gradient(135deg, #A01E21, #7A1719);
    --bg-category-nav: rgba(160, 30, 33, 0.1);
    --shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
    --shadow-category: 0 6px 12px rgba(160, 30, 33, 0.5);
    --font-size-title: 14px;
    --font-size-price: 14px;
    --font-size-desc: 11px;
    --font-size-allergen: 10px;
    --font-size-category: 0.75rem;
    --header-height: 3.25rem;
    --footer-height: calc(var(--header-height) - 0.5rem - 5px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Artin', sans-serif;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(13, 13, 18, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 4000;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease;
}

.loading-overlay.fade-out {
    opacity: 0;
}

.loader {
    height: 80px;
    aspect-ratio: 1;
    padding: 4px;
    border-radius: 50%;
    box-sizing: border-box;
    position: relative;
    z-index: 2;
}

.loader:before {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-conic-gradient(#0000 0 5%, #C02942 0 20%, #0000 20% 50%);
    animation: l2 1.5s linear infinite;
}

@keyframes l2 {
    to { rotate: 1turn }
}

body {
    background-color: #0d0d12;
    color: #fff;
    direction: rtl;
    padding-top: var(--header-height);
    padding-bottom: var(--footer-height);
    position: relative;
    overflow-x: hidden;
}

header {
    background: var(--bg-header);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(160, 30, 33, 0.2);
    position: fixed;
    top: 0;
    width: 100%;
    height: var(--header-height);
    z-index: 1000;
    box-shadow: var(--shadow);
    padding: 0;
    overflow: visible;
    transition: height 0.4s ease-in-out, background 0.3s ease;
}

header.full-screen-open {
    height: 100vh;
    background: var(--bg-header);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    overflow-y: auto;
}

@supports not (backdrop-filter: blur(15px)) {
    header, header.full-screen-open {
        background: rgba(160, 30, 33, 0.2);
    }
}

.category-nav {
    display: flex;
    overflow-x: auto;
    padding: 0.5rem 0.5rem 0.5rem 0;
    scrollbar-width: none;
    white-space: nowrap;
    height: 100%;
    align-items: center;
    scroll-snap-type: none;
    z-index: 1001;
}

header.full-screen-open .category-nav {
    display: none;
}

.category-nav::-webkit-scrollbar {
    display: none;
}

.category-link {
    display: inline-flex;
    align-items: center;
    color: #fff;
    text-decoration: none;
    padding: 0.3rem 0.75rem;
    margin: 0 0.25rem;
    background: var(--bg-category-nav);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(160, 30, 33, 0.2);
    border-radius: 0.5rem;
    font-size: var(--font-size-category);
    line-height: 1.2;
    width: fit-content;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
}

.category-link:first-child {
    margin-right: 0;
}

@supports not (backdrop-filter: blur(10px)) {
    .category-link {
        background: rgba(160, 30, 33, 0.2);
    }
}

.category-link:hover {
    background: rgba(160, 30, 33, 0.3);
    transform: scale(1.05);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.category-link.active {
    background: rgba(160, 30, 33, 0.4);
    transform: scale(1.05);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.5);
    animation: highlightPulse 0.6s ease-in-out;
}

@keyframes highlightPulse {
    0% { transform: scale(1); box-shadow: 0 0 0 rgba(255, 255, 255, 0); }
    50% { transform: scale(1.1); box-shadow: 0 0 15px rgba(255, 255, 255, 0.7); }
    100% { transform: scale(1.05); box-shadow: 0 0 12px rgba(255, 255, 255, 0.5); }
}

.category-icon, .category-title-icon, .favicon-icon-left, .item-image, .iran-map, .popup-image, .ticker-separator {
    opacity: 1;
}

.category-icon {
    height: 1.8125rem;
    margin-left: 0.5rem;
}

.category-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.toggle-menu {
    position: absolute;
    top: 100%;
    left: 0.5rem;
    width: 4rem;
    height: 1.5rem;
    background: var(--bg-header);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(160, 30, 33, 0.2);
    border-radius: 0 0 50% 50%;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: grab;
    z-index: 1001;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

@supports not (backdrop-filter: blur(10px)) {
    .toggle-menu {
        background: rgba(160, 30, 33, 0.2);
    }
}

.toggle-menu:active {
    cursor: grabbing;
}

.toggle-menu .menu-text {
    font-size: 0.6rem;
    font-weight: 300;
    line-height: 1;
    margin-bottom: 0.1rem;
}

.toggle-menu .menu-icon {
    position: absolute;
    bottom: -0.5rem;
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}

.toggle-menu:hover {
    background: rgba(160, 30, 33, 0.3);
    transform: scale(1.1);
}

.toggle-menu:hover .menu-icon {
    transform: scale(1.2);
}

.close-fullscreen {
    display: none;
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 2rem;
    height: 2rem;
    background: rgba(160, 30, 33, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: #fff;
    font-size: 1.2rem;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1002;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

header.full-screen-open .close-fullscreen {
    display: grid;
}

.close-fullscreen:hover {
    background: rgba(160, 30, 33, 0.5);
    transform: scale(1.1);
}

@supports not (backdrop-filter: blur(10px)) {
    .close-fullscreen {
        background: rgba(160, 30, 33, 0.4);
    }
}

.full-screen-menu {
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

header.full-screen-open .full-screen-menu {
    display: block;
    opacity: 1;
    padding: 1rem;
    height: 100%;
    overflow-y: auto;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    max-width: 90rem;
    margin: 0 auto;
}

header.full-screen-open .category-grid {
    margin-top: 2rem;
}

.full-screen-category {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    background: var(--bg-category-nav);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(160, 30, 33, 0.2);
    border-radius: 0.5rem;
    color: #fff;
    text-decoration: none;
    font-size: var(--font-size-category);
    text-align: center;
    width: 100%;
    min-height: 4rem;
    box-sizing: border-box;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

@supports not (backdrop-filter: blur(10px)) {
    .full-screen-category {
        background: rgba(160, 30, 33, 0.2);
    }
}

.full-screen-category:hover {
    background: rgba(160, 30, 33, 0.3);
    transform: scale(1.05);
}

.full-screen-category .category-icon {
    height: 1.8125rem;
    margin-bottom: 0.25rem;
}

.full-screen-category .category-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.container {
    max-width: 90rem;
    margin: 0 auto;
    padding: 1rem;
}

.no-items {
    text-align: center;
    color: #fff;
    font-size: 1rem;
    margin: 2rem 0;
}

.category-section {
    margin-bottom: 1.5rem;
}

.category-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #fff;
    font-size: 1.275rem;
    margin-bottom: 0.75rem;
    background: var(--bg-category);
    padding: 0.5rem 1rem;
    width: 100%;
    box-shadow: var(--shadow-category);
    border-radius: 0.5rem;
}

.favicon-icon-left {
    height: 100%;
    max-height: 2.5rem;
    width: auto;
    object-fit: contain;
    align-self: center;
}

.category-title-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.category-title-icon {
    height: 2rem;
}

.menu-items {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.menu-item {
    background: var(--bg-card);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    box-shadow: var(--shadow);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

@supports not (backdrop-filter: blur(15px)) {
    .menu-item {
        background: rgba(255, 255, 255, 0.15);
    }
}

.menu-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: var(--background-image);
    background-size: cover;
    background-position: center center;
    opacity: 0.2;
    filter: blur(5px);
    z-index: -1;
}

.menu-item:hover {
    transform: scale(1.02);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.item-image {
    width: 35%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 12px;
    z-index: 1;
}

.item-details {
    flex: 1;
    z-index: 1;
}

.item-title {
    font-size: var(--font-size-title);
    color: #fff;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.item-price {
    font-size: var(--font-size-price);
    color: #fff;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.price-text {
    white-space: nowrap;
}

.item-description {
    font-size: var(--font-size-desc);
    color: #bbb;
    margin-bottom: 0.5rem;
}

.item-allergen {
    font-size: var(--font-size-allergen);
    color: #bbb;
}

.sticky-footer {
    position: fixed;
    bottom: 0;
    width: 100%;
    height: var(--footer-height);
    background: var(--bg-header);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-top: 1px solid rgba(160, 30, 33, 0.2);
    z-index: 3000;
    display: flex;
    align-items: center;
    padding: 0 2px;
}

@supports not (backdrop-filter: blur(15px)) {
    .sticky-footer {
        background: rgba(160, 30, 33, 0.2);
    }
}

.iran-map {
    position: absolute;
    left: 0;
    bottom: 2px;
    height: calc(var(--footer-height) + 1rem);
    width: auto;
    object-fit: contain;
    z-index: 3001;
    cursor: pointer;
}

.scroll-to-top {
    position: absolute;
    right: 0.5rem;
    bottom: 2.5rem;
    width: 2rem;
    height: 2rem;
    background: var(--bg-header);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(160, 30, 33, 0.2);
    border-radius: 50%;
    color: #fff;
    display: none;
    place-items: center;
    cursor: pointer;
    z-index: 3002;
    transition: opacity 0.3s ease, transform 0.2s ease;
}

.scroll-to-top.visible {
    display: grid;
}

.scroll-to-top:hover {
    background: rgba(160, 30, 33, 0.3);
    transform: scale(1.1);
}

@supports not (backdrop-filter: blur(10px)) {
    .scroll-to-top {
        background: rgba(160, 30, 33, 0.2);
    }
}

.scroll-to-top-icon {
    font-size: 1rem;
}

.ticker {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    margin-left: calc(var(--footer-height) + 1.5rem);
    direction: ltr;
    position: relative;
    z-index: 3001;
}

.ticker-content {
    display: inline-flex;
    animation: ticker var(--ticker-duration, 20s) linear infinite;
    will-change: transform;
    gap: 0;
}

.ticker-item {
    display: inline-block;
    color: #fff;
    font-size: 0.75rem;
    margin: 0 0.5rem;
    vertical-align: middle;
}

.ticker-separator {
    display: inline-block;
    max-height: 22px;
    max-width: 22px;
    width: auto;
    vertical-align: middle;
    margin: 0 1rem;
    object-fit: contain;
}

@keyframes ticker {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: calc(100% - var(--footer-height));
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.popup.open {
    opacity: 1;
    visibility: visible;
}

.popup-content {
    background: var(--bg-card);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-width: 31.25rem;
    transform: translateY(calc(100% + var(--footer-height)));
    transition: transform 0.3s ease-out;
    position: relative;
}

.popup.open .popup-content {
    transform: translateY(var(--footer-height));
}

@supports not (backdrop-filter: blur(15px)) {
    .popup-content {
        background: rgba(255, 255, 255, 0.15);
    }
}

.popup-image-container {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.popup-image {
    width: 100%;
    max-height: calc(80vh - var(--footer-height));
    border-radius: 20px 20px 0 0;
    object-fit: cover;
    display: block;
}

.popup-details-overlay {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    text-align: right;
    max-width: 70%;
    z-index: 2002;
}

.popup-details-overlay .item-title {
    font-size: 14px;
    color: #fff;
    margin-bottom: 0.25rem;
    font-weight: bold;
}

.popup-details-overlay .item-price {
    font-size: 13px;
    color: #fff;
    margin-bottom: 0.25rem;
}

.popup-details-overlay .item-description {
    font-size: 11px;
    color: #ddd;
    margin-bottom: 0.25rem;
}

.popup-details-overlay .item-allergen {
    font-size: 10px;
    color: #ddd;
}

.close-popup {
    position: absolute;
    top: -2.3125rem;
    right: 1rem;
    font-size: 1.5rem;
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    display: grid;
    place-items: center;
    cursor: pointer;
    z-index: 2600;
    pointer-events: auto;
    transition: background-color 0.2s ease;
}

.close-popup:hover {
    background: rgba(0, 0, 0, 0.7);
}

@supports not (backdrop-filter: blur(10px)) {
    .close-popup {
        background: rgba(0, 0, 0, 0.5);
    }
}

@media (min-width: 48rem) {
    :root {
        --header-height: 3.75rem;
        --footer-height: calc(var(--header-height) - 0.5rem - 5px);
    }
    body { 
        padding-top: var(--header-height); 
        padding-bottom: var(--footer-height);
    }
    header { height: var(--header-height); }
    header.full-screen-open { height: 100vh; }
    .category-link { font-size: 0.85rem; padding: 0.4rem 0.75rem; }
    .category-icon { height: 2.21rem; }
    .full-screen-category { min-height: 4.5rem; }
    .full-screen-category .category-icon { height: 2.21rem; margin-bottom: 0.3rem; }
    .toggle-menu { width: 4.5rem; height: 1.75rem; bottom: 0; }
    .toggle-menu .menu-text { font-size: 0.7rem; }
    .toggle-menu .menu-icon { font-size: 0.9rem; bottom: -0.6rem; }
    .close-fullscreen { width: 2.5rem; height: 2.5rem; font-size: 1.5rem; }
    .category-title { font-size: 1.375rem; }
    .category-title-icon { height: 2.25rem; }
    .favicon-icon-left { max-height: 3rem; }
    .menu-items { grid-template-columns: repeat(2, 1fr); }
    .item-title { font-size: 16px; }
    .item-price { font-size: 15px; }
    .popup { height: calc(100% - var(--footer-height)); }
    .popup-content { max-width: 37.5rem; }
    .popup-content { transform: translateY(calc(100% + var(--footer-height))); }
    .popup.open .popup-content { transform: translateY(var(--footer-height)); }
    .popup-image { border-radius: 20px 20px 0 0; max-height: calc(80vh - var(--footer-height)); }
    .popup-details-overlay {
        top: 1.25rem;
        right: 1.25rem;
        padding: 1rem 1.25rem;
        z-index: 2002;
    }
    .popup-details-overlay .item-title { font-size: 16px; }
    .popup-details-overlay .item-price { font-size: 15px; }
    .popup-details-overlay .item-description { font-size: 13px; }
    .popup-details-overlay .item-allergen { font-size: 12px; }
    .close-popup { font-size: 1.25rem; width: 1.75rem; height: 1.75rem; top: -2.3125rem; right: 1rem; z-index: 2600; }
    .ticker { margin-left: calc(var(--footer-height) + 1.5rem); }
    .ticker-item { font-size: 0.85rem; }
    .ticker-separator { max-height: 22px; max-width: 22px; }
    .scroll-to-top { width: 2.5rem; height: 2.5rem; bottom: 3rem; }
    .scroll-to-top-icon { font-size: 1.2rem; }
    .iran-map { height: calc(var(--footer-height) + 1rem); }
}

@media (min-width: 64rem) {
    .menu-items { grid-template-columns: repeat(3, 1fr); }
    .container { padding: 1.5rem; }
}

@media (min-width: 90rem) {
    .menu-items { grid-template-columns: repeat(4, 1fr); }
}