/* ============================================================
   مجتمع الطيبات — CSS مخصص
   ما لا يغطيه Tailwind فقط. الهوية من تصميم الكتاب.
   ============================================================ */

html {
  scroll-behavior: smooth;
}

body {
  background: #fbfaf6;
  color: #103f4c;
  font-family: 'IBM Plex Sans Arabic', Tahoma, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* الـ kicker: نص عادي فوق العنوان — بدون كبسولة، بدون إطار، بدون خلفية */
.kicker {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: #176173;
}

/* عناوين العرض بأسلوب الكتاب: IBM Plex بولد بلون الحبر مع تقارب أحرف */
.display-title {
  font-family: 'IBM Plex Sans Arabic', Tahoma, Arial, sans-serif;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.45;
}

/* رابط المنيو النشط — لون ووزن فقط، بدون خلفية أو إطار */
.nav-link {
  color: #567078;
  font-weight: 500;
  transition: color 0.2s ease;
}
.nav-link:hover {
  color: #176173;
}
.nav-link.is-active {
  color: #0f4d5c;
  font-weight: 700;
}

/* القائمة المنسدلة (صفحات) */
.dropdown {
  position: relative;
}
.dropdown-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 50%;
  transform: translateX(50%) translateY(6px);
  min-width: 205px;
  background: #fffefb;
  border-radius: 16px;
  box-shadow: 0 24px 55px -25px rgba(16, 63, 76, 0.35);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  z-index: 50;
}
.dropdown.is-open .dropdown-menu,
.dropdown:hover .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(50%) translateY(0);
}
.dropdown-menu a {
  display: block;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 0.9rem;
  color: #567078;
  transition: background 0.15s ease, color 0.15s ease;
}
.dropdown-menu a:hover {
  background: #f5f8f5;
  color: #0f4d5c;
}
.dropdown-menu a.is-active {
  color: #176173;
  font-weight: 700;
}

/* بطاقة الغذاء — خلفيتها بنفس لون خلفية صور الأصناف (#fefbf5) حتى لا تظهر حدود الصورة */
.food-card {
  background: #fefbf5;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.food-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 26px 55px -30px rgba(16, 63, 76, 0.35);
}

/* بلاطات الميترو في الرئيسية */
.tile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-radius: 20px;
  padding: 26px;
  min-height: 170px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.tile:hover {
  transform: translateY(-4px);
  box-shadow: 0 26px 55px -30px rgba(16, 63, 76, 0.4);
}
.tile .tile-arrow {
  transition: transform 0.2s ease;
}
.tile:hover .tile-arrow {
  transform: translateX(-4px);
}
@media (prefers-reduced-motion: reduce) {
  .tile,
  .tile:hover,
  .tile .tile-arrow,
  .tile:hover .tile-arrow {
    transform: none;
    transition: none;
  }
}

/* زرا الحالة: المسموحات أخضر والممنوعات أحمر */
.filter-pill.pill-allow {
  background: #e7f3ec;
  color: #257050;
}
.filter-pill.pill-allow:hover {
  background: #d8ecdf;
  color: #1c5a3f;
}
.filter-pill.pill-allow.is-active {
  background: #257050;
  color: #fbfaf6;
}
.filter-pill.pill-ban {
  background: #fae9e8;
  color: #9a3c3c;
}
.filter-pill.pill-ban:hover {
  background: #f5dcda;
  color: #7e2f2f;
}
.filter-pill.pill-ban.is-active {
  background: #9a3c3c;
  color: #fbfaf6;
}

/* مربعات تصنيفات الأغذية — أيقونة كبيرة فوق الاسم، بدون إطار */
.cat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-width: 92px;
  padding: 15px 12px;
  border-radius: 16px;
  background: #ddf1f8;
  box-shadow: 0 10px 30px -18px rgba(16, 63, 76, 0.25);
  color: #3f6068;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.cat-box svg {
  width: 27px;
  height: 27px;
}
.cat-box:hover {
  background: #cdeaf5;
  color: #0f4d5c;
  transform: translateY(-2px);
}
.cat-box.is-active {
  background: #176173;
  color: #fbfaf6;
}
@media (prefers-reduced-motion: reduce) {
  .cat-box:hover {
    transform: none;
  }
}

