* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

a {
    text-decoration: none;
}

/* تم دارک (پیش‌فرض) */
:root {
    --background: #0a0a0a;
    --foreground: #ffaa16;
    --card: #2a2a2a;
    --card-foreground: #ffaa16;
    --primary: #ffb22c;
    --primary-foreground: #1a1a1a;
    --secondary: #ffb22c;
    --secondary-foreground: #ffffff;
    --muted: #4a4a4a;
    --muted-foreground: #cccccc;
    --accent: #ffb22c;
    --accent-foreground: #1a1a1a;
    --border: #ffb22c;
    --header-bg: #0d0d0d;
    --category-tabs-bg: #0a0a0a;
    --tab-bg: #1a1a1a;
    --tab-hover-bg: #4a4a4a;
    --footer-bg: #101010;
    --unavailable-color: #dc3545;
    --popular-badge-shadow: rgba(255, 178, 44, 0.4);
    --card-hover-shadow: rgba(255, 170, 22, 0.3);
    --card-hover-color: #ffaa16;
}

/* تم لایت */
html:not(.dark) {
    --background: #f8f6f0;
    --foreground: #2d1810;
    --card: #ffffff;
    --card-foreground: #2d1810;
    --primary: #8b4513;
    --primary-foreground: #ffffff;
    --secondary: #d4c5a0;
    --secondary-foreground: #2d1810;
    --muted: #e8dcc0;
    --muted-foreground: #5d4e37;
    --accent: #8b4513;
    --accent-foreground: #ffffff;
    --border: #d4c5a0;
    --header-bg: #ffffff;
    --category-tabs-bg: #f0ebe0;
    --tab-bg: #ffffff;
    --tab-hover-bg: #e8dcc0;
    --footer-bg: #f0ebe0;
    --unavailable-color: #dc3545;
    --popular-badge-shadow: rgba(139, 69, 19, 0.3);
    --card-hover-shadow: rgba(139, 69, 19, 0.2);
    --card-hover-color: #8b4513;
}

body {
    font-family: 'Vazir', sans-serif;
    background: var(--background);
    color: var(--foreground);
    min-height: 100vh;
    direction: rtl;
    text-align: right;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header Styles */
.header {
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
    padding: 2rem 0;
    text-align: center;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.logo {
    width: 80px;
    height: 80px;
    transition: filter 0.3s ease;
}

.header h1 {
    font-size: 3rem;
    font-weight: 800;
    color: var(--foreground);
    margin: 0;
    transition: color 0.3s ease;
}

.header p {
    color: var(--foreground);
    font-size: 1.125rem;
    margin: 0;
    transition: color 0.3s ease;
}

/* دکمه تغییر تم */
.theme-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    background: var(--primary);
    color: var(--primary-foreground);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    font-size: 1.25rem;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 4px 12px var(--popular-badge-shadow);
}

    .theme-toggle:hover {
        transform: scale(1.1);
        box-shadow: 0 6px 20px var(--popular-badge-shadow);
    }

/* Loading Spinner */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 4rem 0;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--muted);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transition: border-color 0.3s ease;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Error Message */
.error-message {
    background: var(--unavailable-color);
    color: white;
    padding: 1rem;
    border-radius: 0.5rem;
    margin: 1rem 0;
    text-align: center;
    display: none;
}

/* Category Tabs */
.category-tabs {
    background: var(--category-tabs-bg);
    padding: 1rem 0;
    border-bottom: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    left: 0;
    transition: background-color 0.3s ease;
}

    .category-tabs .container {
        max-width: 100% !important;
        padding: 0;
        margin: 0;
    }

.tabs-container {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding: 0.5rem;
    align-items: center;
}

.tab-button {
    background: var(--tab-bg);
    color: var(--foreground);
    padding: 1rem 1rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Vazir', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    min-width: 100px;
    max-width: 150px;
    flex-shrink: 0;
    box-sizing: border-box;
}

.tab-button span {
    display: block;
    text-align: center;
    width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    line-height: 1.3;
}

    .tab-button:hover {
        background: #cc8b1a; /* رنگ تیره‌تر از #ffb22c */
        color: var(--primary-foreground);
        border-color: #cc8b1a;
    }

    .tab-button.active {
        background: var(--primary);
        color: var(--primary-foreground);
        border-color: var(--primary);
    }

/* Category Icon in Tabs */
.category-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid transparent;
    transition: border-color 0.3s ease;
}

.tab-button.active .category-icon {
    border-color: var(--primary-foreground);
}

/* Menu Grid */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
    padding: 2rem 0;
}

.admin-center {
    display: flex;
    justify-content: center; /* وسط افقی */
    align-items: center; /* وسط عمودی */
    height: 100px; /* کل ارتفاع صفحه */
    width: 100%; /* پر کردن کل عرض صفحه */
    margin-top:20px;
}


