/* ==========================================================================
   زاد المسلم • التخصيص والمظهر الموحد لصفحة الخدمات (جميع الشاشات)
   Zad Muslim Services • Personalization, Search & Responsive Directory
   ========================================================================== */

/* Container & Max Width Constraints */
#services-directory {
  position: relative;
  width: 100%;
}

/* 1. Personal Area Container (القسم المخصص) */
.services-personal {
  margin: 14px auto 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-sizing: border-box;
}

.services-personal [hidden],
.service-card-shell[hidden] {
  display: none !important;
}

/* Resume Quran Reading Card (كمّل من مكانك) */
.services-resume-button {
  width: 100%;
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  padding: 14px 20px;
  border-radius: 18px;
  border: 1.5px solid rgba(212, 175, 55, 0.45);
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.16) 0%, rgba(8, 38, 30, 0.95) 100%);
  color: #f4f8f5;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35), 0 0 15px rgba(212, 175, 55, 0.12);
  cursor: pointer;
  text-align: start;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.services-resume-button::before {
  content: "📖";
  font-size: 1.8rem;
  line-height: 1;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(212, 175, 55, 0.18);
  border: 1px solid rgba(212, 175, 55, 0.35);
}

.services-resume-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
  flex: 1 1 auto;
}

.services-resume-button strong {
  font-size: 1.02rem;
  font-weight: 800;
  color: #fff;
  display: block;
  margin: 0;
  line-height: 1.3;
}

.services-resume-button span {
  font-size: 0.85rem;
  color: #dfd3ac;
  display: block;
  margin: 0;
  line-height: 1.35;
}

.services-resume-button::after {
  content: "متابعة ←";
  font-size: 0.86rem;
  font-weight: 700;
  color: #fef08a;
  background: rgba(212, 175, 55, 0.22);
  border: 1px solid rgba(212, 175, 55, 0.45);
  padding: 8px 18px;
  border-radius: 9999px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-inline-start: auto;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.services-resume-button:hover {
  transform: translateY(-2px);
  border-color: rgba(212, 175, 55, 0.75);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), 0 0 22px rgba(212, 175, 55, 0.28);
}

.services-resume-button:hover::after {
  background: #fef08a;
  color: #08261e;
  border-color: #fef08a;
}

/* 2. Personal Favorites & Recent Sections (المفضلة والأخيرة) */
.services-personal h2 {
  font-size: 0.9rem;
  font-weight: 800;
  margin: 0 0 10px;
  color: #dfd3ac;
  display: flex;
  align-items: center;
  gap: 6px;
}

#services-favorites h2::before {
  content: "★";
  color: #f59e0b;
}

#services-recent h2::before {
  content: "🕒";
  font-size: 0.88rem;
}

.services-personal-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.services-personal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Shortcut Pill Buttons */
.services-personal button {
  cursor: pointer;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 9999px;
  background: rgba(16, 44, 37, 0.7);
  border: 1px solid rgba(212, 175, 55, 0.28);
  color: #f1f8f5;
  backdrop-filter: blur(8px);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.services-personal-links button:hover {
  background: rgba(212, 175, 55, 0.2);
  border-color: rgba(212, 175, 55, 0.55);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  color: #fff;
}

/* Hide / Show Buttons */
#services-hide-recent,
#services-show-recent {
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  color: #cbd5e1 !important;
  font-size: 0.78rem !important;
  font-weight: 600 !important;
  padding: 4px 12px !important;
  border-radius: 9999px !important;
  cursor: pointer;
  opacity: 0.9;
  text-decoration: none !important;
  transition: all 0.2s;
}

#services-hide-recent:hover,
#services-show-recent:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.16) !important;
  color: #ffffff !important;
}

/* Tools Bar & Offline Count */
.services-personal-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
}

#services-offline-count {
  font-size: 0.76rem;
  font-weight: 600;
  color: #34d399;
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.3);
  border-radius: 9999px;
  padding: 4px 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

#services-offline-count:empty {
  display: none;
}

#services-offline-count::before {
  content: "💾";
  font-size: 0.74rem;
}

#services-personal-status {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gold-300, #fef08a);
  margin: 4px 0 0;
  text-align: center;
}

