/* ── ClawPad PWA — Animations & Transitions ──────────────────────── */

/* ── Page Transitions ─────────────────────────────────────────────── */
.page-enter {
  animation: pageSlideIn 0.28s cubic-bezier(0.4, 0, 0.2, 1) both;
}
.page-enter-back {
  animation: pageSlideBack 0.24s cubic-bezier(0.4, 0, 0.2, 1) both;
}
@keyframes pageSlideIn {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes pageSlideBack {
  from { opacity: 0; transform: translateX(-30px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Fade In ──────────────────────────────────────────────────────── */
.fade-in {
  animation: fadeIn 0.3s ease both;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Skeleton Shimmer ─────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface) 25%,
    var(--hover-bg, rgba(255,255,255,0.06)) 50%,
    var(--surface) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
  border-radius: 8px;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-line {
  height: 14px;
  margin-bottom: 8px;
  border-radius: 6px;
}
.skeleton-line.short { width: 45%; }
.skeleton-line.medium { width: 70%; }
.skeleton-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
}
.skeleton-card {
  height: 72px;
  margin: 0 16px 8px;
  border-radius: 12px;
}

/* ── Micro-interactions ───────────────────────────────────────────── */
.press-scale {
  transition: transform 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
.press-scale:active {
  transform: scale(0.96);
}

.press-dim {
  transition: opacity 0.12s ease;
}
.press-dim:active {
  opacity: 0.7;
}

/* ── List Stagger ─────────────────────────────────────────────────── */
.stagger-item {
  animation: fadeSlideUp 0.32s ease-out both;
}
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
/* Delay classes for stagger effect */
.stagger-item:nth-child(1)  { animation-delay: 0ms; }
.stagger-item:nth-child(2)  { animation-delay: 40ms; }
.stagger-item:nth-child(3)  { animation-delay: 80ms; }
.stagger-item:nth-child(4)  { animation-delay: 120ms; }
.stagger-item:nth-child(5)  { animation-delay: 160ms; }
.stagger-item:nth-child(6)  { animation-delay: 200ms; }
.stagger-item:nth-child(7)  { animation-delay: 240ms; }
.stagger-item:nth-child(8)  { animation-delay: 280ms; }
.stagger-item:nth-child(9)  { animation-delay: 320ms; }
.stagger-item:nth-child(10) { animation-delay: 360ms; }

/* ── Bottom Sheet ─────────────────────────────────────────────────── */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  z-index: 900;
  animation: fadeIn 0.2s ease both;
  -webkit-tap-highlight-color: transparent;
}
.sheet-container {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 901;
  background: var(--surface);
  border: 1px solid var(--glass-border, rgba(255,255,255,0.06));
  border-bottom: none;
  border-radius: var(--radius-xl, 20px) var(--radius-xl, 20px) 0 0;
  max-height: 85vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: sheetUp 0.32s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  padding-bottom: env(safe-area-inset-bottom, 0);
  box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.4);
}
@keyframes sheetUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.sheet-container.closing {
  animation: sheetDown 0.22s ease-in forwards;
}
@keyframes sheetDown {
  to { transform: translateY(100%); opacity: 0; }
}
.sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--ink-muted);
  border-radius: 2px;
  margin: 10px auto 0;
  opacity: 0.4;
}
.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px 8px;
}
.sheet-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.sheet-close {
  background: none;
  border: none;
  color: var(--ink-muted);
  padding: 8px;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.sheet-close:hover,
.sheet-close:active {
  color: var(--ink);
  background: var(--hover-bg);
}
.sheet-body {
  padding: 8px 20px 20px;
}
.sheet-actions {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 12px 16px;
}
.sheet-action {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 12px;
  background: none;
  border: none;
  color: var(--ink);
  font-size: 15px;
  border-radius: var(--radius-md, 10px);
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background 0.15s, transform 0.1s;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.sheet-action:active {
  background: var(--hover-bg);
  transform: scale(0.98);
}
.sheet-action .sheet-action-icon {
  color: var(--ink-soft);
  display: flex;
  align-items: center;
}
.sheet-action.danger {
  color: var(--danger, #E07878);
}
.sheet-action.danger .sheet-action-icon {
  color: var(--danger, #E07878);
}

/* ── Action Menu (context menu) ───────────────────────────────────── */
.action-menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 950;
  -webkit-tap-highlight-color: transparent;
}
.action-menu {
  position: fixed;
  z-index: 951;
  background: var(--glass-bg-heavy, var(--surface));
  -webkit-backdrop-filter: blur(var(--glass-blur, 16px));
  backdrop-filter: blur(var(--glass-blur, 16px));
  border: 1px solid var(--glass-border, var(--line));
  border-radius: var(--radius-lg, 14px);
  min-width: 180px;
  padding: 6px;
  box-shadow: var(--shadow-lg, 0 8px 32px rgba(0, 0, 0, 0.4));
  animation: menuPop 0.18s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  overflow: hidden;
}
@keyframes menuPop {
  from { opacity: 0; transform: scale(0.88); }
  to   { opacity: 1; transform: scale(1); }
}
.action-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: none;
  border: none;
  color: var(--ink);
  font-size: 14px;
  border-radius: var(--radius-md, 8px);
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background 0.12s, transform 0.1s;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.action-menu-item:active {
  background: var(--hover-bg);
  transform: scale(0.97);
}
.action-menu-item .ami-icon {
  color: var(--ink-soft);
  display: flex;
  align-items: center;
}
.action-menu-item.danger {
  color: var(--danger, #E07878);
}
.action-menu-item.danger .ami-icon {
  color: var(--danger, #E07878);
}

/* ── Typing Indicator ─────────────────────────────────────────────── */
.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
}
.typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink-muted);
  animation: typingBounce 1.4s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%           { transform: translateY(-6px); opacity: 1; }
}

/* ── Scroll-to-bottom FAB ─────────────────────────────────────────── */
.scroll-fab {
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--glass-bg, var(--surface));
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border, var(--line));
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-md, 0 2px 12px rgba(0, 0, 0, 0.3));
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s;
  z-index: 10;
  -webkit-tap-highlight-color: transparent;
}
.scroll-fab:active {
  background: var(--hover-bg);
  color: var(--ink);
  transform: scale(0.9);
}
.scroll-fab.hidden {
  transform: scale(0);
  opacity: 0;
  pointer-events: none;
}

