/* ==========================================================
   Style.css
   ========================================================== */
:root {
    --primary-color: #1E5A35;       /* سبز تیره کافه‌ای (لوگو) */
    --accent-color: #D2B48C;        /* بژ روشن/قهوه‌ای */
    --background-color: #F8F8F8;
    --card-background: #FFFFFF;
    --text-dark: #333333;
    --text-light: #F8F8F8;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --button-color: #1E5A35; /* قرمز برای دکمه‌های اصلی و سبد خرید */
}

body {
    margin: 0;
    font-family: 'Tahoma', 'Arial', sans-serif;
    background-color: var(--background-color);
    color: var(--text-dark);
    direction: rtl;
    line-height: 1.6;
    overflow: hidden; /* جلوگیری از اسکرول هنگام لودینگ */
}

/* ------------------ Splash Screen ------------------ */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--background-color);
    z-index: 5000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.5s ease-out; /* انیمیشن محو شدن */
}

.splash-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none; /* مهم: برای اطمینان از کلیک شدن عناصر زیرین */
}

.splash-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.splash-logo {
    width: 150px;
    height: auto;
    animation: bounce-logo 2s infinite ease-in-out; /* انیمیشن بالا و پایین */
}

.loading-text {
    margin-top: 20px;
    font-size: 18px;
    font-weight: bold;
    color: var(--primary-color);
}

@keyframes bounce-logo {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

/* برای مخفی کردن محتوای اصلی تا زمانی که اسپلش برود */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden; 
    position: relative;
    visibility: visible; /* پیش فرض قابل مشاهده */
    opacity: 1;
    transition: opacity 0.5s ease-in;
}

.app-container.hidden-initial {
    visibility: hidden;
    opacity: 0;
}

/* ------------------ Item Image Fix (نکته ۳: تغییر ابعاد) ------------------ */
.item-image {
    width: 100%;
    height: 300px; /* ابعاد درخواستی */
    object-fit: cover;
    display: block;
}


.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* ------------------ ۱. App Bar و لوگو ------------------ */
.app-header {
    background-color: var(--primary-color);
    color: var(--text-light);
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    z-index: 200;
}

.logo-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cafe-logo {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background-color: white; /* برای وضوح بیشتر لوگوی مشکی */
    padding: 2px;
}

.cafe-name {
    font-size: 18px;
    font-weight: bold;
}

.cart-icon-header {
    font-size: 24px;
    cursor: pointer;
    position: relative;
    padding: 5px;
}

.cart-badge {
    position: absolute;
    top: 0;
    right: 0;
    background-color: red;
    color: white;
    font-size: 10px;
    border-radius: 50%;
    padding: 2px 5px;
    line-height: 1;
}

/* ------------------ ۲. نوار دسته‌بندی‌ها ------------------ */
.category-tabs-container {
    background-color: var(--card-background);
    padding: 10px 0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    z-index: 100;
}

.category-tabs {
    display: flex;
    overflow-x: scroll;
    padding: 0 15px;
    gap: 10px;
}

.category-tabs::-webkit-scrollbar {
    display: none;
}

.tab-item {
    white-space: nowrap;
    padding: 10px 18px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-dark);
    background-color: #EEE; /* خاکستری روشن */
    transition: all 0.3s;
    border: 1px solid transparent;
}

.tab-item.active {
    font-weight: bold;
    color: var(--text-light);
    background-color: var(--primary-color);
    border-color: var(--accent-color);
    box-shadow: 0 2px 5px rgba(30, 90, 53, 0.4);
}

/* ------------------ ۳. لیست آیتم‌ها و هدرها ------------------ */
.menu-list-container {
    flex-grow: 1;
    overflow-y: scroll;
    padding: 15px 0 80px 0; /* فاصله پایین برای نوار سبد خرید */
}

.search-bar {
    padding: 0 15px 15px;
}

.search-input {
    width: 100%;
    padding: 12px 40px 12px 15px;
    border: 1px solid #DDD;
    border-radius: 25px;
    background-color: var(--card-background);
    font-size: 14px;
    box-sizing: border-box;
    background-image: url('search-icon.svg'); /* آیکون جستجو */
    background-repeat: no-repeat;
    background-position: 15px center;
}

.category-header {
    font-size: 20px;
    font-weight: bold;
    padding: 15px;
    background-color: var(--background-color);
    position: sticky;
    top: 0;
    z-index: 5;
    border-bottom: 2px solid var(--accent-color);
    margin-top: 10px;
}

.item-card {
    background-color: var(--card-background);
    margin: 10px 15px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.item-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.item-details {
    padding: 15px;
    display: flex;
    flex-direction: column;
}

.item-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 5px;
}