#services-personal-status:empty {
  display: none;
}

/* 3. Search Bar Styling (All Screens) */
#services-directory .services-search-wrapper {
  position: relative;
  margin: 10px auto 12px;
  padding: 0 !important; /* Overrides legacy padding: 0 25px in style.css */
  box-sizing: border-box;
}

#services-directory .services-search-input {
  box-sizing: border-box;
  width: 100%;
  min-height: 52px;
  height: 52px;
  font-size: 0.98rem !important;
  padding-block: 0 !important;
  padding-inline: 54px 50px !important;
  border-radius: 9999px;
  background: rgba(8, 34, 27, 0.88);
  border: 1.5px solid rgba(212, 175, 55, 0.35);
  color: #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: border-color 0.2s, box-shadow 0.2s;
}

#services-directory .services-search-input:focus {
  outline: none;
  border-color: rgba(212, 175, 55, 0.8);
  box-shadow: 0 6px 26px rgba(0, 0, 0, 0.45), 0 0 16px rgba(212, 175, 55, 0.3);
}

#services-directory .services-search-input::placeholder {
  color: #7b968c;
  font-weight: 500;
}

/* Guaranteed physical positioning for magnifying glass icon INSIDE the search bar */
#services-directory .services-search-icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  right: 20px !important;
  left: auto !important;
  color: #d4af37 !important;
  font-size: 1.15rem !important;
  pointer-events: none;
  z-index: 3;
}

[dir="ltr"] #services-directory .services-search-icon {
  left: 20px !important;
  right: auto !important;
}

#services-clear-search {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  left: 14px !important;
  right: auto !important;
  width: 30px;
  height: 30px;
  min-height: 30px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  font: inherit;
  font-size: 17px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 3;
  transition: background 0.15s, transform 0.15s;
}

[dir="ltr"] #services-clear-search {
  right: 14px !important;
  left: auto !important;
}

#services-clear-search:hover {
  background: rgba(255, 255, 255, 0.24);
  transform: translateY(-50%) scale(1.08);
  color: #fff;
}

#services-clear-search[hidden] {
  display: none !important;
}

#services-search-results {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gold-400, #d4af37);
  background: rgba(212, 175, 55, 0.1);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 9999px;
  padding: 5px 16px;
  margin: 6px auto 14px;
  width: fit-content;
  max-width: 90%;
  text-align: center;
}

#services-search-results:empty {
  display: none !important;
}

/* 4. Category Filter Pills (كبسولات التصفية) */
#services-directory .category-filter-pills {
  display: flex;
  gap: 10px;
  max-width: 960px;
  margin: 16px auto 28px;
  padding: 4px 6px 12px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  justify-content: center;
  flex-wrap: wrap;
  box-sizing: border-box;
}

#services-directory .category-filter-pills::-webkit-scrollbar {
  display: none;
}

#services-directory .cat-pill-btn {
  border-radius: 9999px;
  padding: 9px 18px;
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
  background: rgba(16, 44, 37, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  backdrop-filter: blur(8px);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}

#services-directory .cat-pill-btn:hover {
  border-color: rgba(212, 175, 55, 0.5);
  color: #fff;
  transform: translateY(-1px);
}

#services-directory .cat-pill-btn.active {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.28), rgba(212, 175, 55, 0.12));
  border-color: rgba(212, 175, 55, 0.7);
  color: #fef08a;
  box-shadow: 0 4px 14px rgba(212, 175, 55, 0.25);
  font-weight: 800;
  transform: translateY(-1px);
}

/* 5. Service Cards Grid & Shell */
.service-card-shell {
  position: relative;
  min-width: 0;
  height: 100%;
}

.service-card-shell .service-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 22px !important;
  box-sizing: border-box;
  background: linear-gradient(145deg, rgba(16, 44, 37, 0.72) 0%, rgba(8, 28, 23, 0.88) 100%);
  border: 1px solid rgba(212, 175, 55, 0.16);
  border-radius: 20px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  text-decoration: none;
  color: inherit;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.service-card-shell .service-card:hover {
  transform: translateY(-3px);
  border-color: rgba(212, 175, 55, 0.45);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45), 0 0 16px rgba(212, 175, 55, 0.18);
}

