/**
 * ANIMATIONS v4.1
 * Gelişmiş Animasyonlar & Micro-interactions
 */

/* ========== PAGE TRANSITIONS ========== */
.page-enter {
  opacity: 0;
  transform: translateY(20px);
}

.page-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.page-exit {
  opacity: 1;
  transform: translateY(0);
}

.page-exit-active {
  opacity: 0;
  transform: translateY(-20px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== STAGGERED ANIMATIONS ========== */
.stagger-item {
  opacity: 0;
  transform: translateY(20px);
  animation: staggerIn 0.5s ease forwards;
}

.stagger-item:nth-child(1) { animation-delay: 0.05s; }
.stagger-item:nth-child(2) { animation-delay: 0.1s; }
.stagger-item:nth-child(3) { animation-delay: 0.15s; }
.stagger-item:nth-child(4) { animation-delay: 0.2s; }
.stagger-item:nth-child(5) { animation-delay: 0.25s; }
.stagger-item:nth-child(6) { animation-delay: 0.3s; }
.stagger-item:nth-child(7) { animation-delay: 0.35s; }
.stagger-item:nth-child(8) { animation-delay: 0.4s; }
.stagger-item:nth-child(9) { animation-delay: 0.45s; }
.stagger-item:nth-child(10) { animation-delay: 0.5s; }

@keyframes staggerIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========== BUTTON ANIMATIONS ========== */
.btn {
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Ripple Effect */
.btn::after {
  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 ease, height 0.6s ease;
}

.btn:active::after {
  width: 300px;
  height: 300px;
}

/* Shine Effect for Primary */
.btn.primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  transition: left 0.5s ease;
}

.btn.primary:hover::before {
  left: 100%;
}

/* Bounce on hover */
.btn:hover {
  transform: translateY(-3px);
}

.btn:active {
  transform: translateY(-1px) scale(0.98);
}

/* ========== CARD ANIMATIONS ========== */
.card {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
  transform: translateY(-8px);
  box-shadow: 
    0 20px 40px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(169, 238, 22, 0.1);
}

/* Card Glow Effect */
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 16px;
  background: radial-gradient(
    600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(169, 238, 22, 0.06),
    transparent 40%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 1;
}

.card:hover::before {
  opacity: 1;
}

.card > * {
  position: relative;
  z-index: 2;
}

/* ========== INPUT ANIMATIONS ========== */
input[type=text],
input[type=password],
textarea,
select {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

input[type=text]:focus,
input[type=password]:focus,
textarea:focus,
select:focus {
  transform: scale(1.02);
  box-shadow: 
    0 0 0 3px rgba(169, 238, 22, 0.1),
    0 10px 20px rgba(0, 0, 0, 0.2);
}

/* Floating Label Effect */
.input-group {
  position: relative;
  margin-bottom: 20px;
}

.input-group input {
  padding-top: 20px;
}

.input-group label {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 14px;
  pointer-events: none;
  transition: all 0.3s ease;
}

.input-group input:focus + label,
.input-group input:not(:placeholder-shown) + label {
  top: 8px;
  font-size: 11px;
  color: var(--accent);
}

/* ========== SUCCESS ANIMATION ========== */
@keyframes successPop {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes successCheck {
  0% {
    stroke-dashoffset: 100;
  }
  100% {
    stroke-dashoffset: 0;
  }
}

.success-icon {
  animation: successPop 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.success-icon svg path {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: successCheck 0.5s ease forwards 0.3s;
}

/* ========== ERROR ANIMATION ========== */
@keyframes errorShake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.error-shake {
  animation: errorShake 0.6s ease;
}

@keyframes errorPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.4);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(255, 59, 48, 0);
  }
}

.error-pulse {
  animation: errorPulse 0.6s ease;
}

/* ========== NUMBER COUNTER ========== */
@keyframes countUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.count-up {
  animation: countUp 0.4s ease;
}

.stat .v {
  transition: all 0.3s ease;
}

.stat .v.counting {
  color: var(--accent);
  transform: scale(1.1);
}

/* ========== TAB ANIMATIONS ========== */
.tab {
  position: relative;
  overflow: hidden;
}

.tab::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

.tab:hover::after {
  width: 50%;
}

.tab.active::after {
  width: 100%;
}

/* Tab content transition */
.tab-content {
  opacity: 0;
  transform: translateX(20px);
  transition: all 0.3s ease;
}

.tab-content.active {
  opacity: 1;
  transform: translateX(0);
}

/* ========== TABLE ROW ANIMATIONS ========== */
tbody tr {
  transition: all 0.2s ease;
}

tbody tr:hover {
  background: rgba(169, 238, 22, 0.05);
  transform: scale(1.01);
}

tbody tr:active {
  transform: scale(0.99);
}

/* Row slide in */
@keyframes rowSlideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

tbody tr.slide-in {
  animation: rowSlideIn 0.3s ease forwards;
}

/* ========== TOAST ANIMATIONS ========== */
.toast {
  animation: toastSlideIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes toastSlideIn {
  from {
    transform: translateX(100%) scale(0.8);
    opacity: 0;
  }
  to {
    transform: translateX(0) scale(1);
    opacity: 1;
  }
}

.toast.hiding {
  animation: toastSlideOut 0.3s ease forwards;
}

@keyframes toastSlideOut {
  to {
    transform: translateX(100%) scale(0.8);
    opacity: 0;
  }
}

/* Toast progress bar */
.toast::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--accent);
  animation: toastProgress 3s linear forwards;
}

@keyframes toastProgress {
  from { width: 100%; }
  to { width: 0%; }
}

.toast.error::before {
  background: var(--danger);
}

/* ========== BRAND BUTTON ANIMATIONS ========== */
.brand-btn {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.brand-btn:hover {
  transform: translateY(-5px) scale(1.05);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.brand-btn.active {
  animation: brandSelect 0.4s ease;
}

@keyframes brandSelect {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* Checkmark animation */
.brand-btn.active::after {
  animation: checkPop 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes checkPop {
  0% { transform: scale(0); }
  100% { transform: scale(1); }
}

/* ========== LOADING ANIMATIONS ========== */
.spinner {
  animation: spin 0.8s linear infinite, pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(169, 238, 22, 0.4);
  }
  50% {
    box-shadow: 0 0 20px 10px rgba(169, 238, 22, 0);
  }
}

/* Skeleton shimmer */
.skeleton {
  background: linear-gradient(
    90deg,
    #1a1a1a 0%,
    #2a2a2a 50%,
    #1a1a1a 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

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

/* ========== CONFETTI ENHANCED ========== */
@keyframes confettiFall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

@keyframes confettiSpin {
  0% { transform: rotateX(0) rotateY(0); }
  100% { transform: rotateX(360deg) rotateY(360deg); }
}

.confetti-piece {
  position: fixed;
  pointer-events: none;
  z-index: 99999;
  animation: confettiFall var(--fall-duration, 3s) linear forwards;
}

.confetti-piece.spin {
  animation: confettiFall var(--fall-duration, 3s) linear forwards,
             confettiSpin 1s linear infinite;
}

/* ========== MODAL ANIMATIONS ========== */
.modal-overlay {
  animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    backdrop-filter: blur(0);
  }
  to {
    opacity: 1;
    backdrop-filter: blur(4px);
  }
}

.modal-content {
  animation: modalSlideUp 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(50px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ========== HOVER GLOW EFFECT ========== */
.glow-on-hover {
  position: relative;
}

.glow-on-hover::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, var(--accent), var(--accent2), var(--accent));
  background-size: 200% 200%;
  border-radius: inherit;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
  animation: glowRotate 3s linear infinite;
}

.glow-on-hover:hover::before {
  opacity: 1;
}

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

/* ========== TYPING EFFECT ========== */
.typing {
  overflow: hidden;
  border-right: 2px solid var(--accent);
  white-space: nowrap;
  animation: typing 2s steps(30) forwards, blink 0.7s step-end infinite;
}

@keyframes typing {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes blink {
  50% { border-color: transparent; }
}

/* ========== PULSE DOT ========== */
.pulse-dot {
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
  position: relative;
}

.pulse-dot::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--accent);
  animation: pulseDot 1.5s ease-out infinite;
}

@keyframes pulseDot {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(3);
    opacity: 0;
  }
}

/* ========== FLOATING ANIMATION ========== */
.float {
  animation: float 3s ease-in-out infinite;
}

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

/* ========== DRIVER.JS CUSTOM STYLES ========== */
.driver-popover {
  background: var(--panel) !important;
  border: 1px solid var(--border) !important;
  border-radius: 16px !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5) !important;
}

.driver-popover-title {
  color: var(--accent) !important;
  font-size: 18px !important;
  font-weight: 700 !important;
}

.driver-popover-description {
  color: var(--text) !important;
  font-size: 14px !important;
  line-height: 1.6 !important;
}

.driver-popover-footer {
  border-top: 1px solid var(--border) !important;
  padding-top: 12px !important;
}

.driver-popover-navigation-btns button {
  background: var(--accent) !important;
  color: #000 !important;
  border: none !important;
  border-radius: 8px !important;
  padding: 8px 16px !important;
  font-weight: 600 !important;
  transition: all 0.2s ease !important;
}

.driver-popover-navigation-btns button:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 15px rgba(169, 238, 22, 0.3) !important;
}

.driver-popover-close-btn {
  color: var(--muted) !important;
}

.driver-popover-close-btn:hover {
  color: var(--danger) !important;
}

.driver-popover-arrow {
  border-color: var(--panel) !important;
}

.driver-overlay {
  background: rgba(0, 0, 0, 0.7) !important;
}

.driver-active-element {
  box-shadow: 0 0 0 4px var(--accent) !important;
  border-radius: 12px !important;
}

/* Progress indicator */
.driver-popover-progress-text {
  color: var(--muted) !important;
  font-size: 12px !important;
}
