/* ===== Tayebat Bundle 2 - Combined CSS - v1 ===== */

/* === nav-dropdown.css === */
/* =====================================================
   نظام الطيبات - Navigation Dropdown
   قائمة منسدلة تحت "الدكتور" تحتوي:
   - سيرة الدكتور
   - النظريات
   - تجارب الزوار
   ===================================================== */

/* 🚨 إصلاح حرج: header-main في app-bundle عنده overflow:hidden
   هذا يقص الـ dropdown. نتجاوزه فقط على الـ desktop (الـ drawer mobile مختلف) */
@media (min-width: 1025px) {
  .site-header,
  .site-header .header-main,
  .site-header .header-top {
    overflow: visible !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
  }
}

/* Dropdown container */
.nav-dropdown {
  position: relative;
  display: inline-block;
  z-index: 1002;
}

/* Dropdown trigger (الرابط الأساسي "الدكتور") */
.nav-link--has-dropdown {
  cursor: pointer;
  display: inline-flex !important;
  align-items: center;
  gap: 4px;
  position: relative;
  z-index: 1003;
}

.nav-dropdown-arrow {
  font-size: 0.75em;
  transition: transform 0.2s ease;
  display: inline-block;
  margin-right: 2px;
}

.nav-dropdown:hover .nav-dropdown-arrow,
.nav-dropdown:focus-within .nav-dropdown-arrow {
  transform: rotate(180deg);
}

/* Dropdown menu */
.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 200px;
  background: #faf8f2;
  border: 1px solid rgba(201, 168, 76, 0.3);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  padding: 8px;
  margin-top: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  z-index: 99999; /* أعلى من أي عنصر آخر مثل hero */
  pointer-events: none;
}

/* تأكد إن header كاملاً فوق المحتوى */
.site-header {
  position: relative;
  z-index: 1000;
}

.main-nav {
  position: relative;
  z-index: 1001;
}

/* جسر شفاف يمنع الـ dropdown من الإغلاق عند الانتقال للقائمة */
.nav-dropdown::after {
  content: '';
  position: absolute;
  top: 100%;
  right: 0;
  width: 100%;
  height: 12px;
  z-index: 999;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

/* Dropdown items */
.nav-dropdown-item {
  display: block;
  padding: 10px 14px;
  color: #1a3d2b !important;
  text-decoration: none !important;
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: 8px;
  transition: background 0.2s, color 0.2s, padding-right 0.2s;
  font-family: 'Tajawal', sans-serif;
  white-space: nowrap;
}

.nav-dropdown-item:hover {
  background: linear-gradient(135deg,
    rgba(201, 168, 76, 0.15) 0%,
    rgba(201, 168, 76, 0.05) 100%);
  padding-right: 20px;
  color: #c9a84c !important;
}

.nav-dropdown-item:not(:last-child) {
  margin-bottom: 2px;
}

/* ===== Mobile responsive ===== */
@media (max-width: 968px) {
  /* في الموبايل، الـ dropdown يصير ظاهر مباشرة كقائمة عادية */
  .nav-dropdown {
    display: block;
    width: 100%;
  }

  .nav-dropdown-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    background: rgba(201, 168, 76, 0.05);
    border: none;
    margin-top: 4px;
    padding: 4px 12px;
  }

  .nav-dropdown-arrow {
    display: none;
  }

  .nav-dropdown-item {
    padding: 8px 14px;
    font-size: 0.88rem;
  }

  .nav-dropdown-item:hover {
    padding-right: 14px;
  }
}

/* ===== Dark theme ===== */
:root[data-theme="dark"] .nav-dropdown-menu,
[data-theme="dark"] .nav-dropdown-menu,
body.dark .nav-dropdown-menu {
  background: #1a1a1a;
  border-color: rgba(201, 168, 76, 0.4);
}

:root[data-theme="dark"] .nav-dropdown-item,
[data-theme="dark"] .nav-dropdown-item,
body.dark .nav-dropdown-item {
  color: #e8c96a !important;
}

