/* ===== تم روشن (گرم) ===== */
:root {
    --bg-body: #FDF9F2;
    --bg-card: #FFFFFF;
    --text-primary: #3D2A1F;
    --text-secondary: #7B5E4A;
    --border: #EDE3D6;
    --accent: #C78A4F;
    --accent-dark: #A86F3C;
    --shadow: 0 4px 12px rgba(0,0,0,0.05);
    --header-bg: #FFFFFF;
}

/* ===== تم تیره (شبِ گرم) ===== */
body.dark {
    --bg-body: #1E1915;
    --bg-card: #2C2520;
    --text-primary: #F2EBE4;
    --text-secondary: #C7B7AA;
    --border: #40362F;
    --accent: #E2A46B;
    --accent-dark: #C98749;
    --shadow: 0 4px 12px rgba(0,0,0,0.4);
    --header-bg: #2C2520;
}

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

body {
    font-family: 'Vazirmatn', sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    direction: rtl;
    line-height: 1.5;
}

.cafe-screen {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg-body);
}

/* ========== هدر ========== */
.cafe-header {
    background: var(--header-bg);
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    text-align: center;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.header-logo {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    order: 2; /* در RTL لوگو سمت راست می‌رود */
}

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

.header-text h1 {
    font-size: 1.3rem;
    margin: 0;
    line-height: 1.3;
    color: var(--text-primary);
}

.header-text p {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 4px 0 0;
}

/* موبایل خیلی کوچک */
@media (max-width: 380px) {
    .header-logo {
        width: 50px;
        height: 50px;
    }
    .header-text h1 {
        font-size: 1.1rem;
    }
    .header-text p {
        font-size: 0.7rem;
    }
}

/* ========== جستجو ========== */
.cafe-search {
    margin: 16px;
    position: relative;
}

.cafe-search i {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--accent);
}

.cafe-search input {
    width: 100%;
    padding: 12px 45px 12px 16px;
    border: 1px solid var(--border);
    border-radius: 40px;
    background: var(--bg-card);
    color: var(--text-primary);
}

/* ========== پروموشن (در صورت استفاده) ========== */
.cafe-promo {
    margin: 16px;
    background: var(--bg-card);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    box-shadow: var(--shadow);
}

.promo-content {
    flex: 1;
}

.promo-content h3 {
    font-size: 1rem;
    margin-bottom: 6px;
}

.promo-content p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.promo-btn {
    background: var(--accent);
    color: white;
    padding: 6px 16px;
    border-radius: 30px;
    text-decoration: none;
    font-size: 0.8rem;
    display: inline-block;
}

.promo-img {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 16px;
    margin-right: 12px;
}

/* ========== دسته‌بندی ========== */
.cafe-categories {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 15px 15px 0;
    margin-bottom: 10px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.cafe-categories::-webkit-scrollbar {
    display: none;
}

.cat-tab {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 30px;
    padding: 8px 20px;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.cat-tab.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* بهبود دسته‌بندی در تم تیره */
body.dark .cat-tab:not(.active) {
    background: #2d2d2d;
    border-color: #444;
    color: #e0e0e0;
}

body.dark .cat-tab:not(.active):hover {
    background: #3a3a3a;
    border-color: var(--accent);
}

/* ========== محصولات ========== */
.cafe-products {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 16px;
}

.product-card {
    background: var(--bg-card);
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid var(--border);
    position: relative;
    transition: transform 0.2s;
}

.product-card:active {
    transform: scale(0.98);
}

.product-img {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
}

.product-info {
    padding: 12px;
}

.product-name {
    font-weight: 600;
    margin-bottom: 4px;
}

.product-price {
    color: var(--accent);
    font-weight: 700;
    margin: 6px 0;
}

.discount-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #dc2626;
    color: white;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 20px;
}

.info-btn {
    background: var(--accent);
    border: none;
    color: white;
    padding: 6px 12px;
    border-radius: 30px;
    font-size: 0.75rem;
    cursor: pointer;
    width: 100%;
    margin-top: 8px;
}

.empty-state {
    text-align: center;
    padding: 60px;
    color: var(--text-secondary);
    display: none;
}

/* ========== فوتر اصلی (منو) ========== */
.cafe-footer {
    text-align: center;
    padding: 20px;
    font-size: 13px;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
    margin-top: 24px;
    background: var(--bg-card);
}

.cafe-footer a {
    color: var(--accent);
    text-decoration: none;
    transition: opacity 0.2s;
}

.cafe-footer a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* ========== مودال محصول ========== */
.cafe-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-card);
    max-width: 90%;
    width: 350px;
    border-radius: 24px;
    padding: 20px;
    position: relative;
}

.modal-close {
    position: absolute;
    left: 15px;
    top: 15px;
    font-size: 28px;
    cursor: pointer;
}

.modal-content img {
    width: 100%;
    border-radius: 16px;
    margin-bottom: 12px;
}

.share-buttons {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    justify-content: center;
}

.share-buttons button,
.share-buttons a {
    background: var(--bg-body);
    padding: 6px 12px;
    border-radius: 30px;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 0.8rem;
    border: none;
    cursor: pointer;
}

/* ========== پرلودر ========== */
#preloader {
    position: fixed;
    inset: 0;
    background: var(--bg-body);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
}

.loader-cup {
    width: 50px;
    height: 50px;
    border: 4px solid var(--accent);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

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

.loader-logo {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin-bottom: 16px;
}

#preloader.hide {
    opacity: 0;
    visibility: hidden;
}

/* ========== لندینگ ========== */
.landing {
    min-height: 100vh;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
}

@media (max-width: 768px) {
    .landing {
        background-position: center center !important;
        background-size: cover;
    }
}

/* استایل اختصاصی لندینگ (فقط در صورت عدم وجود کلاس‌های دیگر) */
.landing::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1;
}

.landing-content {
    position: relative;
    z-index: 2;
    color: white;
}

.landing-logo {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin-bottom: 20px;
    object-fit: cover;
    border: 3px solid rgba(255,255,255,0.8);
}

.landing h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.landing p {
    font-size: 1rem;
    opacity: 0.9;
}

.landing-btn {
    background: var(--accent);
    color: white;
    padding: 12px 32px;
    border-radius: 40px;
    text-decoration: none;
    display: inline-block;
    margin-top: 20px;
    transition: 0.3s;
    font-weight: 600;
}

.landing-btn:hover {
    background: var(--accent-dark);
    transform: translateY(-2px);
}

/* فوتر لندینگ (ثابت پایین) */
.landing-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 20px;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    text-align: center;
    font-size: 13px;
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
    z-index: 10;
}

.landing-footer span,
.landing-footer a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    transition: 0.2s;
}

.landing-footer a:hover {
    color: var(--accent);
    text-decoration: underline;
}

.landing-footer i {
    font-size: 1.1rem;
}

@media (max-width: 576px) {
    .landing-logo {
        width: 80px;
        height: 80px;
    }
    .landing h1 {
        font-size: 1.8rem;
    }
    .landing-btn {
        padding: 10px 24px;
        font-size: 0.9rem;
    }
    .landing-footer {
        flex-direction: column;
        gap: 8px;
        padding: 12px;
        font-size: 12px;
    }
}