.service-card-shell .service-card-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding-inline-end: 32px; /* Safe space for floating favorite button */
}

.service-card-shell .service-icon-box {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-radius: 14px;
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid rgba(212, 175, 55, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.service-card-shell .service-info {
  min-width: 0;
  flex: 1 1 auto;
}

.service-card-shell .service-info h3 {
  font-size: 1.02rem;
  font-weight: 800;
  color: #fff;
  margin: 0 0 4px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.service-card-shell .service-info p {
  font-size: 0.82rem;
  color: #94a3b8;
  margin: 0;
  line-height: 1.45;
}

.service-card-shell .service-action-link {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--gold-400, #d4af37);
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.15s, transform 0.15s;
}

.service-card-shell .service-card:hover .service-action-link {
  color: #fef08a;
  transform: translateX(-3px);
}

/* 6. Floating Star Favorite Button */
.service-favorite {
  position: absolute;
  top: 14px;
  left: 14px !important;
  right: auto !important;
  width: 34px;
  height: 34px;
  min-height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(10, 30, 24, 0.65);
  backdrop-filter: blur(8px);
  color: rgba(255, 255, 255, 0.45);
  font-size: 1.50rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 0;
}

[dir="ltr"] .service-favorite {
  right: 14px !important;
  left: auto !important;
}

.service-favorite:hover {
  background: rgba(212, 175, 55, 0.2);
  border-color: rgba(212, 175, 55, 0.5);
  color: #fbbf24;
  transform: scale(1.1);
}

.service-favorite[aria-pressed="true"] {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.28), rgba(212, 175, 55, 0.12));
  border-color: rgba(212, 175, 55, 0.65);
  color: #f59e0b;
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.35);
}

.service-favorite:focus-visible,
.services-personal button:focus-visible,
#services-clear-search:focus-visible {
  outline: 2px solid #bda565;
  outline-offset: 2px;
}

/* 7. Offline Download Badge */
.service-offline-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 3px 10px;
  margin-top: 8px;
  border-radius: 8px;
  background: rgba(52, 211, 153, 0.15);
  border: 1px solid rgba(52, 211, 153, 0.3);
  color: #87efbd;
}

/* 8. Desktop Screen Optimizations (>= 641px) */
@media(min-width: 641px) {
  .services-personal {
    margin: 16px auto 22px;
  }
  #services-favorites,
  #services-recent {
    text-align: center;
  }
  #services-favorites h2,
  .services-personal-heading {
    justify-content: center;
  }
  .services-personal-links {
    justify-content: center;
  }
  .services-personal-tools {
    justify-content: center;
  }
}

/* Desktop Extra: Category pills styling on wide screens */
@media(min-width: 1024px) {
  #services-directory .category-filter-pills {
    max-width: 100%;
    justify-content: center;
    gap: 10px;
  }
}

/* 9. Small Mobile Screens (< 640px) */
@media(max-width: 640px) {
  .services-personal {
    margin: 10px auto 16px;
    padding: 0 4px;
  }
  .services-resume-button {
    padding: 12px 14px;
    gap: 12px;
  }
  .services-resume-button::before {
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
  }
  .services-resume-button::after {
    padding: 6px 12px;
    font-size: 0.8rem;
  }
  #services-directory .category-filter-pills {
    justify-content: center;
  }
  .service-card-shell .service-card {
    padding: 14px 14px !important;
  }
  .service-card-shell .service-icon-box {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    font-size: 1.25rem;
  }
}

/* ==========================================================================
   10. Light Theme Overrides (الوضع الفاتح - تناسق ملكي وتباين مريح)
   ========================================================================== */

/* Resume Card in Light Mode */
html[data-theme="light"] .services-resume-button,
body.light-theme .services-resume-button {
  background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%) !important;
  border: 1.5px solid #10b981 !important;
  color: #0f172a !important;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.12), 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

html[data-theme="light"] .services-resume-button::before,
body.light-theme .services-resume-button::before {
  background: #ecfdf5 !important;
  border: 1px solid #a7f3d0 !important;
}

html[data-theme="light"] .services-resume-button strong,
body.light-theme .services-resume-button strong {
  color: #064e3b !important;
}

