/* === UNIFIED ANIMATIONS === */

/* Fade In animations */
.animate-fade-in {
  animation: fadeIn 0.6s ease-out both;
}

.animate-fade-in-up {
  animation: fadeInUp 0.6s ease-out both;
}

.animate-fade-in-down {
  animation: fadeInDown 0.6s ease-out both;
}

.animate-fade-in-left {
  animation: fadeInLeft 0.6s ease-out both;
}

.animate-fade-in-right {
  animation: fadeInRight 0.6s ease-out both;
}

/* Scale animations */
.animate-scale-in {
  animation: scaleIn 0.5s ease-out both;
}

.animate-zoom-in {
  animation: zoomIn 0.4s ease-out both;
}

/* Slide animations */
.animate-slide-up {
  animation: slideUp 0.5s ease-out both;
}

.animate-slide-down {
  animation: slideDown 0.5s ease-out both;
}

/* Bounce animations */
.animate-bounce-in {
  animation: bounceIn 0.6s ease-out both;
}

/* Pulse animation */
.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

/* Float animation */
.animate-float {
  animation: float 3s ease-in-out infinite;
}

/* Glow animation */
.animate-glow {
  animation: glow 2s ease-in-out infinite;
}

/* Stagger delays for child elements */
.animate-stagger > *:nth-child(1) { animation-delay: 0s; }
.animate-stagger > *:nth-child(2) { animation-delay: 0.1s; }
.animate-stagger > *:nth-child(3) { animation-delay: 0.2s; }
.animate-stagger > *:nth-child(4) { animation-delay: 0.3s; }
.animate-stagger > *:nth-child(5) { animation-delay: 0.4s; }
.animate-stagger > *:nth-child(6) { animation-delay: 0.5s; }
.animate-stagger > *:nth-child(7) { animation-delay: 0.6s; }
.animate-stagger > *:nth-child(8) { animation-delay: 0.7s; }
.animate-stagger > *:nth-child(9) { animation-delay: 0.8s; }
.animate-stagger > *:nth-child(10) { animation-delay: 0.9s; }

/* Individual delay utilities */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }
.delay-600 { animation-delay: 0.6s; }
.delay-700 { animation-delay: 0.7s; }
.delay-800 { animation-delay: 0.8s; }
.delay-900 { animation-delay: 0.9s; }
.delay-1000 { animation-delay: 1s; }

/* Duration utilities */
.duration-300 { animation-duration: 0.3s; }
.duration-500 { animation-duration: 0.5s; }
.duration-700 { animation-duration: 0.7s; }
.duration-1000 { animation-duration: 1s; }

/* === KEYFRAMES === */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  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);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes zoomIn {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.9;
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(255, 193, 7, 0.2);
  }
  50% {
    box-shadow: 0 0 40px rgba(255, 193, 7, 0.4);
  }
}

/* Scroll-triggered animations (via IntersectionObserver) */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-on-scroll.animated {
  opacity: 1;
  transform: translateY(0);
}

.animate-on-scroll-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-on-scroll-left.animated {
  opacity: 1;
  transform: translateX(0);
}