:root[data-theme="dark"] .nav-dropdown-item:hover,
[data-theme="dark"] .nav-dropdown-item:hover,
body.dark .nav-dropdown-item:hover {
  background: rgba(201, 168, 76, 0.15);
  color: #f5d97a !important;
}

/* ===== Awadi theme ===== */
:root[data-theme="awadi"] .nav-dropdown-menu,
[data-theme="awadi"] .nav-dropdown-menu,
body.awadi .nav-dropdown-menu {
  background: #faf8f2;
  border-color: rgba(201, 168, 76, 0.4);
}

/* ===== Print: hide dropdown arrow ===== */
@media print {
  .nav-dropdown-arrow {
    display: none;
  }
  .nav-dropdown-menu {
    display: none;
  }
}

/* === affiliate.css === */
/* =====================================================
   نظام الطيبات - Affiliate Buy Button
   ===================================================== */

.ta-affiliate-block {
  margin-top: 20px;
  margin-bottom: 16px;
  padding: 18px;
  background: linear-gradient(135deg,
    rgba(34, 158, 217, 0.06) 0%,
    rgba(42, 171, 238, 0.04) 100%);
  border: 1.5px solid rgba(34, 158, 217, 0.25);
  border-radius: 14px;
  font-family: inherit;
}

.ta-affiliate-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-mid, #555);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ta-affiliate-note {
  font-size: 0.88rem;
  color: var(--text-mid, #666);
  margin-bottom: 14px;
  line-height: 1.6;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.5);
  border-right: 3px solid rgba(34, 158, 217, 0.4);
  border-radius: 6px;
}

.ta-affiliate-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  padding: 14px 20px;
  background: #229ED9;
  color: #ffffff !important;
  text-decoration: none !important;
  font-weight: 700;
  font-size: 1rem;
  border-radius: 10px;
  box-shadow: 0 3px 12px rgba(34, 158, 217, 0.25);
  transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
  position: relative;
  overflow: hidden;
}

.ta-affiliate-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent);
  transition: left 0.5s;
}

.ta-affiliate-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(34, 158, 217, 0.4);
  filter: brightness(1.05);
  color: #ffffff !important;
}

.ta-affiliate-btn:hover::before {
  left: 100%;
}

.ta-affiliate-btn:active {
  transform: translateY(0);
}

.ta-affiliate-disclosure {
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(255, 248, 230, 0.5);
  border: 1px solid rgba(240, 217, 122, 0.3);
  border-radius: 6px;
  font-size: 0.78rem;
  line-height: 1.6;
  color: var(--text-light, #888);
}

.ta-affiliate-disclosure a {
  color: inherit;
  text-decoration: underline;
}

/* Mobile responsive */
@media (max-width: 600px) {
  .ta-affiliate-block {
    padding: 14px;
    margin-top: 16px;
  }
  .ta-affiliate-btn {
    padding: 12px 16px;
    font-size: 0.95rem;
  }
  .ta-affiliate-disclosure {
    font-size: 0.72rem;
  }
}

/* Dark theme */
:root[data-theme="dark"] .ta-affiliate-block,
[data-theme="dark"] .ta-affiliate-block,
body.dark .ta-affiliate-block {
  background: linear-gradient(135deg,
    rgba(34, 158, 217, 0.15) 0%,
    rgba(42, 171, 238, 0.08) 100%);
  border-color: rgba(34, 158, 217, 0.4);
}

:root[data-theme="dark"] .ta-affiliate-note,
[data-theme="dark"] .ta-affiliate-note,
body.dark .ta-affiliate-note {
  background: rgba(0, 0, 0, 0.2);
  color: #ddd;
}

:root[data-theme="dark"] .ta-affiliate-disclosure,
[data-theme="dark"] .ta-affiliate-disclosure,
body.dark .ta-affiliate-disclosure {
  background: rgba(0, 0, 0, 0.2);
  border-color: rgba(240, 217, 122, 0.2);
  color: #bbb;
}

/* Print: hide affiliate */
@media print {
  .ta-affiliate-block {
    display: none !important;
  }
}

/* === telegram-banner.css === */
/* =====================================================
   نظام الطيبات - Telegram Banner Styles
   متوافق مع: light, dark, awadi themes
   ===================================================== */

/* ===== Banner العلوي ===== */
.ta-tg-banner {
  /* عنصر عادي في flow الصفحة (ليس fixed) — يدفع المحتوى للأسفل بشكل طبيعي */
  position: relative;
  width: 100%;
  z-index: 9998;
  background: linear-gradient(135deg, #229ED9 0%, #2AABEE 50%, #1c8bc7 100%);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  font-family: inherit;
  animation: ta-tg-slide-down 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  direction: rtl;
}

@keyframes ta-tg-slide-down {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.ta-tg-banner--hiding {
  animation: ta-tg-slide-up 0.25s cubic-bezier(0.7, 0, 0.84, 0) forwards;
}

@keyframes ta-tg-slide-up {
  to {
    transform: translateY(-100%);
    opacity: 0;
  }
}

.ta-tg-banner__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
}

.ta-tg-banner__icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 50%;
}

.ta-tg-banner__text {
  flex: 1 1 auto;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.4;
  min-width: 0;
}

.ta-tg-banner__cta {
  flex-shrink: 0;
  display: inline-block;
  padding: 7px 18px;
  background: #ffffff;
  color: #1c8bc7 !important;
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: 999px;
  text-decoration: none !important;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
  white-space: nowrap;
}

.ta-tg-banner__cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  background: #f0f9ff;
}