/* أزرار الفلترة — خلفية فقط، بدون إطار */
.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #eef2ef;
  color: #567078;
  border-radius: 9999px;
  padding: 7px 18px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
  white-space: nowrap;
}
.filter-pill:hover {
  background: #e2ebe8;
  color: #0f4d5c;
}
.filter-pill.is-active {
  background: #176173;
  color: #fbfaf6;
  font-weight: 600;
}

/* تابات صفحة الصنف — بأسلوب تابات المتصفح: التاب النشط يتصل بلوحة المحتوى تحته بنفس البوكس */
.tab-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar {
  display: none;
}
.tab-btn {
  flex: 1;
  min-width: max-content;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 22px;
  border-radius: 18px 18px 0 0;
  background: rgba(255, 255, 255, 0.45);
  font-size: 0.875rem;
  font-weight: 600;
  color: #567078;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
  white-space: nowrap;
}
.tab-btn:hover {
  background: rgba(255, 255, 255, 0.7);
  color: #0f4d5c;
}
.tab-btn.is-active {
  background: #ffffff;
  color: #0f4d5c;
  font-weight: 700;
}
.tab-btn svg {
  width: 16px;
  height: 16px;
}
/* لوحة المحتوى المتصلة بالتابات */
.tab-panels {
  background: #ffffff;
  border-radius: 0 0 24px 24px;
  padding: 28px;
  box-shadow: 0 18px 45px -28px rgba(16, 63, 76, 0.25);
}
@media (min-width: 768px) {
  .tab-panels {
    padding: 36px;
  }
}

/* تاقات مسموح / ممنوع — خلفية ناعمة فقط */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 9999px;
  padding: 3px 12px;
  font-size: 0.75rem;
  font-weight: 600;
}
.tag-allow {
  background: #e3efe8;
  color: #257050;
}
.tag-ban {
  background: #fae9e8;
  color: #9a3c3c;
}

/* ظهور ناعم عند التحميل */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.fade-up {
  animation: fadeUp 0.7s ease both;
}
.fade-up-d1 { animation-delay: 0.12s; }
.fade-up-d2 { animation-delay: 0.24s; }
.fade-up-d3 { animation-delay: 0.36s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .fade-up,
  .fade-up-d1,
  .fade-up-d2,
  .fade-up-d3 {
    animation: none;
  }
  .food-card,
  .food-card:hover {
    transform: none;
    transition: none;
  }
}

/* زخرفة دوائر الغلاف (مقتبسة من غلاف الكتاب) */
.orbit {
  position: absolute;
  border-radius: 9999px;
  pointer-events: none;
}

/* حقول النماذج */
.field {
  width: 100%;
  background: #ffffff;
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 0.95rem;
  color: #103f4c;
  box-shadow: inset 0 0 0 1px rgba(16, 63, 76, 0.1);
  transition: box-shadow 0.15s ease;
}
.field::placeholder {
  color: #8aa2a8;
}
.field:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px rgba(23, 97, 115, 0.55);
}

