/* ===================================
   MICRO-INTERACTIONS & ANIMATIONS
   =================================== */

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

/* ===================================
   BUTTON ANIMATIONS
   =================================== */

/* Button Base Transitions */
button,
.btn,
.icon-button {
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Ripple Effect */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  transform: scale(0);
  animation: ripple-animation 0.6s ease-out;
  pointer-events: none;
}

@keyframes ripple-animation {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* Button Hover Effects */
.btn:hover,
.icon-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn:active,
.icon-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Button Press Animation */
@keyframes button-press {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(0.95);
  }
  100% {
    transform: scale(1);
  }
}

.btn-press {
  animation: button-press 0.2s ease;
}

/* ===================================
   CARD ANIMATIONS
   =================================== */

/* Card Hover Effect */
.video-card,
.suggested-card {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.3s ease;
}

.video-card:hover,
.suggested-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4),
              0 0 24px rgba(229, 9, 20, 0.3);
}

/* Card Image Zoom */
.video-card img,
.suggested-card img {
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.video-card:hover img,
.suggested-card:hover img {
  transform: scale(1.1);
}

/* Card Flip Animation */
@keyframes card-flip {
  0% {
    transform: rotateY(0);
  }
  100% {
    transform: rotateY(180deg);
  }
}

.card-flip {
  animation: card-flip 0.6s ease;
}

/* ===================================
   TOAST NOTIFICATIONS
   =================================== */

.toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 16px 20px;
  min-width: 300px;
  max-width: 400px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
  animation: toast-slide-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.toast::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--accent-primary);
}

.toast.success::before {
  background: #10b981;
}

.toast.error::before {
  background: #ef4444;
}

.toast.warning::before {
  background: #f59e0b;
}

.toast.info::before {
  background: #3b82f6;
}

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

@keyframes toast-slide-out {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(400px);
    opacity: 0;
  }
}

.toast.removing {
  animation: toast-slide-out 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.toast__icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.toast__content {
  flex: 1;
}

.toast__title {
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.toast__message {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.toast__close {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s;
}

.toast__close:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ===================================
   SMOOTH TRANSITIONS
   =================================== */

/* Page Transition */
.page-transition {
  animation: page-fade-in 0.4s ease-out;
}

@keyframes page-fade-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Modal Animations */
.modal {
  transition: opacity 0.3s ease, backdrop-filter 0.3s ease;
}

.modal.active {
  animation: modal-fade-in 0.3s ease-out;
}

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

.modal-card {
  animation: modal-slide-up 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modal-slide-up {
  from {
    transform: translateY(50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ===================================
   HOVER EFFECTS
   =================================== */

/* Link Hover */
a {
  transition: color 0.2s ease, opacity 0.2s ease;
}

a:hover {
  opacity: 0.8;
}

/* Icon Hover */
.icon-button svg {
  transition: transform 0.2s ease;
}

.icon-button:hover svg {
  transform: scale(1.1);
}

/* Tab Hover */
.tab-button {
  position: relative;
  transition: color 0.3s ease, background 0.3s ease;
}

.tab-button::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 3px;
  background: var(--accent-primary);
  transition: width 0.3s ease, left 0.3s ease;
  border-radius: 3px 3px 0 0;
}

.tab-button:hover::after {
  width: 100%;
  left: 0;
}

.tab-button.active::after {
  width: 100%;
  left: 0;
}

/* ===================================
   SCROLL ANIMATIONS
   =================================== */

/* Scroll Reveal */
.scroll-reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* Parallax Effect */
.parallax {
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===================================
   FOCUS ANIMATIONS
   =================================== */

/* Focus Ring */
*:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(229, 9, 20, 0.1);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* ===================================
   BOUNCE ANIMATIONS
   =================================== */

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

.bounce {
  animation: bounce 0.6s ease;
}

/* ===================================
   SHAKE ANIMATION
   =================================== */

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: translateX(-5px);
  }
  20%, 40%, 60%, 80% {
    transform: translateX(5px);
  }
}

.shake {
  animation: shake 0.5s ease;
}

/* ===================================
   PULSE EFFECT
   =================================== */

@keyframes pulse-ring {
  0% {
    transform: scale(0.8);
    opacity: 1;
  }
  100% {
    transform: scale(1.4);
    opacity: 0;
  }
}

.pulse-ring {
  position: relative;
}

.pulse-ring::after {
  content: '';
  position: absolute;
  inset: -4px;
  border: 2px solid var(--accent-primary);
  border-radius: inherit;
  animation: pulse-ring 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ===================================
   GRADIENT ANIMATIONS
   =================================== */

@keyframes gradient-shift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.gradient-animate {
  background-size: 200% 200%;
  animation: gradient-shift 3s ease infinite;
}

/* ===================================
   MOBILE OPTIMIZATIONS
   =================================== */

@media (max-width: 768px) {
  .toast-container {
    right: 10px;
    left: 10px;
  }

  .toast {
    min-width: auto;
    max-width: none;
  }
}

/* Reduce motion for accessibility */
@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;
  }
}