.ta-tg-banner__cta:active {
  transform: translateY(0);
}

.ta-tg-banner__close {
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #ffffff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  font-weight: bold;
}

.ta-tg-banner__close:hover {
  background: rgba(255, 255, 255, 0.3);
}

/*
  ===== Body Spacing =====
  مع banner كـ position: relative (عنصر عادي):
  - الـ banner يأخذ مساحته الطبيعية في أعلى الصفحة
  - يدفع باقي المحتوى (header إلخ) للأسفل تلقائياً
  - لا حاجة لـ padding-top على body
  - الـ header sticky يلتصق فوق عند الـ scroll بشكل طبيعي

  ✅ صفر مشاكل في spacing
  ✅ صفر مساحات بيضاء
  ✅ الـ scroll يعمل بشكل مثالي
*/

/* ===== Mobile responsive ===== */
@media (max-width: 600px) {
  .ta-tg-banner__inner {
    padding: 9px 10px;
    gap: 8px;
  }

  .ta-tg-banner__icon {
    width: 28px;
    height: 28px;
  }

  .ta-tg-banner__icon svg {
    width: 18px;
    height: 18px;
  }

  .ta-tg-banner__text {
    font-size: 0.82rem;
    line-height: 1.3;
  }

  .ta-tg-banner__cta {
    padding: 6px 12px;
    font-size: 0.82rem;
  }

  .ta-tg-banner__close {
    width: 26px;
    height: 26px;
    font-size: 0.85rem;
  }

  body.ta-has-tg-banner {
    /* لا حاجة لـ padding في الموبايل أيضاً */
  }
}

@media (max-width: 380px) {
  .ta-tg-banner__inner {
    gap: 6px;
  }

  .ta-tg-banner__text {
    font-size: 0.78rem;
  }

  .ta-tg-banner__cta {
    padding: 5px 10px;
    font-size: 0.78rem;
  }
}

/* ===== Drawer Telegram Section ===== */
.ta-drawer-tg {
  margin: 0 0 16px 0;
  padding: 14px;
  background: linear-gradient(135deg,
    rgba(34, 158, 217, 0.08) 0%,
    rgba(42, 171, 238, 0.05) 100%);
  border: 1px solid rgba(34, 158, 217, 0.2);
  border-radius: 12px;
}

.ta-drawer-tg__title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ta-color-text, #333);
  margin-bottom: 10px;
  text-align: center;
  opacity: 0.85;
}

