/* ===================================
   Animations CSS - Lawyer Website
   مكتب المحامي عبدالله بن صديق فلاته
   =================================== */

/* ===================================
   1. FADE-IN ANIMATIONS
   =================================== */

/* Base fade-in animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Fade-in classes for sections */
.fade-in {
  animation: fadeIn 0.6s var(--easing) forwards;
}

.fade-in-up {
  animation: fadeInUp 0.8s var(--easing) forwards;
}

.fade-in-left {
  animation: fadeInLeft 0.8s var(--easing) forwards;
}

.fade-in-right {
  animation: fadeInRight 0.8s var(--easing) forwards;
}

/* Initial state for elements that will animate in */
.animate-on-scroll {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.6s var(--easing), transform 0.6s var(--easing);
}

/* Only hide if JS is enabled and adds the 'js-enabled' class */
/* Exclude sections from animation */
.js-enabled .animate-on-scroll:not(.visible):not(section) {
  opacity: 0;
  transform: translateY(20px);
}

.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Ensure sections are always visible */
section.animate-on-scroll {
  opacity: 1 !important;
  transform: translateY(0) !important;
}

/* Staggered animation delays for multiple elements */
.animate-on-scroll:nth-child(1) {
  transition-delay: 0ms;
}

.animate-on-scroll:nth-child(2) {
  transition-delay: 100ms;
}

.animate-on-scroll:nth-child(3) {
  transition-delay: 200ms;
}

.animate-on-scroll:nth-child(4) {
  transition-delay: 300ms;
}

.animate-on-scroll:nth-child(5) {
  transition-delay: 400ms;
}

.animate-on-scroll:nth-child(6) {
  transition-delay: 500ms;
}

/* ===================================
   2. BUTTON HOVER EFFECTS
   =================================== */

/* Primary buttons */
.btn,
.btn-primary,
button[type="submit"],
.cta-button {
  position: relative;
  overflow: hidden;
  transition: all var(--transition-normal) var(--easing);
}

.btn:hover,
.btn-primary:hover,
button[type="submit"]:hover,
.cta-button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.btn:active,
.btn-primary:active,
button[type="submit"]:active,
.cta-button:active {
  transform: translateY(0);
  box-shadow: var(--shadow-md);
}

/* Button ripple effect */
.btn::before,
.btn-primary::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:hover::before,
.btn-primary:hover::before {
  width: 300px;
  height: 300px;
}

/* ===================================
   3. CARD HOVER EFFECTS
   =================================== */

/* Service cards, blog cards, team cards - Removed */
.card,
.team-card,
.faq-item {
  transition: all var(--transition-normal) var(--easing);
}

.card:hover,
.team-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-hover);
}

/* Card image zoom effect */
.card img,
.team-card img {
  transition: transform var(--transition-slow) var(--easing);
}

.card:hover img,
.team-card:hover img {
  transform: scale(1.05);
}

/* Card overlay effect */
.card-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to bottom, transparent, rgba(10, 15, 60, 0.7));
  opacity: 0;
  transition: opacity var(--transition-normal) var(--easing);
}

.card:hover .card-overlay {
  opacity: 1;
}

/* ===================================
   4. LINK HOVER EFFECTS
   =================================== */

/* Navigation links */
.nav-link,
.navbar-nav .nav-link {
  position: relative;
  transition: color var(--transition-fast) var(--easing);
}

.nav-link::after,
.navbar-nav .nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--gold-gradient);
  transition: width var(--transition-normal) var(--easing);
}

.nav-link:hover::after,
.navbar-nav .nav-link:hover::after {
  width: 100%;
}

.nav-link.active::after,
.navbar-nav .nav-link.active::after {
  width: 100%;
}

/* Footer links */
.footer-link {
  position: relative;
  display: inline-block;
  transition: all var(--transition-fast) var(--easing);
}

.footer-link::before {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 1px;
  background: var(--gold-light);
  transition: width var(--transition-normal) var(--easing);
}

.footer-link:hover {
  color: var(--gold-light);
  transform: translateX(5px);
}

[dir="rtl"] .footer-link:hover {
  transform: translateX(-5px);
}

.footer-link:hover::before {
  width: 100%;
}

/* ===================================
   5. ICON HOVER EFFECTS
   =================================== */

/* Social media icons */
.social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
  transition: all var(--transition-normal) var(--easing);
}

