/* =========================================
   1. Fonts & Global Variables
========================================= */
@font-face {
  font-family: "Doran";
  src:
    url("DoranFaNum-Bold.woff") format("woff"),
    url("DoranFaNum-Bold.woff2") format("woff2");
}

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

:root {
  --radius: 12px;
  --transition: all 0.3s ease;
  /* وضعیت لایت‌مود (پیش‌فرض) */
  --bg-color: #f8f9fa;
  --card-bg: #ffffff;
  --text-main: #333333;
  --text-muted: #777777;
  --border-color: rgba(128, 128, 128, 0.1);
  --shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

/* متغیرهای دارک‌مود */
body.dark-mode {
  --bg-color: #121212;
  --card-bg: #1e1e1e;
  --text-main: #f5f5f5;
  --text-muted: #aaaaaa;
  --border-color: rgba(255, 255, 255, 0.08);
  --shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

body {
  font-family: "Doran", sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition:
    background-color 0.3s,
    color 0.3s;
}

button,
input,
textarea,
select {
  font-family: inherit;
}

/* =========================================
   2. Dark Mode Toggle Button
========================================= */
.dark-mode-toggle {
  position: fixed;
  top: 15px;
  left: 15px;
  background-color: var(--card-bg);
  color: var(--text-main);
  border: none;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  box-shadow: var(--shadow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  z-index: 100;
  transition: var(--transition);
}

.dark-mode-toggle:hover {
  transform: scale(1.1);
}

/* =========================================
   3. User Side (Digital Menu)
========================================= */
/* هدر شیشه‌ای و مدرن */
.header {
  position: sticky;
  top: 0;
  z-index: 99;
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 20px;
  box-shadow: var(--shadow);
  text-align: center;
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.3s;
}

.logo {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  margin: 0 auto 10px;
  box-shadow: var(--shadow);
  border: 3px solid var(--card-bg);
  background-color: #eee;
}

.cafe-name {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary, #333);
  margin-bottom: 10px;
}

/* وضعیت باز/بسته */
.status {
  display: inline-flex;
  align-items: center;
  background: var(--card-bg);
  padding: 6px 16px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.status-light {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-left: 8px;
}

/* اصلاح تداخل انیمیشن‌ها: باز سبز متمایل به پالس، بسته قرمز ثابت */
.status-light.open {
  background-color: #10b981;
  animation: pulse 2s infinite;
}
.status-light.closed {
  background-color: #ef4444;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

/* باکس جستجو */
.search-box {
  position: relative;
  max-width: 500px;
  margin: 0 auto;
}
.search-box input {
  width: 100%;
  padding: 14px 45px 14px 20px;
  border: 2px solid transparent;
  border-radius: 50px;
  background: var(--bg-color);
  color: var(--text-main);
  font-size: 0.95rem;
  transition: var(--transition);
  outline: none;
}
.search-box input:focus {
  background: var(--card-bg);
  border-color: var(--primary, #064c8d);
  box-shadow: 0 0 0 4px rgba(6, 76, 141, 0.1);
}
.search-box i {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}
#searchResults {
  display: none;
}

/* محتوای اصلی و دسته‌بندی‌ها */
.content {
  max-width: 600px;
  margin: 30px auto;
  padding: 0 15px;
  min-height: 50vh;
}

.category {
  padding: 18px 20px;
  margin-bottom: 15px;
  border-radius: var(--radius);
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition);
  box-shadow: var(--shadow);
}

/* جایگزین هوشمند برای کدهای OnMouseOver خطی در PHP */
.category:hover {
  background-color: var(--secondary, #0a6ebd) !important;
}

.category::after {
  content: "\f107";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  transition: var(--transition);
}
.category.active::after {
  transform: rotate(180deg);
}

/* استایل بخش ویژه تخفیف‌ها */
.discount-header {
  background: linear-gradient(135deg, #ef4444, #f97316) !important;
  color: white;
}
.discount-header:hover {
  background: linear-gradient(135deg, #dc2626, #ea580c) !important;
}
.timer {
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.25);
  padding: 3px 10px;
  border-radius: 12px;
  margin-right: 8px;
  font-weight: 500;
}
.menu-item .category-badge-discount {
  color: #ef4444;
  font-size: 0.9rem;
}

/* منوی آیتم‌ها */
.menu {
  display: none;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 10px;
  margin-bottom: 25px;
  box-shadow: var(--shadow);
  animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.menu-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 10px;
  border-bottom: 1px dashed var(--border-color);
  transition: background-color 0.3s ease;
  color: var(--text-main);
}
.menu-item:last-child {
  border-bottom: none;
}
.menu-item:hover {
  background-color: var(--bg-color);
  border-radius: 8px;
}
/* =========================================
   آیتم‌های ناموجود (Unavailable Items)
========================================= */
.menu-item.unavailable {
  position: relative; /* برای تنظیم موقعیت نشان ناموجود */
  opacity: 0.65; /* کمی بیشتر از 0.5 تا متن ناموجود واضح‌تر دیده شود */
  /* filter: grayscale(80%); کاهش ۱۰۰٪ به ۸۰٪ برای زیباتر شدن ظاهر کلی منو */
  pointer-events: none;
}

/* اضافه کردن خودکار برچسب قرمز رنگ ناموجود */
.menu-item.unavailable::after {
  content: "ناموجود";
  position: absolute;
  top: 25px;
  left: 10px;
  background-color: #f00; /* رنگ قرمز اصلی منوکسا */
  color: #ffffff;
  padding: 5px 12px;
  font-size: 0.8rem;
  font-weight: bold;
  border-radius: 20px;
  box-shadow: 0 4px 10px rgb(231, 77, 60);
  z-index: 10;
  letter-spacing: 0.5px;

  /* انیمیشن بسیار ملایم برای جلب توجه کاربر */
  animation: pulse-red 2s infinite;
}

/* افکت انیمیشن نبض برای برچسب قرمز */
@keyframes pulse-red {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(231, 76, 60, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(231, 76, 60, 0);
  }
}

.item-details {
  flex: 1;
  padding-left: 15px;
}

.item-name {
  display: block;
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 4px;
}

.has-image {
  cursor: pointer;
  color: var(--primary, #064c8d);
  border-bottom: 1px dashed var(--primary, #064c8d);
}
.has-image::after {
  content: "\f03e";
  font-family: "Font Awesome 6 Free";
  font-weight: 400;
  font-size: 0.8rem;
  margin-right: 6px;
  color: var(--text-muted);
}

.item-description {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.item-price {
  text-align: left;
  font-weight: 800;
  white-space: nowrap;
}
.item-price::after {
  content: " تومان";
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
}

.original-price {
  display: block;
  text-decoration: line-through;
  color: #ef4444;
  font-size: 0.85rem;
  font-weight: 400;
}
.original-price::after {
  display: none;
}
.discounted-price {
  color: #10b981;
  font-size: 1.1rem;
}

/* استایل متن راهنمای منوی صبحانه */
.menu-note {
  color: var(--primary, #064c8d);
  font-size: 1.05rem;
  padding: 2px 3px;
  margin: 5px;
}

/* جستجوی بدون نتیجه */
.search-no-result {
  text-align: center;
  color: var(--text-muted);
  padding: 20px;
}

/* =========================================
   4. Footer Styling (Main Menu Only)
========================================= */

/* --- ۱. فوتر منوی اصلی کاربر (index.php) --- */
.footer {
  background-color: var(--card-bg, #ffffff);
  padding: 30px 20px 40px 20px; /* تنظیم پدینگ پایین برای حالت عادی منو */
  text-align: center;
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.03);
  margin-top: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  border-top: 1px solid var(--border-color);
}

.footer-section {
  width: 100%;
  margin-bottom: 0;
}
.footer-section h3 {
  font-size: 1.1rem;
  color: var(--text-main);
  margin-bottom: 15px;
}
.footer-section a {
  color: var(--primary, #064c8d);
  text-decoration: none;
  font-weight: bold;
  padding: 5px 10px;
  transition: var(--transition);
}
.footer-section p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.social-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-color);
  margin: 0 5px;
  color: var(--primary, #064c8d);
  font-size: 1.2rem;
  transition: var(--transition);
  text-decoration: none;
}
.social-links a i {
  font-size: 1.5rem;
}
.social-links a:hover {
  background: #e1306c; /* رنگ اختصاصی اینستاگرام هنگام هاور */
  color: #fff;
  transform: translateY(-3px);
}

/* دکمه تماس در فوتر کاربر */
.phone-link {
  display: inline-flex !important;
  align-items: center;
  background-color: var(--primary, #064c8d);
  color: #ffffff !important;
  padding: 10px 25px !important;
  border-radius: 50px;
  font-size: 1.1rem;
  font-weight: bold;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  transition: var(--transition);
}
.phone-link i {
  margin-left: 10px;
  font-size: 1.2rem;
}
.phone-link:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  opacity: 0.95;
}

/* کپی‌رایت ادمین در پایین فرانت منو */
.admin-footer {
  text-align: center;
  padding: 20px 20px;
  font-size: 0.9rem;
  background: var(--card-bg);
  border-top: 1px solid var(--border-color);
  position: relative; /* برگرداندن به حالت نسبی فرانت‌اند */
  width: 100%;
}

.admin-footer,
.admin-footer a {
  color: #fff !important;
  text-decoration: none;
  font-weight: bold;
}

.admin-footer a:hover {
  color: #fff200 !important;
}

/* =========================================
   5. Photo Preview Modal
========================================= */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
}
.modal-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  /* عریض‌تر شدن در دسکتاپ و ابعاد بهینه در موبایل */
  width: auto;
  max-width: 95%;
  background-color: var(--card-bg);
  border-radius: var(--radius);
  padding: 10px;
  box-sizing: border-box;
}
.modal-content img {
  display: block;
  width: auto;
  max-width: 100%;
  /* مهار کردن ارتفاع عکس در دسکتاپ و موبایل */
  height: auto;
  max-height: 80vh;
  /* حفظ نسبت ابعاد تصویر بدون دفرمه شدن */
  object-fit: contain;
  border-radius: calc(var(--radius) - 5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.close-modal-btn {
  position: absolute;
  top: -45px;
  right: 0;
  background: none;
  border: none;
  color: #fff;
  font-size: 2.2rem;
  cursor: pointer;
  transition: transform 0.2s;
}
.close-modal-btn:hover {
  transform: scale(1.1);
}

/* بهینه‌سازی دسکتاپ برای تصاویر عریض یا خیلی بزرگ */
@media (min-width: 769px) {
  .modal-content img {
    max-height: 85vh; /* در دسکتاپ فضای عمودی بیشتری به عکس میدهیم */
  }
}