/* حساب العضو في الهيدر */
.member-menu-wrap {
  position: relative;
  display: none;
}
.member-menu-trigger {
  min-height: 42px;
  max-width: 220px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 5px 8px 5px 13px;
  border: 1px solid #d9e6e3;
  border-radius: 9999px;
  background: #ffffff;
  color: #103f4c;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 28px -24px rgba(16, 63, 76, 0.7);
}
.member-menu-trigger:hover,
.member-menu-trigger:focus-visible {
  border-color: #69ddf8;
  outline: none;
}
.member-avatar {
  width: 31px;
  height: 31px;
  flex: 0 0 31px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: #dff7fc;
  color: #0f4d5c;
  font-size: 0.8rem;
  font-weight: 700;
}
.member-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.member-menu-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.member-menu-chevron {
  display: block;
  font-size: 1.15rem;
  line-height: 1;
  transition: transform 0.18s ease;
}
.member-menu-wrap.is-open .member-menu-chevron {
  transform: rotate(180deg);
}
.member-menu-panel {
  position: absolute;
  z-index: 80;
  top: calc(100% + 10px);
  left: 0;
  width: 180px;
  display: none;
  overflow: hidden;
  padding: 6px;
  border: 1px solid #d9e6e3;
  border-radius: 15px;
  background: #ffffff;
  box-shadow: 0 18px 48px -24px rgba(16, 63, 76, 0.55);
}
.member-menu-wrap.is-open .member-menu-panel {
  display: grid;
}
.member-menu-panel a,
.member-menu-panel button,
.member-mobile-logout {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #103f4c;
  font: inherit;
  font-weight: 600;
  text-align: right;
  cursor: pointer;
}
.member-menu-panel a:hover,
.member-menu-panel button:hover,
.member-menu-panel a:focus-visible,
.member-menu-panel button:focus-visible,
.member-mobile-logout:hover,
.member-mobile-logout:focus-visible {
  background: #eef8f8;
  outline: none;
}
.member-mobile-logout {
  padding-right: 0;
  color: #176173;
}
@media (min-width: 640px) {
  .member-menu-wrap {
    display: block;
  }
}

/* صفحة الأغذية */
.foods-filter-head {
  display: grid;
  grid-template-columns: auto minmax(320px, 1fr);
  align-items: center;
  gap: 18px;
}
.foods-search-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.foods-search {
  position: relative;
  width: min(100%, 420px);
}
.foods-search .field {
  min-height: 46px;
  padding: 10px 43px 10px 16px;
  border-radius: 9999px;
}
.foods-search svg {
  position: absolute;
  top: 50%;
  right: 16px;
  width: 19px;
  height: 19px;
  color: #567078;
  transform: translateY(-50%);
  pointer-events: none;
}
.food-add-button,
.foods-clear-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 9px 17px;
  border: 0;
  border-radius: 9999px;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}
.food-add-button {
  background: #176173;
  color: #ffffff;
}
.food-add-button:hover,
.food-add-button:focus-visible {
  background: #0f4d5c;
  outline: 3px solid rgba(105, 221, 248, 0.25);
}
.foods-clear-button {
  background: #edf4f2;
  color: #3f6068;
}
.foods-category-filter {
  display: flex;
  gap: 9px;
  margin-top: 20px;
  padding-top: 20px;
  overflow-x: auto;
  border-top: 1px solid rgba(217, 230, 227, 0.7);
  scrollbar-width: thin;
}
.foods-category-filter .cat-box {
  flex: 0 0 auto;
  min-width: 84px;
  padding: 12px 10px;
}
.foods-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 15px;
}
.food-card[data-food] {
  min-width: 0;
  min-height: 126px;
  display: grid !important;
  grid-template-columns: 92px minmax(0, 1fr);
  grid-template-rows: auto auto 1fr;
  align-items: center;
  column-gap: 15px;
  padding: 16px !important;
  text-align: right !important;
}
.food-card[data-food] > img {
  width: 92px !important;
  height: 92px !important;
  grid-column: 1;
  grid-row: 1 / -1;
  margin: 0 !important;
  border-radius: 15px;
  object-fit: contain;
  background: #fefbf5;
}
.food-card[data-food] > h3,
.food-card[data-food] > div,
.food-card[data-food] > p {
  grid-column: 2;
  min-width: 0;
  margin-right: 0;
  margin-left: 0;
}
.food-card[data-food] > h3 {
  margin-top: 0 !important;
  font-size: 1rem;
}
.food-card[data-food] > div {
  margin-top: 8px !important;
}
.food-card[data-food] > p {
  margin-top: 5px !important;
  line-height: 1.45;
}
.food-card[data-status="allow"] {
  box-shadow: inset -3px 0 0 #257050, 0 18px 45px -36px rgba(16, 63, 76, 0.5);
}
.food-card[data-status="ban"] {
  box-shadow: inset -3px 0 0 #9a3c3c, 0 18px 45px -36px rgba(16, 63, 76, 0.5);
}
.food-card[data-food] .tag {
  padding: 4px 10px;
  font-size: 0.72rem;
}
.food-card[data-food] .tag-allow {
  background: #e3efe8;
  color: #257050;
}
.food-card[data-food] .tag-ban {
  background: #fae9e8;
  color: #9a3c3c;
}

