/* ══════════════════════════════════════════════════════════════
   LastRound — Visual Interactions Layer
   Makes everything feel alive. Cards breathe, numbers count,
   elements enter with purpose, and every click has feedback.
   ══════════════════════════════════════════════════════════════ */

/* ── STAGGERED ENTRANCE ANIMATIONS ─────────────────────────── */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes popIn {
  0% { opacity: 0; transform: scale(0.6); }
  70% { transform: scale(1.05); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes countPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(var(--accent-rgb, 0, 232, 255), 0); }
  50% { box-shadow: 0 0 16px 4px rgba(var(--accent-rgb, 0, 232, 255), 0.15); }
}
@keyframes borderTrace {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes breathe {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}
@keyframes rippleEffect {
  0% { transform: scale(0); opacity: 0.5; }
  100% { transform: scale(4); opacity: 0; }
}
@keyframes tooltipIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes numberTick {
  0% { transform: translateY(100%); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

/* ── CARD HOVER EFFECTS ────────────────────────────────────── */
/* Universal interactive card: lift + glow + border highlight */
.card, .stat-card, .tool-card, .kpi-card,
.kanban-card, .attack-item, .feed-item,
.staff-shift-item, .coaching-item, .qw-item,
.timeline-item, .journal-entry, .venue-heat-row,
.fin-stat-row, .fin-payment, .cmd-result-item {
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.22s ease,
              border-color 0.22s ease,
              background 0.22s ease !important;
}

.card:hover, .tool-card:hover, .kanban-card:hover {
  transform: translateY(-4px) !important;
  box-shadow: 0 8px 30px rgba(0,0,0,0.25), 0 0 0 1px var(--accent-dim) !important;
}

.stat-card:hover, .kpi-card:hover {
  transform: translateY(-3px) scale(1.02) !important;
  box-shadow: 0 6px 24px rgba(0,0,0,0.2) !important;
}

.attack-item:hover, .qw-item:hover, .coaching-item:hover {
  transform: translateX(4px) !important;
  border-left: 3px solid var(--accent) !important;
  background: var(--surface2) !important;
}

.feed-item:hover, .staff-shift-item:hover,
.fin-stat-row:hover, .fin-payment:hover,
.venue-heat-row:hover {
  background: var(--surface2) !important;
  transform: translateX(3px) !important;
}

.timeline-item:hover {
  background: var(--surface2) !important;
  border-left-color: var(--accent) !important;
}

.journal-entry:hover {
  background: var(--surface2) !important;
  transform: translateY(-2px) !important;
}

.cmd-result-item:hover {
  background: var(--surface2) !important;
  transform: translateX(4px) !important;
}

/* ── BUTTON INTERACTIONS ───────────────────────────────────── */
.btn, .chip, .header-btn, .theme-btn, .btn-icon, button {
  transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
  position: relative;
  overflow: hidden;
}
.btn:hover, .chip:hover, .header-btn:hover {
  transform: translateY(-1px) scale(1.03);
}
.btn:active, .chip:active, .header-btn:active, .btn-icon:active, button:active {
  transform: scale(0.95) !important;
  transition-duration: 0.08s !important;
}

/* Ripple effect on click */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  animation: rippleEffect 0.6s ease-out forwards;
  pointer-events: none;
}

/* ── STAGGERED LIST ENTRANCE ───────────────────────────────── */
.animate-in {
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.animate-in-left {
  animation: slideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.animate-in-scale {
  animation: scaleIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.animate-in-pop {
  animation: popIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Auto-stagger children: each child delays by 60ms */
.stagger-children > *:nth-child(1) { animation-delay: 0ms; }
.stagger-children > *:nth-child(2) { animation-delay: 60ms; }
.stagger-children > *:nth-child(3) { animation-delay: 120ms; }
.stagger-children > *:nth-child(4) { animation-delay: 180ms; }
.stagger-children > *:nth-child(5) { animation-delay: 240ms; }
.stagger-children > *:nth-child(6) { animation-delay: 300ms; }
.stagger-children > *:nth-child(7) { animation-delay: 360ms; }
.stagger-children > *:nth-child(8) { animation-delay: 420ms; }
.stagger-children > *:nth-child(9) { animation-delay: 480ms; }
.stagger-children > *:nth-child(10) { animation-delay: 540ms; }
.stagger-children > *:nth-child(n+11) { animation-delay: 600ms; }

/* ── SKELETON LOADING ──────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface2) 25%, var(--surface3) 50%, var(--surface2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}
.skeleton-line {
  height: 14px;
  margin-bottom: 8px;
  border-radius: 4px;
}
.skeleton-line.short { width: 60%; }
.skeleton-line.medium { width: 80%; }
.skeleton-card {
  height: 80px;
  margin-bottom: 12px;
  border-radius: var(--radius, 8px);
}

/* ── ANIMATED COUNTERS ─────────────────────────────────────── */
.count-animate {
  display: inline-block;
  animation: countPulse 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── LIVE DATA INDICATORS ──────────────────────────────────── */
.live-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: breathe 2s ease-in-out infinite;
  margin-right: 6px;
  vertical-align: middle;
}

/* ── GLOW PULSE ON ACTIVE ELEMENTS ─────────────────────────── */
.glow-pulse {
  animation: glowPulse 2s ease-in-out infinite;
}

/* ── SMOOTH TAB TRANSITIONS ────────────────────────────────── */
.tab-content {
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.tab-btn {
  transition: all 0.2s ease !important;
  position: relative;
}
.tab-btn::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform: translateX(-50%);
  border-radius: 2px;
}
.tab-btn.active::after {
  width: 70%;
}
.tab-btn:hover {
  color: var(--accent) !important;
  transform: translateY(-1px);
}

/* ── PROGRESS BAR ANIMATIONS ──────────────────────────────── */
.workload-fill, .venue-heat-seg, .bar-fill {
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

/* ── DRAG & DROP FEEDBACK ──────────────────────────────────── */
.kanban-card.dragging {
  transform: rotate(2deg) scale(1.05) !important;
  box-shadow: 0 12px 40px rgba(0,0,0,0.35) !important;
  z-index: 100;
  opacity: 0.85 !important;
}
.kanban-cards.drag-over {
  background: rgba(var(--accent-rgb, 0, 232, 255), 0.05) !important;
  border: 2px dashed var(--accent) !important;
  border-radius: 8px;
}

/* ── INPUT FOCUS EFFECTS ───────────────────────────────────── */
input, select, textarea {
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s !important;
}
input:focus, select:focus, textarea:focus {
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb, 0, 232, 255), 0.15) !important;
  border-color: var(--accent) !important;
}

/* ── COMMAND BAR FOCUS ─────────────────────────────────────── */
.cmd-input-wrap:focus-within {
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb, 0, 232, 255), 0.12),
              0 4px 16px rgba(0,0,0,0.2) !important;
  transform: scale(1.01);
  transition: all 0.25s ease !important;
}

/* ── TOOLTIP ANIMATION ─────────────────────────────────────── */
[title]:hover::after {
  animation: tooltipIn 0.2s ease both;
}

/* ── BADGE / COUNT BOUNCE ──────────────────────────────────── */
.kanban-count, .badge-pin, .card-badge {
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}
.kanban-count.updated, .count-bounce {
  animation: popIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── MODAL ENTRANCE ────────────────────────────────────────── */
.modal, .modal-overlay, .modal-backdrop {
  animation: scaleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) both !important;
}

/* ── TOAST ENHANCEMENT ─────────────────────────────────────── */
.toast, [class*="toast"] {
  animation: slideDown 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both !important;
}

/* ── GRADIENT BORDER ON HOVER (featured cards) ─────────────── */
.card-featured:hover,
[id="card-mission-control"]:hover {
  background-image: linear-gradient(var(--surface), var(--surface)),
                    linear-gradient(135deg, var(--accent), var(--green, #00ff88), var(--accent)) !important;
  background-origin: border-box !important;
  background-clip: padding-box, border-box !important;
  border: 1px solid transparent !important;
}

/* ── THEME PREVIEW HOVER ───────────────────────────────────── */
.theme-preview, .theme-btn {
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.2s ease,
              border-color 0.2s ease !important;
}
.theme-preview:hover {
  transform: scale(1.08) !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3) !important;
}

/* ── CHART CANVAS HOVER ────────────────────────────────────── */
.chart-wrap:hover canvas {
  filter: brightness(1.1) saturate(1.1);
  transition: filter 0.3s ease;
}

/* ── SCROLL REVEAL (JS applies .revealed class) ────────────── */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal-on-scroll.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ── CYBERPUNK THEME EXTRAS ────────────────────────────────── */
:root[data-theme="cyberpunk"] .card:hover,
:root[data-theme="cyberpunk"] .kpi-card:hover,
:root[data-theme="cyberpunk"] .kanban-card:hover {
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.15),
              0 0 40px rgba(0, 240, 255, 0.05),
              0 8px 30px rgba(0,0,0,0.3) !important;
}
:root[data-theme="cyberpunk"] .btn-primary:hover,
:root[data-theme="cyberpunk"] .chip.active {
  text-shadow: 0 0 8px currentColor;
}
:root[data-theme="cyberpunk"] .header-logo {
  animation: breathe 3s ease-in-out infinite;
}
:root[data-theme="cyberpunk"] input:focus,
:root[data-theme="cyberpunk"] select:focus {
  box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.2),
              0 0 16px rgba(0, 240, 255, 0.1) !important;
}

/* ── NEON THEME EXTRAS ─────────────────────────────────────── */
:root[data-theme="neon"] .card:hover,
:root[data-theme="neon"] .kpi-card:hover {
  box-shadow: 0 0 20px rgba(0, 232, 144, 0.12),
              0 8px 30px rgba(0,0,0,0.3) !important;
}

/* ── ENHANCED FOCUS RING ON INTERACTIVE CARDS ─────────────── */
.card:focus-visible, .kpi-card:focus-visible, .kanban-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── STAT WIDGET HOVER ────────────────────────────────────── */
.stat-widget {
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.22s ease,
              border-color 0.22s ease !important;
}
.stat-widget:hover {
  transform: translateY(-3px) scale(1.02) !important;
  box-shadow: 0 6px 24px rgba(0,0,0,0.2) !important;
}

/* ── PROGRESS FILL ENTRANCE ──────────────────────────────── */
.workload-fill, .venue-heat-seg, .bar-fill, .rain-bar {
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

/* ── AVATAR HOVER ─────────────────────────────────────────── */
.staff-avatar {
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.2s ease !important;
}
.staff-avatar:hover {
  transform: scale(1.1) !important;
  box-shadow: 0 0 12px rgba(var(--accent-rgb, 0, 232, 255), 0.2) !important;
}

/* ── NUMBER TICK ON KPI CHANGE ────────────────────────────── */
.kpi-value {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

/* ── CHIP ACTIVE GLOW ─────────────────────────────────────── */
.chip.active {
  box-shadow: 0 0 8px rgba(var(--accent-rgb, 0, 232, 255), 0.2) !important;
}

/* ── STATUS DOT PULSE ─────────────────────────────────────── */
.status-dot.busy {
  animation: breathe 1.5s ease-in-out infinite;
}

/* ── DELEG-TASK CARD ANIMATION ────────────────────────────── */
.deleg-task {
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.22s ease,
              border-color 0.22s ease !important;
}
.deleg-task:hover {
  transform: translateX(4px) !important;
  border-left: 3px solid var(--accent) !important;
}

/* ── WEATHER HERO PULSE ───────────────────────────────────── */
.weather-hero .big-temp {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}
.weather-hero:hover .big-temp {
  transform: scale(1.05) !important;
}

/* ── SPORTS GAME ROW ──────────────────────────────────────── */
.sports-game {
  transition: transform 0.2s ease, background 0.2s ease !important;
}
.sports-game:hover {
  transform: translateX(3px) !important;
  background: var(--surface2) !important;
}

/* ── WW STAFF CHIP ────────────────────────────────────────── */
.ww-staff-chip {
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.2s ease !important;
}
.ww-staff-chip:hover {
  transform: scale(1.05) !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
}

/* ── SALES MODAL ROW ──────────────────────────────────────── */
.sales-modal-row {
  transition: transform 0.2s ease, background 0.2s ease !important;
}
.sales-modal-row:hover {
  transform: translateX(3px) !important;
  background: rgba(255,255,255,0.03) !important;
}

/* ── AGENT CARD SPECIAL ───────────────────────────────────── */
.agent-card {
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.22s ease !important;
}
.agent-card:hover {
  transform: translateY(-3px) scale(1.03) !important;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25) !important;
}

/* ── TIME BLOCK ACCORDION ─────────────────────────────────── */
.time-block {
  transition: transform 0.2s ease, background 0.2s ease,
              border-color 0.2s ease !important;
  cursor: pointer;
}
.time-block:hover {
  transform: translateX(3px) !important;
  background: var(--surface2) !important;
}

/* ── REDUCE MOTION (accessibility) ─────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── TOAST STUCK FIX ─────────────────────────────────────── */
/* Force toasts invisible when not showing — prevents stuck ghost rectangles */
.toast:not(.show) { opacity: 0 !important; visibility: hidden !important; pointer-events: none !important; }
.toast.show { visibility: visible !important; }
