/* Stage 4a — micro-interactions (~150–300ms). Local CSS only; no animation libs.
   Complements styles.css. Respects prefers-reduced-motion (also in styles.css). */

/* ---------- Buttons: hover soft + active press ---------- */
.btn {
  transition:
    background-color .18s ease,
    color .18s ease,
    border-color .18s ease,
    box-shadow .18s ease,
    transform .15s ease;
}
.btn:hover {
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(0) scale(0.97);
}
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* Do not block clicks during motion */
.btn,
.btn * {
  pointer-events: auto;
}

/* ---------- Theme / language toggles ---------- */
.theme-toggle,
.lang,
.menu-toggle {
  transition:
    background-color .18s ease,
    color .18s ease,
    border-color .18s ease,
    transform .15s ease,
    box-shadow .2s ease;
}
.theme-toggle:hover,
.lang:hover,
.menu-toggle:hover {
  transform: translateY(-1px);
}
.theme-toggle:active,
.lang:active,
.menu-toggle:active {
  transform: scale(0.94);
}
.theme-toggle.is-pressed,
.lang.is-pressed,
.header-account.is-pressed {
  transform: scale(0.94);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent);
}
/* Brief theme-switch cue on the control (not blocking) */
.theme-toggle.anim-pop {
  animation: motion-pop .22s ease;
}
html.theme-flash {
  animation: motion-theme-flash .28s ease;
}
.lang-dropdown button,
.lang-dropdown a,
.account-dropdown button,
.account-dropdown a {
  transition: background-color .15s ease, transform .12s ease;
}
.lang-dropdown button:active,
.lang-dropdown a:active,
.account-dropdown button:active,
.account-dropdown a:active {
  transform: scale(0.98);
}
.lang-dropdown button.is-pressed {
  transform: scale(0.97);
  background: var(--sand);
}

/* ---------- Cards & catalog rows ---------- */
.card-link {
  transition:
    transform .2s ease,
    box-shadow .2s ease,
    border-color .2s ease,
    background-color .2s ease;
}
.card-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px -18px rgba(21, 23, 28, 0.28);
}
.card-link:active {
  transform: translateY(0) scale(0.99);
}
html[data-theme="dark"] .card-link:hover {
  box-shadow: 0 16px 36px -16px rgba(0, 0, 0, 0.55);
}

.price-table tbody tr[data-country],
.data-table tbody tr {
  transition: background-color .18s ease, box-shadow .18s ease;
}
.price-table tbody tr[data-country]:hover,
.data-table tbody tr:hover {
  background: var(--sand);
}
.data-table tbody tr.table-status:hover {
  background: transparent;
}
.price-table tbody tr[data-country]:active,
.data-table tbody tr:active {
  background: color-mix(in srgb, var(--sand) 80%, var(--accent) 8%);
}

/* ---------- Copy feedback ---------- */
[data-copy] {
  position: relative;
  transition:
    background-color .18s ease,
    color .18s ease,
    border-color .18s ease,
    transform .15s ease,
    box-shadow .2s ease;
}
[data-copy].is-copied,
[data-copy].anim-pop {
  animation: motion-pop .24s ease;
  border-color: var(--ok);
  color: var(--ok);
  background: var(--ok-bg);
}

/* ---------- Badges, alerts, status ---------- */
.badge,
.status-pill {
  transition: background-color .2s ease, color .2s ease, transform .2s ease;
  animation: motion-fade-in .22s ease both;
}
.badge-ok,
.status-available {
  animation: motion-status-ok .28s ease both;
}
.alert,
.state-box {
  animation: motion-slide-in .28s ease both;
}

/* ---------- SMS list enter ---------- */
.sms-item {
  animation: motion-sms-enter .28s ease both;
  transition: border-color .2s ease, background-color .2s ease, transform .15s ease;
}
.sms-item:hover {
  transform: translateY(-1px);
}

/* ---------- Panels / fragment swaps ---------- */
.panel,
.app-main > .panel,
.table-wrap {
  animation: motion-fade-in .24s ease both;
}
.auth-card {
  animation: motion-auth-enter .36s cubic-bezier(.22, 1, .36, 1) both;
}
/* HTMX/fragment hook: mark swapped nodes with .anim-enter */
.anim-enter {
  animation: motion-fade-in .25s ease both;
}

/* ---------- App nav soft press ---------- */
.app-nav a,
.app-nav-signout {
  transition: background-color .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .12s ease;
}
.app-nav a:active,
.app-nav-signout:active {
  transform: scale(0.98);
}
.pagination a {
  transition: border-color .15s ease, background-color .15s ease, transform .12s ease;
}
.pagination a:active {
  transform: scale(0.96);
}

/* ---------- Keyframes ---------- */
@keyframes motion-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.06); }
  100% { transform: scale(1); }
}
@keyframes motion-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes motion-slide-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes motion-auth-enter {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes motion-sms-enter {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes motion-status-ok {
  0% { opacity: 0; transform: scale(0.92); }
  60% { transform: scale(1.04); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes motion-theme-flash {
  0% { filter: brightness(1); }
  35% { filter: brightness(1.04); }
  100% { filter: brightness(1); }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  .btn:hover,
  .btn:active,
  .card:hover,
  .card:active,
  .card-link:hover,
  .card-link:active,
  .theme-toggle:hover,
  .theme-toggle:active,
  .lang:hover,
  .lang:active,
  .sms-item:hover {
    transform: none;
  }
}