.animate-on-scroll-right {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-on-scroll-right.animated {
  opacity: 1;
  transform: translateX(0);
}

.animate-on-scroll-scale {
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-on-scroll-scale.animated {
  opacity: 1;
  transform: scale(1);
}

/* Hero icon animation */
.hero-icon-animated {
  animation: fadeInDown 0.6s ease-out, float 3s ease-in-out 0.6s infinite;
}

/* Card hover lift effect */
.card-hover-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-hover-lift:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

/* Text shimmer effect */
.text-shimmer {
  background: linear-gradient(90deg,
    rgba(255, 255, 255, 0.8) 0%,
    rgba(255, 193, 7, 1) 50%,
    rgba(255, 255, 255, 0.8) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .animate-on-scroll,
  .animate-on-scroll-left,
  .animate-on-scroll-right,
  .animate-on-scroll-scale {
    opacity: 1;
    transform: none;
  }
}

/* Page hero unified styles */
.page-hero {
  padding: 3rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
}

.page-hero-icon {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  margin-bottom: 1.5rem;
  animation: fadeInDown 0.6s ease-out, float 4s ease-in-out 0.6s infinite;
}

.page-hero h1 {
  animation: fadeInUp 0.6s ease-out 0.1s both;
}

.page-hero p {
  animation: fadeInUp 0.6s ease-out 0.2s both;
}

/* Responsive adjustments */
@media (max-width: 767px) {
  .page-hero {
    padding: 2rem 0;
  }

  .page-hero-icon {
    width: 64px;
    height: 64px;
    font-size: 2rem;
  }

  .animate-on-scroll,
  .animate-on-scroll-left,
  .animate-on-scroll-right {
    transform: translateY(20px);
  }

  .animate-on-scroll-left,
  .animate-on-scroll-right {
    transform: translateY(20px);
  }
}

/* === UNIFIED FORM STYLES === */

/* Form labels */
.form-label.small {
  font-weight: 500;
  letter-spacing: 0.3px;
  transition: color 0.2s ease;
}

/* Form inputs focus enhancement */
.form-control:focus,
.form-select:focus {
  border-color: rgba(255, 193, 7, 0.5);
  box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.15);
}

/* Input group icons */
.input-group-text {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.input-group:focus-within .input-group-text {
  background: rgba(255, 193, 7, 0.1);
  border-color: rgba(255, 193, 7, 0.3);
  color: #ffc107;
}

/* Avatar/Cover preview containers */
.position-relative .bg-warning.rounded-circle {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.position-relative .bg-warning.rounded-circle:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(255, 193, 7, 0.4);
}

/* === UNIFIED BUTTON STYLES === */

/* Base button enhancements */
.btn {
  font-weight: 600;
  letter-spacing: 0.3px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

/* Primary (Blue) */
.btn-primary {
  background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
  border: none;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #3d8bfd 0%, #0d6efd 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(13, 110, 253, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(13, 110, 253, 0.3);
}

/* Secondary (Gray) */
.btn-secondary {
  background: linear-gradient(135deg, #6c757d 0%, #545b62 100%);
  border: none;
}

.btn-secondary:hover {
  background: linear-gradient(135deg, #7d868e 0%, #6c757d 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(108, 117, 125, 0.4);
}

.btn-secondary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(108, 117, 125, 0.3);
}

/* Success (Green) */
.btn-success {
  background: linear-gradient(135deg, #198754 0%, #146c43 100%);
  border: none;
}

.btn-success:hover {
  background: linear-gradient(135deg, #20a065 0%, #198754 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(25, 135, 84, 0.4);
}

.btn-success:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(25, 135, 84, 0.3);
}

/* Danger (Red) */
.btn-danger {
  background: linear-gradient(135deg, #dc3545 0%, #bb2d3b 100%);
  border: none;
}

.btn-danger:hover {
  background: linear-gradient(135deg, #e35d6a 0%, #dc3545 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
}

.btn-danger:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

/* Warning (Yellow) */
.btn-warning {
  background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
  border: none;
  color: #000;
}

.btn-warning:hover {
  background: linear-gradient(135deg, #ffca2c 0%, #ffab00 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 193, 7, 0.4);
  color: #000;
}

.btn-warning:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(255, 193, 7, 0.3);
}

/* Info (Cyan) */
.btn-info {
  background: linear-gradient(135deg, #0dcaf0 0%, #0aa2c0 100%);
  border: none;
  color: #000;
}

.btn-info:hover {
  background: linear-gradient(135deg, #3dd5f3 0%, #0dcaf0 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(13, 202, 240, 0.4);
  color: #000;
}

.btn-info:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(13, 202, 240, 0.3);
}

/* Light */
.btn-light {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border: none;
  color: #212529;
}

.btn-light:hover {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(248, 249, 250, 0.4);
  color: #212529;
}

.btn-light:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(248, 249, 250, 0.3);
}

/* Dark */
.btn-dark {
  background: linear-gradient(135deg, #212529 0%, #16181b 100%);
  border: none;
}

.btn-dark:hover {
  background: linear-gradient(135deg, #343a40 0%, #212529 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(33, 37, 41, 0.5);
}

.btn-dark:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(33, 37, 41, 0.3);
}

/* === OUTLINE BUTTONS === */

.btn-outline-primary {
  border-width: 2px;
  transition: all 0.2s ease;
}

.btn-outline-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(13, 110, 253, 0.3);
}

.btn-outline-secondary {
  border-width: 2px;
  transition: all 0.2s ease;
}

.btn-outline-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(108, 117, 125, 0.3);
}

.btn-outline-success {
  border-width: 2px;
  transition: all 0.2s ease;
}

.btn-outline-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(25, 135, 84, 0.3);
}

.btn-outline-danger {
  border-width: 2px;
  transition: all 0.2s ease;
}

.btn-outline-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(220, 53, 69, 0.3);
}

.btn-outline-warning {
  border-width: 2px;
  transition: all 0.2s ease;
}

.btn-outline-warning:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 193, 7, 0.3);
}

.btn-outline-info {
  border-width: 2px;
  transition: all 0.2s ease;
}

.btn-outline-info:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(13, 202, 240, 0.3);
}

.btn-outline-light {
  border-width: 2px;
  transition: all 0.2s ease;
}

.btn-outline-light:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(248, 249, 250, 0.2);
}

.btn-outline-dark {
  border-width: 2px;
  transition: all 0.2s ease;
}

.btn-outline-dark:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(33, 37, 41, 0.3);
}