.item-description {
    font-size: 12px;
    color: #888;
    margin-bottom: 10px;
    height: 30px; /* محدود کردن ارتفاع توضیحات */
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.item-price {
    font-size: 16px;
    font-weight: bold;
    color: var(--primary-color);
}

.add-remove-controls {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ------------------ استایل اصلاح شده برای دکمه‌های کنترل (افزودن/کاهش) ------------------ */
.control-button {
    /* ۱. تضمین دایره کامل (Width = Height) */
    width: 38px;  /* اندازه دایره را روی یک مقدار ثابت تنظیم کنید */
    height: 38px;
    border-radius: 50%; /* تبدیل به دایره کامل در همه مرورگرها */
    
    /* ۲. مرکزیت کامل آیکون (Vertical & Horizontal Centering) */
    display: flex;
    justify-content: center; /* مرکزیت افقی آیکون */
    align-items: center; /* مرکزیت عمودی آیکون */
    
    /* استایل‌های پایه */
    background-color: var(--button-color); /* یا رنگ دلخواه شما */
    color: white;
    border: none;
    cursor: pointer;
    font-size: 18px; /* اندازه آیکون + را کمی بزرگتر کنید */
    transition: background-color 0.2s;
    padding: 0; /* مهم: حذف هرگونه پدینگ پیش‌فرض مرورگر */
    flex-shrink: 0; /* جلوگیری از تغییر اندازه دایره در فلکس باکس‌ها */
}

/* اگر دکمه‌های مودال شما کوچک‌تر هستند، مطمئن شوید که استایل زیر نیز شامل border-radius: 50% باشد */
.modal-controls .control-button {
    width: 25px;
    height: 25px;
    font-size: 14px;
    /* این دایره بودن را از .control-button بالا به ارث می‌برد */
}

/* استایل خاص دکمه افزودن */
.control-button.add {
    background-color: #e53935; /* یا رنگ سبز مورد نظر شما */
}

/* ------------------ ۴. نوار سبد خرید (Screen 1) ------------------ */
.cart-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--button-color); /* قرمز جذاب برای جلب توجه */
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 50px;
    transition: transform 0.3s ease-out;
    box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.3);
    z-index: 150;
    font-size: 16px;
    font-weight: bold;
}

.cart-bar.hidden {
    transform: translateY(100%); /* Screen 3 */
}

.cart-button {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

/* ------------------ ۵. مودال سبد خرید (Screen 2) ------------------ */
/* ==========================================================
   Style.css - اصلاح بخش مودال
   ========================================================== */

/* استایل اصلی مودال: مطمئن شوید در ابتدا مخفی است */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6); /* پس‌زمینه نیمه‌شفاف */
    display: none; /* مهم: در حالت عادی مخفی باشد */
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    justify-content: center;
    align-items: flex-end; /* برای نمایش از پایین */
}

/* حالتی که مودال باز است */
.modal.open {
    display: flex; /* نمایش دادن با فلکس */
    opacity: 1;
}

.modal-content {
    background-color: var(--card-background);
    width: 100%; /* در موبایل تمام عرض را بگیرد */
    max-height: 80vh; /* حداکثر ۸۰ درصد ارتفاع صفحه */
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.2);
    transform: translateY(100%); /* در حالت عادی از پایین مخفی باشد */
    animation: slideUp 0.3s forwards; /* انیمیشن ورود */
}

.modal.open .modal-content {
    transform: translateY(0); /* بالا آمدن هنگام باز شدن */
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* ... سایر استایل‌های مودال (modal-header, modal-body, modal-footer) ... */


.modal-header {
    background-color: var(--card-background);
    border-bottom: 1px solid #eee;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 18px;
    font-weight: bold;
}

.modal-footer {
    background-color: var(--background-color);
    padding: 15px;
    border-top: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.modal-summary-row {
    display: flex;
    justify-content: space-between;
}

.modal-total-price-row {
    font-size: 20px;
    font-weight: bold;
    color: #E53935;
}

.order-button {
    background-color: var(--button-color); /* قرمز قوی برای دکمه نهایی */
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: background-color 0.2s;
}

.cart-modal-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px dashed #eee;
}

/* ------------------ ۶. دکمه‌های کنترلی درون مودال ------------------ */
.modal-controls {
    display: flex;
    align-items: center;
    gap: 5px;
}

.modal-controls .control-button {
    width: 25px;
    height: 25px;
    font-size: 14px;
    background-color: var(--primary-color);
}
.modal-controls .control-button.minus {
    background-color: #AAA;
}
.modal-controls .control-button.add {
    background-color: #4CAF50;
}

.app-header {
    background-color: var(--primary-color);
    /* ... */
}
/* ... */
.category-tabs-container {
    background-color: var(--card-background);
    /* ... */
}
/* ... */
.tab-item.active {
    background-color: var(--primary-color);
    /* ... */
}
/* ... */
.cart-bar {
    background-color: var(--button-color); 
    /* ... */
}
.order-button, .cart-button {
    background-color: var(--button-color);
    /* ... */
}
.add-remove-controls .control-button.add {
    background-color: var(--button-color); 
}
/* ... */