/* AnındaBot — Global motion & micro-interactions */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Keyframes ── */
@keyframes ab-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes ab-fade-up {
  from { opacity: 0; transform: translateY(28px); filter: blur(6px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

@keyframes ab-fade-down {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes ab-slide-in-left {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes ab-slide-in-right {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes ab-scale-in {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes ab-modal-in {
  from { opacity: 0; transform: scale(0.92) translateY(16px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes ab-overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes ab-pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.35); }
  50% { box-shadow: 0 0 0 10px rgba(37, 211, 102, 0); }
}

@keyframes ab-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes ab-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes ab-spin {
  to { transform: rotate(360deg); }
}

@keyframes ab-gradient-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes ab-tab-in {
  from { opacity: 0; transform: translateY(16px) scale(0.98); filter: blur(4px); }
  to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

@keyframes ab-tab-flash {
  0% { opacity: 0.6; transform: translateY(12px) scale(0.97); filter: blur(3px); }
  60% { opacity: 1; transform: translateY(-2px) scale(1.005); }
  100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

.tab-panel.tab-flash {
  animation: ab-tab-flash 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes ab-step-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

@keyframes ab-success-pop {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes ab-ripple {
  to { transform: scale(2.5); opacity: 0; }
}

/* ── Page enter ── */
body.ui-ready {
  animation: ab-fade-in 0.55s ease;
}

.panel-shell,
.auth-page > *,
.register-shell,
.success-page > *,
.upgrade-shell {
  animation: ab-fade-up 0.75s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.panel-sidebar {
  animation: ab-slide-in-left 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.panel-topbar {
  animation: ab-fade-down 0.55s ease 0.12s both;
}

.panel-main {
  animation: ab-fade-up 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both;
}

/* ── Scroll reveal ── */
[data-reveal] {
  opacity: 0;
  transform: translateY(32px);
  filter: blur(4px);
  transition:
    opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

[data-reveal="left"] { transform: translateX(-20px); }
[data-reveal="left"].is-visible { transform: translateX(0); }

[data-reveal="scale"] { transform: scale(0.95); }
[data-reveal="scale"].is-visible { transform: scale(1); }

/* Stagger children */
.stagger-children > * {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.stagger-children.is-visible > * {
  opacity: 1;
  transform: translateY(0);
}

.stagger-children.is-visible > *:nth-child(1) { transition-delay: 0.04s; }
.stagger-children.is-visible > *:nth-child(2) { transition-delay: 0.08s; }
.stagger-children.is-visible > *:nth-child(3) { transition-delay: 0.12s; }
.stagger-children.is-visible > *:nth-child(4) { transition-delay: 0.16s; }
.stagger-children.is-visible > *:nth-child(5) { transition-delay: 0.2s; }
.stagger-children.is-visible > *:nth-child(6) { transition-delay: 0.24s; }
.stagger-children.is-visible > *:nth-child(7) { transition-delay: 0.28s; }
.stagger-children.is-visible > *:nth-child(8) { transition-delay: 0.32s; }

/* ── Cards & interactive ── */
.card,
.stat-card-v2,
.menu-item-card,
.faq-item-card,
.panel-content-card,
.auth-card,
.wizard-card,
.plan-card,
.price-card,
.feature-card,
.integration-card {
  transition:
    transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.25s ease,
    box-shadow 0.25s ease;
}

.card:hover,
.menu-item-card:hover,
.faq-item-card:hover,
.panel-content-card:hover,
.plan-card:hover {
  transform: translateY(-3px);
}

.stat-card-v2:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 50px rgba(37, 211, 102, 0.15);
}

/* Landing feature cards */
.feature-card:hover {
  transform: translateY(-10px) scale(1.02);
  box-shadow: 0 24px 60px rgba(37, 211, 102, 0.18);
}

.price-card:hover {
  transform: translateY(-4px);
}

.price-card.featured {
  animation: ab-pulse-glow 3s ease-in-out infinite;
}

/* ── Buttons ── */
.btn {
  position: relative;
  overflow: hidden;
  transition:
    transform 0.2s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn-primary:hover,
.btn-green:hover {
  box-shadow: 0 6px 24px rgba(37, 211, 102, 0.3);
}

.btn .btn-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  width: 40px;
  height: 40px;
  margin-top: -20px;
  margin-left: -20px;
  animation: ab-ripple 0.55s ease-out;
  pointer-events: none;
}

/* ── Nav & tabs ── */
.panel-nav-item {
  transition:
    background 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.panel-nav-item:hover:not(.active) {
  transform: translateX(3px);
}

.panel-nav-item.active {
  animation: ab-slide-in-left 0.3s ease;
}

.tab-panel.active {
  animation: ab-tab-in 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.filter-chip {
  transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.filter-chip:hover {
  transform: translateY(-1px);
}

.filter-chip.active {
  animation: ab-scale-in 0.25s ease;
}

/* ── Modals ── */
.modal-overlay {
  animation: ab-overlay-in 0.25s ease;
}

.modal-overlay.show .modal {
  animation: ab-modal-in 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ── Tables ── */
.panel-app tbody tr {
  transition: background 0.15s ease;
}

.panel-app tbody tr:hover td {
  background: rgba(37, 211, 102, 0.04);
}

/* ── Forms ── */
.form-group input,
.form-group textarea,
.form-group select,
.business-select {
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.15s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.15);
}

/* ── Wizard ── */
.wizard-panel {
  animation: ab-fade-up 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.wizard-step-indicator.done .step-circle {
  animation: ab-step-pop 0.45s ease;
}

.wizard-step-indicator.active .step-circle {
  animation: ab-pulse-glow 2s ease-in-out infinite;
}

/* ── Loading shimmer ── */
.loading,
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-elevated, #151f1b) 25%,
    rgba(37, 211, 102, 0.06) 50%,
    var(--bg-elevated, #151f1b) 75%
  );
  background-size: 200% 100%;
  animation: ab-shimmer 1.5s ease-in-out infinite;
  border-radius: 8px;
}

/* ── Alerts & toasts ── */
.alert {
  animation: ab-fade-up 0.35s ease;
}

.pending-action-toast {
  animation: ab-slide-in-right 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ── Hero landing ── */
.hero-content {
  animation: ab-fade-up 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both;
}

.hero-visual {
  animation: ab-fade-up 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.25s both;
}

.hero-badge {
  animation: ab-float 4s ease-in-out infinite;
}

/* ── Success / icons ── */
.success-pop {
  animation: ab-success-pop 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.spinner-ring {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border, #1f3028);
  border-top-color: var(--wa-green, #25D366);
  border-radius: 50%;
  animation: ab-spin 0.75s linear infinite;
}

/* ── Table rows stagger ── */
.panel-app tbody tr {
  animation: ab-fade-in 0.3s ease both;
}

.panel-app tbody tr:nth-child(1) { animation-delay: 0.02s; }
.panel-app tbody tr:nth-child(2) { animation-delay: 0.04s; }
.panel-app tbody tr:nth-child(3) { animation-delay: 0.06s; }
.panel-app tbody tr:nth-child(4) { animation-delay: 0.08s; }
.panel-app tbody tr:nth-child(5) { animation-delay: 0.1s; }

/* ── Integration cards ── */
.integration-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--wa-green) 35%, var(--border));
}

/* ── Upgrade plan cards (tailwind compat) ── */
.plan-card-animated {
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s ease;
}

.plan-card-animated:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow: 0 20px 50px rgba(37, 211, 102, 0.12);
}

/* ── Toggle switch motion ── */
.toggle-slider::before {
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), background 0.2s ease !important;
}

/* ── Badge pop ── */
.pending-actions-badge,
.nav-badge,
.tab-count-badge {
  animation: ab-scale-in 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
