/* Custom Animations */
@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes slide-in-right {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.8;
  }
}

.animate-fade-in-up {
  animation: fade-in-up 0.8s ease-out;
}

.animate-fade-in {
  animation: fade-in 1s ease-out;
}

.animate-slide-in-right {
  animation: slide-in-right 0.8s ease-out;
}

/* Smooth Scroll */
html {
  scroll-behavior: smooth;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #3b82f6;
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: #2563eb;
}

/* Loading Animation */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
}

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

/* Form Focus Effects */
input:focus, textarea:focus, select:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Mobile Menu Animation */
#mobile-menu {
  transition: all 0.3s ease-in-out;
}

#mobile-menu.show {
  display: block;
  animation: fade-in 0.3s ease-out;
}

/* Hover Effects for Cards */
.hover-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Gradient Text */
.gradient-text {
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Success/Error Messages */
.success-message {
  background: #10b981;
  color: white;
  padding: 1rem;
  border-radius: 0.5rem;
  animation: fade-in 0.3s ease-out;
}

.error-message {
  background: #ef4444;
  color: white;
  padding: 1rem;
  border-radius: 0.5rem;
  animation: fade-in 0.3s ease-out;
}

/* Floating Animation */
@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-20px);
  }
}

.float-animation {
  animation: float 3s ease-in-out infinite;
}

/* Responsive Utilities */
@media (max-width: 768px) {
  .mobile-hidden {
    display: none !important;
  }
}

/* Navigation Fixed Background */
nav {
  transition: all 0.3s ease;
}

nav.scrolled {
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Section Padding */
section {
  position: relative;
}

/* Interactive Button Effects */
button, .btn {
  position: relative;
  overflow: hidden;
}

button::before, .btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

button:active::before, .btn:active::before {
  width: 300px;
  height: 300px;
}

/* Custom Grid Animations */
.grid-animate > * {
  opacity: 0;
  animation: fade-in-up 0.6s ease-out forwards;
}

.grid-animate > *:nth-child(1) { animation-delay: 0.1s; }
.grid-animate > *:nth-child(2) { animation-delay: 0.2s; }
.grid-animate > *:nth-child(3) { animation-delay: 0.3s; }
.grid-animate > *:nth-child(4) { animation-delay: 0.4s; }
.grid-animate > *:nth-child(5) { animation-delay: 0.5s; }
.grid-animate > *:nth-child(6) { animation-delay: 0.6s; }

/* Sidebar Styles */
#sidebar-menu {
  will-change: transform;
}

#sidebar-overlay {
  will-change: opacity;
}

/* Sidebar Scrollbar */
#sidebar-menu::-webkit-scrollbar {
  width: 6px;
}

#sidebar-menu::-webkit-scrollbar-track {
  background: #f1f5f9;
}

#sidebar-menu::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

#sidebar-menu::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Sidebar Link Hover Effects */
.sidebar-link {
  position: relative;
  transition: all 0.2s ease;
}

.sidebar-link::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  background: #1e40af;
  border-radius: 0 3px 3px 0;
  transition: height 0.2s ease;
}

.sidebar-link:hover::before {
  height: 70%;
}

/* Submenu Animation */
.submenu-content {
  animation: slideDown 0.3s ease-out;
  transform-origin: top;
}

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

/* Icon Rotation */
.rotate-90 {
  transform: rotate(90deg);
}

.rotate-180 {
  transform: rotate(180deg);
}

/* Prevent body scroll when sidebar is open */
body.sidebar-open {
  overflow: hidden;
}

/* ===== Modal Styles ===== */

/* Modal Overlay */
#modal-overlay {
  transition: opacity 0.3s ease-in-out;
  backdrop-filter: blur(4px);
}

#modal-overlay.opacity-100 {
  opacity: 1;
}

/* Modal Container */
[id^="modal-"]:not(#modal-overlay) {
  transition: all 0.3s ease-in-out;
}

/* Modal Content */
[id^="modal-"] > div > div {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  will-change: transform;
}

/* Modal Scale Animation */
.scale-95 {
  transform: scale(0.95);
}

.scale-100 {
  transform: scale(1);
}

/* Modal Header Gradient */
[id^="modal-"] .bg-gradient-to-r {
  position: sticky;
  top: 0;
  z-index: 10;
}

/* Modal Scrollbar */
[id^="modal-"] > div::-webkit-scrollbar {
  width: 8px;
}

[id^="modal-"] > div::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 10px;
}

[id^="modal-"] > div::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}

[id^="modal-"] > div::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Modal Close Button Hover */
.modal-close {
  transition: all 0.2s ease;
  position: relative;
}

.modal-close:hover {
  transform: rotate(90deg);
}

/* Modal Card Hover Effect */
[data-modal] {
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

[data-modal]::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.1);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

[data-modal]:hover::before {
  width: 300px;
  height: 300px;
}

[data-modal]:active {
  transform: scale(0.98);
}

/* Modal Content Sections */
[id^="modal-"] .border-l-4 {
  transition: all 0.2s ease;
}

[id^="modal-"] .border-l-4:hover {
  border-left-width: 6px;
  transform: translateX(2px);
}

/* Modal CTA Button */
[id^="modal-"] a[class*="bg-gradient"] {
  position: relative;
  overflow: hidden;
}

[id^="modal-"] a[class*="bg-gradient"]::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

[id^="modal-"] a[class*="bg-gradient"]:hover::before {
  width: 400px;
  height: 400px;
}

/* Smooth entrance animation for modal benefits list */
[id^="modal-"] ul li {
  opacity: 0;
  animation: fadeInLeft 0.5s ease forwards;
}

[id^="modal-"] ul li:nth-child(1) { animation-delay: 0.1s; }
[id^="modal-"] ul li:nth-child(2) { animation-delay: 0.15s; }
[id^="modal-"] ul li:nth-child(3) { animation-delay: 0.2s; }
[id^="modal-"] ul li:nth-child(4) { animation-delay: 0.25s; }
[id^="modal-"] ul li:nth-child(5) { animation-delay: 0.3s; }
[id^="modal-"] ul li:nth-child(6) { animation-delay: 0.35s; }
[id^="modal-"] ul li:nth-child(7) { animation-delay: 0.4s; }

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Mobile responsiveness for modals */
@media (max-width: 768px) {
  [id^="modal-"] > div > div {
    max-height: 95vh;
    margin: 10px;
  }
  
  [id^="modal-"] .p-8 {
    padding: 1.5rem;
  }
  
  [id^="modal-"] .grid {
    grid-template-columns: 1fr;
  }
}