.social-icon:hover {
  background: var(--gold-gradient);
  transform: translateY(-3px) rotate(5deg);
  box-shadow: var(--shadow-hover);
}

/* Service icons - Removed */
.service-icon {
  font-size: 48px;
  color: var(--gold-start);
  transition: all var(--transition-normal) var(--easing);
}

/* ===================================
   6. FORM INPUT EFFECTS
   =================================== */

/* Input fields */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="file"],
textarea,
select {
  transition: all var(--transition-fast) var(--easing);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--gold-start);
  box-shadow: 0 0 0 3px rgba(200, 160, 65, 0.1);
  transform: translateY(-1px);
}

/* ===================================
   7. ACCORDION EFFECTS
   =================================== */

/* FAQ accordion */
.accordion-button {
  transition: all var(--transition-normal) var(--easing);
}

.accordion-button:not(.collapsed) {
  background: linear-gradient(90deg, rgba(200, 160, 65, 0.1), rgba(232, 196, 106, 0.1));
  color: var(--navy-blue);
}

.accordion-button::after {
  transition: transform var(--transition-normal) var(--easing);
}

.accordion-collapse {
  transition: all var(--transition-normal) var(--easing);
}

/* ===================================
   8. LOADING ANIMATIONS
   =================================== */

/* Spinner */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(200, 160, 65, 0.3);
  border-top-color: var(--gold-start);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Pulse animation */
@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.pulse {
  animation: pulse 2s var(--easing) infinite;
}

/* ===================================
   9. SCROLL ANIMATIONS
   =================================== */

/* Smooth scroll behavior */
html {
  scroll-behavior: smooth;
}

/* Scroll to top button */
.scroll-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 55px;
  height: 55px;
  background: var(--gold-gradient);
  color: var(--white);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal) var(--easing);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(200, 160, 65, 0.4);
}

.scroll-to-top i {
  font-size: 1.5rem;
  font-weight: bold;
  padding-right: 8px;
}

[dir="ltr"] .scroll-to-top i {
  padding-right: 0;
  padding-left: 8px;
}

[dir="rtl"] .scroll-to-top {
  right: auto;
  left: 30px;
}

.scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.scroll-to-top:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(200, 160, 65, 0.6);
}

/* Responsive */
@media (max-width: 768px) {
  .scroll-to-top {
    width: 50px;
    height: 50px;
    bottom: 20px;
    right: 20px;
  }
  
  [dir="rtl"] .scroll-to-top {
    right: auto;
    left: 20px;
  }
  
  .scroll-to-top i {
    font-size: 1.3rem;
  }
}

/* ===================================
   10. NAVBAR SCROLL EFFECTS
   =================================== */

.navbar {
  transition: all var(--transition-normal) var(--easing);
}

.navbar.navbar-scrolled {
  box-shadow: var(--shadow-md);
  background: rgba(10, 15, 60, 0.98) !important;
}

.navbar.navbar-hidden {
  transform: translateY(-100%);
}

.navbar.navbar-visible {
  transform: translateY(0);
}

/* ===================================
   11. IMAGE EFFECTS
   =================================== */

/* Image lazy load fade-in */
img {
  transition: opacity var(--transition-normal) var(--easing);
}

img.lazy-loading {
  opacity: 0;
}

img.lazy-loaded {
  opacity: 1;
}

/* Image hover overlay */
.image-wrapper {
  position: relative;
  overflow: hidden;
}

.image-wrapper::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gold-gradient);
  opacity: 0;
  transition: opacity var(--transition-normal) var(--easing);
  mix-blend-mode: multiply;
}

.image-wrapper:hover::after {
  opacity: 0.3;
}

/* ===================================
   12. RESPONSIVE ANIMATIONS
   =================================== */

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}

/* Disable complex animations on mobile for performance */
@media (max-width: 767px) {

  .animate-on-scroll,
  .js-enabled .animate-on-scroll:not(.visible) {
    opacity: 1 !important;
    transform: none !important;
  }

  .team-card:hover {
    transform: none;
  }

  .team-card:hover img {
    transform: none;
  }
}

section {
  opacity: 1 !important;
  transform: none !important;
  transition: none !important;
}

section.animate-on-scroll,
section.fade-in,
section.fade-in-up,
section.fade-in-left,
section.fade-in-right {
  opacity: 1 !important;
  transform: none !important;
  animation: none !important;
}