/* Active states for outline buttons */
.btn-outline-primary:active,
.btn-outline-secondary:active,
.btn-outline-success:active,
.btn-outline-danger:active,
.btn-outline-warning:active,
.btn-outline-info:active,
.btn-outline-light:active,
.btn-outline-dark:active {
  transform: translateY(0);
}

/* Form check switches */
.form-check-input:checked {
  background-color: #ffc107;
  border-color: #ffc107;
}

.form-check-input:focus {
  border-color: rgba(255, 193, 7, 0.5);
  box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.2);
}

/* Search form animations */
.input-group-sm .btn-outline-secondary {
  transition: background 0.2s ease, border-color 0.2s ease;
}

.input-group-sm .btn-outline-secondary:hover {
  background: rgba(255, 193, 7, 0.1);
  border-color: rgba(255, 193, 7, 0.3);
  color: #ffc107;
}

/* Filter buttons */
.btn-group .btn {
  transition: all 0.2s ease;
}

.btn-group .btn-warning {
  position: relative;
  z-index: 1;
}

/* Alert animations */
.alert {
  animation: slideInAlert 0.4s ease-out;
}

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

/* Pagination improvements */
.pagination .page-link {
  transition: all 0.2s ease;
}

.pagination .page-item.active .page-link {
  background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
  border-color: #ffc107;
}

.pagination .page-link:hover {
  background: rgba(255, 193, 7, 0.15);
  border-color: rgba(255, 193, 7, 0.3);
  color: #ffc107;
}

/* Modal improvements */
.modal-content {
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.modal.show .modal-dialog {
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Collapse animation enhancement */
.collapse {
  transition: height 0.3s ease;
}

.collapsing {
  transition: height 0.3s ease;
}

/* === CATEGORY ACCORDION === */

/* Accordion header styles */
.category-accordion-header {
  transition: background 0.2s ease;
}

/* Toggle area (title) - clickable to expand/collapse */
.category-toggle {
  cursor: pointer;
  user-select: none;
  transition: opacity 0.2s ease;
}

.category-toggle:hover {
  opacity: 0.85;
}

/* Chevron rotation */
.category-chevron {
  transition: transform 0.3s ease;
  font-size: 0.9em;
  color: rgba(255, 255, 255, 0.6);
}

.category-toggle[aria-expanded="true"] .category-chevron,
.category-chevron:not(.collapsed) {
  transform: rotate(0deg);
}

.category-toggle[aria-expanded="false"] .category-chevron,
.category-chevron.collapsed {
  transform: rotate(-90deg);
}

/* Live badge pulse */
.live-badge {
  animation: livePulse 1.5s ease-in-out infinite;
}

@keyframes livePulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

/* Category card collapsed state indicator */
.category-card .card-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.category-card .collapse:not(.show) + .card-header,
.category-card .card-header[aria-expanded="false"] {
  border-bottom: none;
}