/* نافذة مساهمة غذائية */
.food-contribution-layer {
  position: fixed;
  z-index: 100;
  inset: 0;
}
.food-contribution-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  border: 0;
  background: rgba(15, 77, 92, 0.24);
  cursor: pointer;
}
.food-contribution-panel {
  position: absolute;
  top: 0;
  left: 0;
  width: min(520px, 100%);
  height: 100%;
  overflow-y: auto;
  padding: 30px;
  background: #fbfaf6;
  box-shadow: 22px 0 60px -35px rgba(16, 63, 76, 0.55);
}
.food-contribution-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}
.food-contribution-heading h2 {
  margin-top: 5px;
  font-size: 2rem;
  font-weight: 700;
}
.food-contribution-close {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  border: 0;
  border-radius: 50%;
  background: #e8f2f1;
  color: #103f4c;
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
}
.food-contribution-intro {
  margin-top: 14px;
  color: #567078;
  line-height: 1.8;
}
.food-contribution-form {
  display: grid;
  gap: 17px;
  margin-top: 24px;
}
.food-contribution-form label {
  display: grid;
  gap: 7px;
  color: #103f4c;
  font-size: 0.9rem;
  font-weight: 600;
}
.food-contribution-form input,
.food-contribution-form select,
.food-contribution-form textarea {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  border: 1px solid #d9e6e3;
  border-radius: 12px;
  outline: 0;
  background: #ffffff;
  color: #103f4c;
  font: inherit;
}
.food-contribution-form textarea {
  min-height: 122px;
  resize: vertical;
  line-height: 1.7;
}
.food-contribution-form input:focus,
.food-contribution-form select:focus,
.food-contribution-form textarea:focus {
  border-color: #69ddf8;
  box-shadow: 0 0 0 4px rgba(105, 221, 248, 0.15);
}
.food-contribution-form small {
  color: #71878d;
  font-size: 0.72rem;
  font-weight: 400;
}
.food-contribution-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px;
}
.food-contribution-preview {
  width: 130px;
  height: 130px;
  object-fit: contain;
  border-radius: 15px;
  background: #fefbf5;
}
.food-contribution-submit {
  min-height: 48px;
  border: 0;
  border-radius: 9999px;
  background: #176173;
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.food-contribution-submit:disabled {
  cursor: wait;
  opacity: 0.65;
}
.food-contribution-message {
  min-height: 22px;
  margin: 0;
  color: #257050;
  font-size: 0.86rem;
}
.food-contribution-message.error {
  color: #9a3c3c;
}
body.food-dialog-open {
  overflow: hidden;
}
@media (max-width: 920px) {
  .foods-filter-head {
    grid-template-columns: 1fr;
  }
  .foods-search-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .foods-search {
    width: 100%;
  }
  .foods-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 620px) {
  .foods-grid {
    grid-template-columns: 1fr;
  }
  .food-card[data-food] {
    grid-template-columns: 80px minmax(0, 1fr);
    min-height: 112px;
  }
  .food-card[data-food] > img {
    width: 80px !important;
    height: 80px !important;
  }
  .foods-search-actions {
    display: grid;
    grid-template-columns: 1fr auto;
  }
  .foods-search {
    grid-column: 1 / -1;
  }
  .foods-clear-button,
  .food-add-button {
    width: 100%;
  }
  .food-contribution-panel {
    padding: 24px 18px;
  }
  .food-contribution-fields {
    grid-template-columns: 1fr;
  }
}