/* ── Badge ────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 600;
  background: var(--gradient-brand, var(--brand));
  color: var(--ink-on-brand, #0B1020);
  animation: badgePop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 6px rgba(242, 201, 76, 0.4);
  animation: badgePop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes badgePop {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

/* ── Spinner (branded) ────────────────────────────────────────────── */
.spinner-branded {
  width: 24px;
  height: 24px;
  border: 2.5px solid rgba(242, 201, 76, 0.15);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Pull-to-Refresh ─────────────────────────────────────────────── */
.pull-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.pull-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
}

/* ── Swipe Action Reveal ─────────────────────────────────────────── */
.swipe-container {
  position: relative;
  overflow: hidden;
}
.swipe-content {
  position: relative;
  z-index: 1;
  background: var(--bg);
  transition: transform 0.2s ease;
}
.swipe-actions-left,
.swipe-actions-right {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
}
.swipe-actions-left {
  left: 0;
  justify-content: flex-start;
  padding-left: 16px;
  background: rgba(242, 201, 76, 0.2);
}
.swipe-actions-right {
  right: 0;
  justify-content: flex-end;
  padding-right: 16px;
  background: rgba(228, 92, 92, 0.15);
}
.swipe-action-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--brand);
  font-size: 20px;
}
.swipe-actions-right .swipe-action-icon {
  color: var(--danger);
}
