/* ============================================================
   Doni Proxy — Motion / Transitions Layer (v1.0)
   ============================================================
   Подключается ПОСЛЕ design-system.css и tailwind.min.css.
   Дополняет фирменные плавности, hover-state и анимации
   появления для модалок, чата, кнопок и карточек.
   prefers-reduced-motion → полностью отключает анимации.
   ============================================================ */

/* === Глобальная плавность для всех интерактивных контролов === */
a, button, .btn, [role="button"],
input, textarea, select,
.card, .tariff-card, .country-card,
.site-header-nav a, .site-footer-list a,
.auth-tab, .landing-modal-card, .landing-modal-close,
.tg-doni-primary, .tg-doni-ghost,
.dashboard-card, .me-card,
.chat-bubble, .chat-message {
  transition:
    color 220ms cubic-bezier(0.16, 1, 0.3, 1),
    background-color 220ms cubic-bezier(0.16, 1, 0.3, 1),
    border-color 220ms cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 280ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 220ms cubic-bezier(0.16, 1, 0.3, 1),
    opacity 220ms ease-out,
    filter 220ms ease-out;
}

/* === Кнопки: лёгкий lift + glow на hover === */
.btn:hover, button:hover:not(:disabled),
.tg-doni-primary:hover, .tg-doni-ghost:hover {
  transform: translateY(-1px);
}
.btn:active, button:active:not(:disabled),
.tg-doni-primary:active, .tg-doni-ghost:active {
  transform: translateY(0) scale(0.98);
  transition-duration: 100ms;
}

/* === Карточки: subtle lift на hover === */
.card:hover, .tariff-card:hover, .country-card:hover,
.dashboard-card:hover, .me-card:hover {
  transform: translateY(-2px);
}

/* === Ссылки навигации: подчёркивание-glow === */
.site-header-nav a, .site-footer-list a {
  position: relative;
}
.site-header-nav a::after {
  content: '';
  position: absolute;
  left: 0; bottom: -4px;
  width: 100%; height: 1.5px;
  background: linear-gradient(90deg, transparent, var(--accent-cyan, #22d3ee), transparent);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 320ms cubic-bezier(0.16, 1, 0.3, 1);
}
.site-header-nav a:hover::after {
  transform: scaleX(1);
}

/* === МОДАЛКИ — плавное появление === */
@keyframes doni-modal-backdrop-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes doni-modal-card-in {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.landing-modal:not(.hidden) {
  animation: doni-modal-backdrop-in 200ms ease-out;
}
.landing-modal:not(.hidden) .landing-modal-card,
.modal:not(.hidden) .modal-content,
.tg-doni-modal:not(.hidden) .tg-doni-modal-card {
  animation: doni-modal-card-in 280ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* === ЧАТ-ВИДЖЕТ — slide-in из правого нижнего угла === */
@keyframes doni-chat-popup-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
    transform-origin: bottom right;
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@keyframes doni-chat-popup-out {
  from { opacity: 1; transform: translateY(0)    scale(1); }
  to   { opacity: 0; transform: translateY(16px) scale(0.96); }
}

#doni-chat-widget-panel:not([hidden]),
.doni-chat-widget-panel:not([hidden]),
.chat-widget-popup.open,
.chat-widget-container.open {
  animation: doni-chat-popup-in 280ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* === Сообщения чата — лёгкий fade-in при появлении === */
@keyframes doni-chat-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.chat-message, .chat-bubble {
  animation: doni-chat-msg-in 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* === FAB чата — мягкий hover + breathing pulse === */
@keyframes doni-fab-breathe {
  0%, 100% { box-shadow: 0 8px 24px -4px rgba(34, 211, 238, 0.35), 0 0 0 0 rgba(34, 211, 238, 0.4); }
  50%      { box-shadow: 0 8px 24px -4px rgba(34, 211, 238, 0.45), 0 0 0 8px rgba(34, 211, 238, 0); }
}
#doni-chat-fab, .doni-chat-fab, .chat-widget-fab {
  animation: doni-fab-breathe 2.6s ease-in-out infinite;
}
#doni-chat-fab:hover, .doni-chat-fab:hover, .chat-widget-fab:hover {
  transform: scale(1.08);
  animation-play-state: paused;
}

/* === Toast — slide-in сверху === */
@keyframes doni-toast-in {
  from { opacity: 0; transform: translate(-50%, -12px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
.toast { animation: doni-toast-in 240ms cubic-bezier(0.16, 1, 0.3, 1); }

/* === Smooth scroll для всех якорей === */
html { scroll-behavior: smooth; }

/* === Появление контента при загрузке (stagger) === */
@keyframes doni-section-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.section-animate-in {
  animation: doni-section-in 480ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* === Focus-ring глобально (а11y + красота) === */
*:focus-visible {
  outline: 2px solid var(--accent-cyan, #22d3ee);
  outline-offset: 2px;
  border-radius: 4px;
  transition: outline-offset 120ms ease-out;
}

/* === Skeleton-shimmer для loading-плейсхолдеров === */
@keyframes doni-skeleton {
  0%   { background-position: -200px 0; }
  100% { background-position: calc(200px + 100%) 0; }
}
.skeleton, .loading-skeleton {
  background: linear-gradient(90deg,
    rgba(255,255,255,0.04) 0%,
    rgba(255,255,255,0.08) 50%,
    rgba(255,255,255,0.04) 100%);
  background-size: 200px 100%;
  background-repeat: no-repeat;
  animation: doni-skeleton 1.4s ease-in-out infinite;
}

/* === a11y: уважаем prefers-reduced-motion === */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