.ta-drawer-tg__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--ta-color-bg, #ffffff);
  border: 1px solid rgba(34, 158, 217, 0.25);
  border-radius: 8px;
  color: #1c8bc7;
  text-decoration: none !important;
  font-size: 0.92rem;
  font-weight: 600;
  transition: all 0.2s;
  margin-bottom: 8px;
}

.ta-drawer-tg__link:last-child {
  margin-bottom: 0;
}

.ta-drawer-tg__link:hover {
  background: rgba(34, 158, 217, 0.08);
  border-color: rgba(34, 158, 217, 0.5);
  transform: translateX(-2px);
}

.ta-drawer-tg__icon {
  font-size: 1.15rem;
  flex-shrink: 0;
}

.ta-drawer-tg__label {
  flex: 1;
}

/* ===== Dark theme support ===== */
:root[data-theme="dark"] .ta-drawer-tg,
[data-theme="dark"] .ta-drawer-tg,
body.dark .ta-drawer-tg {
  background: linear-gradient(135deg,
    rgba(34, 158, 217, 0.15) 0%,
    rgba(42, 171, 238, 0.1) 100%);
  border-color: rgba(34, 158, 217, 0.35);
}

:root[data-theme="dark"] .ta-drawer-tg__link,
[data-theme="dark"] .ta-drawer-tg__link,
body.dark .ta-drawer-tg__link {
  background: rgba(255, 255, 255, 0.05);
  color: #5dc5ee;
  border-color: rgba(34, 158, 217, 0.4);
}

:root[data-theme="dark"] .ta-drawer-tg__title,
[data-theme="dark"] .ta-drawer-tg__title,
body.dark .ta-drawer-tg__title {
  color: #e0e0e0;
}

/* ===== Awadi theme (أخضر داكن) ===== */
:root[data-theme="awadi"] .ta-drawer-tg,
[data-theme="awadi"] .ta-drawer-tg,
body.awadi .ta-drawer-tg {
  background: linear-gradient(135deg,
    rgba(34, 158, 217, 0.12) 0%,
    rgba(42, 171, 238, 0.08) 100%);
  border-color: rgba(34, 158, 217, 0.3);
}

/* ===== Footer Telegram Highlight ===== */
.ta-footer-tg-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 20px;
  margin: 16px auto;
  max-width: 480px;
  background: linear-gradient(135deg, #229ED9 0%, #2AABEE 100%);
  color: #ffffff !important;
  text-decoration: none !important;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: 0 3px 10px rgba(34, 158, 217, 0.25);
  transition: transform 0.2s, box-shadow 0.2s;
}

.ta-footer-tg-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(34, 158, 217, 0.4);
  color: #ffffff !important;
}

.ta-footer-tg-cta__icon {
  font-size: 1.3rem;
}

@media (max-width: 600px) {
  .ta-footer-tg-cta {
    margin: 12px 16px;
    padding: 12px 16px;
    font-size: 0.88rem;
  }
}

/* ===== Print: hide all Telegram elements ===== */
@media print {
  .ta-tg-banner,
  .ta-drawer-tg,
  .ta-footer-tg-cta {
    display: none !important;
  }
  body.ta-has-tg-banner {
    padding-top: 0 !important;
  }
}

/* === ux-enhancements.css === */
/* ====================================================================
   UX Enhancements - تحسينات تجربة المستخدم
   نظام الطيبات | الدكتور ضياء العوضي
   ==================================================================== */

/* ===== 1. Smooth Scrolling ===== */
html {
  scroll-behavior: smooth;
  /* احترام تفضيلات المستخدم */
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== 2. Focus Visible (للـ Accessibility) ===== */
:focus {
  outline: none;
}

:focus-visible {
  outline: 3px solid #c9a84c;
  outline-offset: 3px;
  border-radius: 4px;
}

/* أزرار الـ navigation */
.nav-link:focus-visible,
.btn:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 3px solid #c9a84c;
  outline-offset: 3px;
  box-shadow: 0 0 0 6px rgba(201, 168, 76, 0.2);
}