html[data-theme="light"] .services-resume-button span,
body.light-theme .services-resume-button span {
  color: #047857 !important;
}

html[data-theme="light"] .services-resume-button::after,
body.light-theme .services-resume-button::after {
  background: #059669 !important;
  color: #ffffff !important;
  border: 1px solid #047857 !important;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3) !important;
  font-weight: 800 !important;
}

html[data-theme="light"] .services-resume-button:hover,
body.light-theme .services-resume-button:hover {
  border-color: #059669 !important;
  box-shadow: 0 8px 26px rgba(16, 185, 129, 0.22) !important;
}

html[data-theme="light"] .services-resume-button:hover::after,
body.light-theme .services-resume-button:hover::after {
  background: #047857 !important;
  color: #ffffff !important;
}

/* Headings & Star in Light Mode */
html[data-theme="light"] .services-personal h2,
body.light-theme .services-personal h2 {
  color: #0f172a !important;
  font-weight: 800 !important;
}

html[data-theme="light"] #services-favorites h2::before,
body.light-theme #services-favorites h2::before {
  color: #d97706 !important;
}

/* Shortcut Pills in Light Mode */
html[data-theme="light"] .services-personal-links button,
body.light-theme .services-personal-links button {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  color: #1e293b !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04) !important;
}

html[data-theme="light"] .services-personal-links button:hover,
body.light-theme .services-personal-links button:hover {
  background: #f0fdf4 !important;
  border-color: #059669 !important;
  color: #064e3b !important;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.15) !important;
  transform: translateY(-1px);
}

/* Hide / Show Recent in Light Mode */
html[data-theme="light"] #services-hide-recent,
body.light-theme #services-hide-recent,
html[data-theme="light"] #services-show-recent,
body.light-theme #services-show-recent {
  background: rgba(5, 150, 105, 0.08) !important;
  border: 1px solid rgba(5, 150, 105, 0.25) !important;
  color: #047857 !important;
  border-radius: 9999px !important;
  font-weight: 700 !important;
  font-size: 0.78rem !important;
  padding: 4px 12px !important;
  text-decoration: none !important;
  opacity: 1 !important;
}

html[data-theme="light"] #services-hide-recent:hover,
body.light-theme #services-hide-recent:hover,
html[data-theme="light"] #services-show-recent:hover,
body.light-theme #services-show-recent:hover {
  background: rgba(5, 150, 105, 0.16) !important;
  border-color: #059669 !important;
  color: #064e3b !important;
}

/* Status & Offline Badge in Light Mode */
html[data-theme="light"] #services-offline-count,
body.light-theme #services-offline-count {
  background: rgba(5, 150, 105, 0.1) !important;
  border: 1px solid rgba(5, 150, 105, 0.3) !important;
  color: #065f46 !important;
  font-weight: 700 !important;
}

html[data-theme="light"] #services-personal-status,
body.light-theme #services-personal-status {
  color: #047857 !important;
  font-weight: 700 !important;
}

/* Search Bar in Light Mode */
html[data-theme="light"] #services-directory .services-search-input,
body.light-theme #services-directory .services-search-input {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  color: #0f172a !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05) !important;
}

html[data-theme="light"] #services-directory .services-search-input:focus,
body.light-theme #services-directory .services-search-input:focus {
  border-color: #059669 !important;
  box-shadow: 0 4px 20px rgba(5, 150, 105, 0.18), 0 0 0 3px rgba(5, 150, 105, 0.12) !important;
}

html[data-theme="light"] #services-directory .services-search-input::placeholder,
body.light-theme #services-directory .services-search-input::placeholder {
  color: #64748b !important;
}

html[data-theme="light"] #services-directory .services-search-icon,
body.light-theme #services-directory .services-search-icon {
  color: #059669 !important;
}

html[data-theme="light"] #services-clear-search,
body.light-theme #services-clear-search {
  background: #f1f5f9 !important;
  color: #64748b !important;
}

html[data-theme="light"] #services-clear-search:hover,
body.light-theme #services-clear-search:hover {
  background: #e2e8f0 !important;
  color: #0f172a !important;
}

/* Category Filter Pills in Light Mode */
html[data-theme="light"] #services-directory .cat-pill-btn,
body.light-theme #services-directory .cat-pill-btn {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  color: #334155 !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04) !important;
}

