/**
 * animations.css - ملف CSS للتأثيرات والأنيميشن في موقع توثيق ZeinCard API
 */

/* تأثير الظهور التدريجي */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.6s ease-out forwards;
}

/* تأثير النبض للعناصر المهمة */
@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

.pulse {
  animation: pulse 2s infinite;
}

/* تأثير التحميل الدوار */
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-primary);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.5s ease;
}

.loading.hidden {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid var(--border-light);
  border-top: 5px solid var(--primary-600);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* تأثيرات التمرير */
.scroll-reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s ease;
}

.scroll-reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* تأثير توسيع وطي المحتوى */
.endpoint-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.endpoint.expanded .endpoint-header {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

/* تأثير تبديل الثيم */
body {
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* تأثير تحويم الزر */
.btn {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* تأثير تحويم البطاقة */
.feature-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.feature-card:hover .feature-icon {
  transform: scale(1.1);
}

.feature-icon {
  transition: transform 0.3s ease;
}

/* تأثير الزر النشط */
nav ul li a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 0;
  height: 2px;
  background-color: var(--primary-500);
  transition: width 0.3s ease, left 0.3s ease;
  border-radius: 2px;
}

nav ul li a:hover::after {
  width: 100%;
  left: 0;
}

nav ul li a.active::after {
  width: 100%;
  left: 0;
}

/* تأثير التبديل بين اللغات */
html[dir="rtl"] .content,
html[dir="ltr"] .content {
  transition: transform 0.5s ease, opacity 0.5s ease;
}

/* تأثير تحويم الرابط في الشريط الجانبي */
.sidebar-nav ul li a {
  transition: background-color 0.2s ease, color 0.2s ease, padding-right 0.2s ease;
}

html[dir="rtl"] .sidebar-nav ul li a:hover {
  padding-right: 0.8rem;
}

html[dir="ltr"] .sidebar-nav ul li a:hover {
  padding-left: 0.8rem;
}

/* تأثير الكود */
.code-block {
  position: relative;
  overflow: hidden;
}

.code-block::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background-color: var(--primary-500);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.code-block:hover::before {
  opacity: 1;
}

/* تأثير نقاط النهاية */
.endpoint-header {
  cursor: pointer;
  transition: background-color 0.3s ease;
  position: relative;
}

.endpoint-header:hover {
  background-color: var(--bg-tertiary);
}

.endpoint-header .method {
  transition: transform 0.2s ease;
}

.endpoint-header:hover .method {
  transform: scale(1.05);
}

.toggle-icon {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  transition: transform 0.3s ease;
}

html[dir="rtl"] .toggle-icon {
  right: auto;
  left: 15px;
}

.endpoint.expanded .toggle-icon {
  transform: translateY(-50%) rotate(180deg);
}

.endpoint-content {
  opacity: 0;
  transition: max-height 0.3s ease, opacity 0.3s ease;
}

.endpoint.expanded .endpoint-content {
  opacity: 1;
}

/* تأثير التمرير السلس */
html {
  scroll-behavior: smooth;
}

/* تأثير الملاحظة */
.note {
  position: relative;
  overflow: hidden;
}

.note::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    to right,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: rotate(30deg);
  animation: shine 3s infinite;
}

@keyframes shine {
  0% {
    transform: translateX(-100%) rotate(30deg);
  }
  100% {
    transform: translateX(100%) rotate(30deg);
  }
}

/* تأثير الجدول */
table {
  transition: box-shadow 0.3s ease;
}

table:hover {
  box-shadow: var(--shadow-md);
}

/* تأثير تبديل الثيم للأيقونات */
.fas {
  transition: transform 0.3s ease;
}

#theme-toggle:hover .fas,
#language-toggle:hover .fas {
  transform: rotate(30deg);
}

/* زر العودة إلى الأعلى */
.scroll-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: var(--primary-500);
  color: white;
  border: none;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  z-index: 99;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s, background-color 0.3s;
}

.scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-to-top:hover {
  background-color: var(--primary-600);
  transform: translateY(-5px);
}

.scroll-to-top i {
  font-size: 1.2rem;
}

html[dir="rtl"] .scroll-to-top {
  right: auto;
  left: 30px;
}