/* ===== 3. Touch Targets للموبايل (Apple/Google guidelines: 44x44px min) ===== */
@media (max-width: 768px) {
  button,
  .btn,
  a.btn,
  input[type="button"],
  input[type="submit"],
  .nav-link,
  .nav-dropdown-item,
  .ta-drawer a,
  .icon-button {
    min-height: 44px;
    min-width: 44px;
    padding: 12px 16px;
  }
  
  /* Touch feedback */
  button:active,
  .btn:active,
  a:active {
    transform: scale(0.97);
    transition: transform 0.1s;
  }
}

/* ===== 4. Toast Notifications (بديل alert/confirm) ===== */
.ta-toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  width: 100%;
  max-width: 400px;
  padding: 0 20px;
}

.ta-toast {
  background: white;
  border-radius: 12px;
  padding: 14px 18px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  border-right: 4px solid #c9a84c;
  font-family: 'Tajawal', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  color: #1a3d2b;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: ta-toast-slide-in 0.3s ease-out;
  min-height: 50px;
  line-height: 1.5;
}

.ta-toast--success {
  border-right-color: #2d8659;
  background: linear-gradient(to left, rgba(45, 134, 89, 0.05), white 30%);
}

.ta-toast--error {
  border-right-color: #d64545;
  background: linear-gradient(to left, rgba(214, 69, 69, 0.05), white 30%);
}

.ta-toast--warning {
  border-right-color: #f59e0b;
  background: linear-gradient(to left, rgba(245, 158, 11, 0.05), white 30%);
}

.ta-toast--info {
  border-right-color: #3b82f6;
  background: linear-gradient(to left, rgba(59, 130, 246, 0.05), white 30%);
}

.ta-toast__icon {
  font-size: 1.4rem;
  flex-shrink: 0;
}

.ta-toast__message {
  flex: 1;
}

.ta-toast__close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.3rem;
  color: #888;
  padding: 4px 8px;
  margin: -4px;
  line-height: 1;
  flex-shrink: 0;
  border-radius: 4px;
  transition: all 0.2s;
  min-height: auto !important;
  min-width: auto !important;
}

.ta-toast__close:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #333;
}

.ta-toast--leaving {
  animation: ta-toast-slide-out 0.3s ease-in forwards;
}

@keyframes ta-toast-slide-in {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes ta-toast-slide-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-20px);
  }
}

/* Dark mode للـ toast */
[data-theme="dark"] .ta-toast,
[data-theme="awadi"] .ta-toast {
  background: #1a3d2b;
  color: #f5f5dc;
}

[data-theme="dark"] .ta-toast__close,
[data-theme="awadi"] .ta-toast__close {
  color: #ccc;
}

/* ===== 5. Confirm Dialog (بديل confirm) ===== */
.ta-confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 99998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: ta-fade-in 0.2s ease-out;
}

.ta-confirm-dialog {
  background: white;
  border-radius: 16px;
  padding: 28px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  font-family: 'Tajawal', sans-serif;
  text-align: center;
  animation: ta-zoom-in 0.25s ease-out;
}

.ta-confirm-dialog__icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.ta-confirm-dialog__title {
  font-size: 1.3rem;
  font-weight: 700;
  color: #1a3d2b;
  margin: 0 0 12px 0;
}

.ta-confirm-dialog__message {
  font-size: 1rem;
  color: #555;
  margin: 0 0 24px 0;
  line-height: 1.6;
}

.ta-confirm-dialog__actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.ta-confirm-dialog__btn {
  padding: 10px 24px;
  border-radius: 10px;
  font-family: 'Tajawal', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  min-width: 100px;
}

.ta-confirm-dialog__btn--confirm {
  background: #c9a84c;
  color: white;
}

.ta-confirm-dialog__btn--confirm:hover {
  background: #b08a32;
  transform: translateY(-1px);
}

.ta-confirm-dialog__btn--cancel {
  background: #f0f0f0;
  color: #333;
}

.ta-confirm-dialog__btn--cancel:hover {
  background: #e0e0e0;
}