html[data-theme="light"] #services-directory .cat-pill-btn:hover,
body.light-theme #services-directory .cat-pill-btn:hover {
  background: #f0fdf4 !important;
  border-color: #10b981 !important;
  color: #064e3b !important;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.12) !important;
  transform: translateY(-1px);
}

html[data-theme="light"] #services-directory .cat-pill-btn.active,
body.light-theme #services-directory .cat-pill-btn.active {
  background: #059669 !important;
  border-color: #047857 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.3) !important;
  font-weight: 800 !important;
}

/* Service Cards in Light Mode */
html[data-theme="light"] .service-card-shell .service-card,
body.light-theme .service-card-shell .service-card {
  background: #ffffff !important;
  border: 1.5px solid #e2e8f0 !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04) !important;
  border-radius: 20px !important;
}

html[data-theme="light"] .service-card-shell .service-card:hover,
body.light-theme .service-card-shell .service-card:hover {
  border-color: #10b981 !important;
  box-shadow: 0 10px 28px rgba(16, 185, 129, 0.15), 0 2px 8px rgba(0, 0, 0, 0.04) !important;
  transform: translateY(-3px) !important;
}

html[data-theme="light"] .service-card-shell .service-icon-box,
body.light-theme .service-card-shell .service-icon-box {
  background: #f0fdf4 !important;
  border: 1px solid #d1fae5 !important;
  color: #059669 !important;
}

html[data-theme="light"] .service-card-shell .service-info h3,
body.light-theme .service-card-shell .service-info h3 {
  color: #0f172a !important;
  font-weight: 800 !important;
}

html[data-theme="light"] .service-card-shell .service-info p,
body.light-theme .service-card-shell .service-info p {
  color: #475569 !important;
  font-weight: 500 !important;
}

html[data-theme="light"] .service-card-shell .service-action-link,
body.light-theme .service-card-shell .service-action-link {
  color: #059669 !important;
  font-weight: 700 !important;
}

html[data-theme="light"] .service-card-shell .service-card:hover .service-action-link,
body.light-theme .service-card-shell .service-card:hover .service-action-link {
  color: #047857 !important;
}

/* Star Favorite in Light Mode */
html[data-theme="light"] .service-favorite,
body.light-theme .service-favorite {
  background: #ffffff !important;
  border: 1.5px solid #e2e8f0 !important;
  color: #94a3b8 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06) !important;
}

html[data-theme="light"] .service-favorite:hover,
body.light-theme .service-favorite:hover {
  background: #fefce8 !important;
  border-color: #f59e0b !important;
  color: #d97706 !important;
}

html[data-theme="light"] .service-favorite[aria-pressed="true"],
body.light-theme .service-favorite[aria-pressed="true"] {
  background: #fef3c7 !important;
  border-color: #f59e0b !important;
  color: #d97706 !important;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25) !important;
}

/* Extend hit areas to 44px without enlarging the visible circles. */
.service-favorite::after { content:""; position:absolute; inset:-5px; border-radius:50%; }
#services-clear-search::after { content:""; position:absolute; inset:-7px; border-radius:50%; }

/* One persistent return control replaces the page header inside a service. */
body.single-service-mode header.top { display:none!important; }
body.single-service-mode #serviceFocusHeader {
 position:sticky; top:0; z-index:1001;
 padding-top:calc(8px + env(safe-area-inset-top,0px)); padding-bottom:8px;
}
html.android-device body.single-service-mode #serviceFocusHeader, .android-device body.single-service-mode #serviceFocusHeader { padding-top:8px !important; }
#serviceFocusHeader .service-focus-bar { padding-inline:max(12px,env(safe-area-inset-left,0px)) max(12px,env(safe-area-inset-right,0px)); }
#btnServiceFocusBack { min-height:44px; flex-shrink:0; white-space:nowrap; }
#serviceFocusHeader .service-focus-meta { flex:1; min-width:0; }
#serviceFocusHeader .service-focus-title { overflow-wrap:anywhere; }
@media(max-width:480px) {
 #serviceFocusHeader .service-focus-meta { flex-basis:100%; order:3; }
 #serviceFocusHeader .service-focus-actions { margin-inline-start:auto; }
 #serviceFocusHeader .service-focus-title { margin:0; font-size:.88rem; }
}

