/* =====================================================
   نظام الطيبات - 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;
  }
}