@keyframes ta-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes ta-zoom-in {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Dark mode للـ confirm */
[data-theme="dark"] .ta-confirm-dialog,
[data-theme="awadi"] .ta-confirm-dialog {
  background: #2d5f4f;
  color: #f5f5dc;
}

[data-theme="dark"] .ta-confirm-dialog__title,
[data-theme="awadi"] .ta-confirm-dialog__title {
  color: #e8c96a;
}

[data-theme="dark"] .ta-confirm-dialog__message,
[data-theme="awadi"] .ta-confirm-dialog__message {
  color: #ccc;
}

[data-theme="dark"] .ta-confirm-dialog__btn--cancel,
[data-theme="awadi"] .ta-confirm-dialog__btn--cancel {
  background: #1a3d2b;
  color: #f5f5dc;
}

/* ===== 6. Image Loading Animation ===== */
img {
  /* تجنب layout shift */
  height: auto;
}

img[loading="lazy"] {
  background: linear-gradient(90deg, #f5f5f5 25%, #e8e8e8 50%, #f5f5f5 75%);
  background-size: 200% 100%;
  animation: ta-skeleton 1.5s infinite;
}

img[loading="lazy"][src] {
  animation: none;
  background: none;
}

@keyframes ta-skeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== 7. Skip Link Improved ===== */
.skip-link {
  position: absolute;
  top: -100px;
  right: 0;
  background: #1a3d2b;
  color: white;
  padding: 12px 20px;
  text-decoration: none;
  font-weight: 600;
  border-radius: 0 0 0 8px;
  z-index: 999999;
  transition: top 0.2s;
  font-family: 'Tajawal', sans-serif;
}

.skip-link:focus {
  top: 0;
}

/* ===== 8. Selection Color (تحسين بسيط) ===== */
::selection {
  background-color: rgba(201, 168, 76, 0.3);
  color: #1a3d2b;
}

[data-theme="dark"] ::selection,
[data-theme="awadi"] ::selection {
  background-color: rgba(201, 168, 76, 0.4);
  color: #f5f5dc;
}

/* ===== 9. Scrollbar Styling ===== */
@media (min-width: 769px) {
  ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
  }
  
  ::-webkit-scrollbar-track {
    background: #f5f5f0;
  }
  
  ::-webkit-scrollbar-thumb {
    background: #c9a84c;
    border-radius: 5px;
  }
  
  ::-webkit-scrollbar-thumb:hover {
    background: #b08a32;
  }
  
  /* Firefox */
  * {
    scrollbar-width: thin;
    scrollbar-color: #c9a84c #f5f5f0;
  }
  
  [data-theme="dark"] ::-webkit-scrollbar-track,
  [data-theme="awadi"] ::-webkit-scrollbar-track {
    background: #1a3d2b;
  }
}

/* ===== 10. Loading State Buttons ===== */
button[disabled],
button.is-loading {
  opacity: 0.7;
  cursor: not-allowed;
  position: relative;
}

button.is-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 12px;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: ta-spin 0.8s linear infinite;
}

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

/* ===== 11. Better Form Inputs Focus ===== */
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid #c9a84c;
  outline-offset: 2px;
  border-color: #c9a84c;
}

/* ===== 12. Print Styles (تحسين الطباعة) ===== */
@media print {
  .site-header,
  .site-footer,
  .telegram-banner,
  .pwa-install-button,
  .ta-toast-container,
  .nav-dropdown,
  button,
  .splash-screen {
    display: none !important;
  }
  
  body {
    background: white !important;
    color: black !important;
  }
  
  a {
    color: black !important;
    text-decoration: underline;
  }
  
  a[href]:after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    color: #666;
  }
}

/* === loading-states.css === */
/* ====================================================================
   Loading States - Skeleton Screens & Smooth Transitions
   نظام الطيبات | Loading UX احترافي
   ==================================================================== */

/* ===== 1. Skeleton Card Container ===== */
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  padding: 8px 0;
  animation: skeleton-fade-in 0.3s ease-out;
}