/* Menu Item Card - Design دایره‌ای */
.menu-item {
    background: var(--card);
    border-radius: 1.5rem;
    padding: 1.5rem;
    transition: all 0.3s ease;
    border: 1px solid var(--border);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

    .menu-item:hover {
        transform: translateY(-8px);
        box-shadow: 0 20px 40px var(--card-hover-shadow);
        border-color: var(--card-hover-color);
    }

.menu-item-image-container {
    position: relative;
    margin-bottom: 1rem;
}

.menu-item img {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--primary);
    transition: border-color 0.3s ease;
    border-color: var(--card-hover-color);
}

.menu-item:hover img {
    border-color: var(--card-hover-color);
}

.popular-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--primary);
    color: var(--primary-foreground);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: 0 2px 8px var(--popular-badge-shadow);
    transition: all 0.3s ease;
}

.menu-item-content {
    text-align: center;
    width: 100%;
}

.menu-item h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--foreground);
    transition: color 0.3s ease;
}

.menu-item p {
    color: var(--muted-foreground);
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 1rem;
    transition: color 0.3s ease;
}

.menu-item-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--foreground);
    padding: 0.5rem 1rem;
    background: var(--card);
    border-radius: 0.75rem;
    border: 1px solid var(--primary);
    transition: all 0.3s ease;
}

/* Unavailable Items */
.menu-item.opacity-50 {
    opacity: 0.6;
}

.menu-item .text-red-500 {
    color: var(--unavailable-color);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    font-weight: 500;
}

/* Footer */
.footer {
    background: var(--footer-bg);
    color: var(--foreground);
    padding: 2rem 0;
    margin-top: 3rem;
    text-align: center;
    transition: all 0.3s ease;
}

    .footer p {
        margin-bottom: 0.5rem;
        transition: color 0.3s ease;
    }

    .footer .address {
        opacity: 0.75;
        font-size: 0.875rem;
    }

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 0;
    color: var(--muted-foreground);
    font-size: 1.125rem;
    transition: color 0.3s ease;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }

    .logo {
        width: 60px;
        height: 60px;
    }

    .menu-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 1.5rem;
        padding: 1rem 0;
    }

    .tabs-container {
        justify-content: flex-start;
        gap: 0.5rem;
        padding: 0.5rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    .tab-button {
        min-width: 90px;
        max-width: 140px;
        padding: 0.75rem 0.5rem;
        flex-shrink: 0;
    }

    .tab-button span {
        font-size: 0.8125rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
        line-height: 1.3;
        display: block;
    }

    .category-icon {
        width: 40px;
        height: 40px;
        flex-shrink: 0;
    }

    .theme-toggle {
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .menu-grid {
        grid-template-columns: 1fr;
    }

    .header h1 {
        font-size: 1.75rem;
    }

    .logo {
        width: 50px;
        height: 50px;
    }

    .tabs-container {
        gap: 0.5rem;
        padding: 0.5rem 0.25rem;
    }

    .tab-button {
        min-width: 75px;
        max-width: 120px;
        padding: 0.5rem 0.4rem;
        flex-shrink: 0;
    }

    .tab-button span {
        font-size: 0.75rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
        line-height: 1.2;
        display: block;
    }

    .category-icon {
        width: 35px;
        height: 35px;
        flex-shrink: 0;
    }

    .menu-item img {
        width: 150px;
        height: 150px;
    }

    .theme-toggle {
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
        top: 15px;
        left: 15px;
    }
}

/* انیمیشن‌های اضافی برای تغییر تم */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* بهبود دیدن متن در تم لایت */
html:not(.dark) .menu-item h3 {
    color: var(--primary);
}

html:not(.dark) .header h1,
html:not(.dark) .header p {
    color: var(--primary);
}

html:not(.dark) .footer,
html:not(.dark) .footer p {
    color: var(--primary);
}

/* رنگ‌های ویژه تم دارک */
html.dark .header h1,
html.dark .header p,
html.dark .footer,
html.dark .footer p,
html.dark .menu-item h3,
html.dark .menu-item-price {
    color: #ffaa16;
}

html.dark .tab-button.active {
    background: #ffb22c;
    color: #0a0a0a;
}

/* بهبود سایه‌ها در تم لایت */
html:not(.dark) .menu-item:hover {
    box-shadow: 0 15px 35px var(--card-hover-shadow);
}

html:not(.dark) .tab-button:hover,
html:not(.dark) .tab-button.active {
    box-shadow: 0 4px 12px var(--popular-badge-shadow);
}

/* اسکرول بار سفارشی */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--muted);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

    ::-webkit-scrollbar-thumb:hover {
        background: var(--accent);
    }