/* Category filters */
#services-directory .category-filter-pills {
 --category-surface:#17372d; --category-border:#365347; --category-text:#ecf6f1; --category-active:#a6e3c3; --category-on-active:#123328;
 display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:8px; width:100%; max-width:100%; margin:12px auto 24px; padding:0; overflow:visible; background:none; border:0; border-radius:0; box-shadow:none; backdrop-filter:none;
}
html[data-theme="light"] #services-directory .category-filter-pills,
body.light-theme #services-directory .category-filter-pills {
 --category-surface:#fff; --category-border:#e7e4d6; --category-text:#172c26; --category-active:#075b45; --category-on-active:#fff;
}
#services-directory .category-filter-pills .cat-pill-btn,
#services-directory .category-filter-pills .category-more-btn {
 display:inline-flex; align-items:center; justify-content:center; gap:7px; min-width:0; min-height:46px; padding:9px 6px; border:1px solid var(--category-border); border-radius:14px; background:var(--category-surface); color:var(--category-text); font-size:.88rem; font-weight:700; white-space:normal; overflow-wrap:anywhere; box-shadow:none; transform:none; transition:border-color .15s ease,background-color .15s ease;
}
#services-directory .category-filter-pills .cat-pill-btn:hover,
#services-directory .category-filter-pills .category-more-btn:hover { border-color:var(--category-active); }
#services-directory .category-filter-pills .cat-pill-btn.active { background:var(--category-active); border-color:var(--category-active); color:var(--category-on-active); }
#services-directory .category-filter-pills .category-more-btn[aria-expanded="true"],
#services-directory .category-filter-pills .category-more-btn.has-active-child { border-color:var(--category-active); }
#services-directory .category-filter-pills button:focus-visible { outline:2px solid var(--category-active); outline-offset:3px; }
#services-directory .category-filter-pills i { flex-shrink:0; font-size:1rem; color:inherit; }
#services-directory .category-more-btn[aria-expanded="true"] .more-arrow { transform:rotate(180deg); }
#services-directory .services-extra-categories { grid-column:1/-1; display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:8px; width:100%; margin:0; padding:8px 0 0; background:none; border:0; border-radius:0; animation:none; }
#services-directory .services-extra-categories[hidden] { display:none!important; }
#services-directory.is-filtering .services-personal { display:none; }
html[data-theme="light"] #services-search-results,
body.light-theme #services-search-results { background:#f0fdf4; border-color:#86efac; color:#166534; }
@media(max-width:640px) {
 #services-directory .category-filter-pills { grid-template-columns:repeat(3,minmax(0,1fr)); margin:8px auto 18px; }
 #services-directory .services-extra-categories { grid-template-columns:repeat(3,minmax(0,1fr)); }
}

/* #services-resume: Only show when viewing Quran/Mushaf category, NOT in "all" or other categories */
#services-resume {
  display: none !important;
  margin: 14px 0 20px;
  width: 100%;
}

#services-resume:not([hidden]) {
  /* hidden property respected */
}

#services-directory[data-active-category="القرآن الكريم"] #services-resume:not([hidden]) {
  display: block !important;
  animation: fadeInPills 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Keep result counts with their sections instead of separating the filters. */
#services-directory #services-search-results.services-results-announcement {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
#services-directory .category-title-wrap { flex-wrap: wrap; gap: 8px; }
#services-directory .category-result-count {
  font-size: .85rem;
  font-weight: 500;
  color: #b8cec4;
  white-space: nowrap;
}
#services-directory .category-desc,
#services-directory .service-info p,
#services-directory .services-page-desc { color: #b8cec4 !important; }
html[data-theme="light"] #services-directory .category-result-count,
html[data-theme="light"] #services-directory .category-desc,
html[data-theme="light"] #services-directory .service-info p,
html[data-theme="light"] #services-directory .services-page-desc,
body.light-theme #services-directory .category-result-count,
body.light-theme #services-directory .category-desc,
body.light-theme #services-directory .service-info p,
body.light-theme #services-directory .services-page-desc { color: #475569 !important; }