@keyframes skeleton-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ===== 2. Skeleton Card (Product) ===== */
.skeleton-card {
  background: white;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.05);
  min-height: 200px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

[data-theme="dark"] .skeleton-card,
[data-theme="awadi"] .skeleton-card {
  background: rgba(26, 61, 43, 0.5);
  border-color: rgba(201, 168, 76, 0.1);
}

/* ===== 3. Skeleton Elements (image + text lines) ===== */
.skeleton-image {
  width: 100%;
  height: 100px;
  border-radius: 12px;
  background: linear-gradient(
    90deg,
    #f0f0f0 0%,
    #e8e8e8 20%,
    #f0f0f0 40%,
    #f0f0f0 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.skeleton-line {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    #f0f0f0 0%,
    #e8e8e8 20%,
    #f0f0f0 40%,
    #f0f0f0 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.skeleton-line.short { width: 60%; }
.skeleton-line.medium { width: 80%; }
.skeleton-line.long { width: 100%; }

[data-theme="dark"] .skeleton-image,
[data-theme="dark"] .skeleton-line,
[data-theme="awadi"] .skeleton-image,
[data-theme="awadi"] .skeleton-line {
  background: linear-gradient(
    90deg,
    rgba(201, 168, 76, 0.05) 0%,
    rgba(201, 168, 76, 0.15) 20%,
    rgba(201, 168, 76, 0.05) 40%,
    rgba(201, 168, 76, 0.05) 100%
  );
  background-size: 200% 100%;
}

/* ===== 4. Shimmer Animation ===== */
@keyframes skeleton-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ===== 5. Skeleton for Recipes (different shape) ===== */
.skeleton-recipe {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  min-height: 320px;
  display: flex;
  flex-direction: column;
}

.skeleton-recipe .skeleton-image {
  height: 180px;
  border-radius: 0;
}

.skeleton-recipe-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

[data-theme="dark"] .skeleton-recipe,
[data-theme="awadi"] .skeleton-recipe {
  background: rgba(26, 61, 43, 0.5);
}

/* ===== 6. Skeleton for Testimonials ===== */
.skeleton-testimonial {
  background: white;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  min-height: 180px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

[data-theme="dark"] .skeleton-testimonial,
[data-theme="awadi"] .skeleton-testimonial {
  background: rgba(26, 61, 43, 0.5);
}

/* ===== 7. Smart Counter (Hidden initially) ===== */
.section-count {
  opacity: 1;
  transition: opacity 0.4s ease;
}

.section-count.is-loading {
  opacity: 0.3;
}

.section-count.is-counting {
  color: #c9a84c;
  font-weight: 700;
  transition: color 0.3s ease;
}

/* ===== 8. Smooth Transition: Hide Skeleton, Show Content ===== */
.skeleton-grid.is-hiding {
  animation: skeleton-fade-out 0.3s ease-out forwards;
}

@keyframes skeleton-fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* ===== 9. Content Fade-in Animation ===== */
.products-grid,
.recipes-grid,
.testimonials-grid {
  animation: content-fade-in 0.5s ease-out;
}

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

/* ===== 10. Loading Indicator (subtle text) ===== */
.loading-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: #888;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.3s;
  margin-right: 8px;
}

.loading-hint.is-visible {
  opacity: 1;
}

.loading-hint::before {
  content: '';
  width: 12px;
  height: 12px;
  border: 2px solid #c9a84c;
  border-top-color: transparent;
  border-radius: 50%;
  animation: loading-spin 0.8s linear infinite;
}

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

/* ===== 11. Responsive Skeleton ===== */
@media (max-width: 768px) {
  .skeleton-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
  }
  
  .skeleton-card {
    min-height: 180px;
    padding: 12px;
  }
  
  .skeleton-image {
    height: 80px;
  }
}

/* ===== 12. Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  .skeleton-image,
  .skeleton-line {
    animation: none;
    background: #f0f0f0;
  }
  
  .products-grid,
  .recipes-grid,
  .testimonials-grid {
    animation: none;
  }
}
