/* ═══════════════════════════════════════════════════════════════
   diaspora.ro — Skeleton Loading + Micro-animații (Step 20)
   Shimmer effect, card skeletons, spring physics helpers
   ═══════════════════════════════════════════════════════════════ */

/* ── Keyframes ──────────────────────────────────────────────── */
@keyframes dpr-shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}
@keyframes dpr-like-bounce {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.4); }
  60%  { transform: scale(0.9); }
  80%  { transform: scale(1.12); }
  100% { transform: scale(1); }
}
@keyframes dpr-confetti-fly {
  0%   { opacity: 1; transform: translateY(0) rotate(0deg) scale(1); }
  100% { opacity: 0; transform: translateY(-60px) rotate(360deg) scale(0.4); }
}
@keyframes dpr-celebrate-pop {
  0%   { opacity: 0; transform: scale(0.5) translateY(8px); }
  60%  { opacity: 1; transform: scale(1.1) translateY(-2px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes dpr-offline-slide-in {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}
@keyframes dpr-toast-in {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}
@keyframes dpr-toast-out {
  from { opacity: 1; transform: translateY(0)    scale(1); }
  to   { opacity: 0; transform: translateY(-8px) scale(0.96); }
}
@keyframes dpr-ptr-spin {
  to { transform: rotate(360deg); }
}

/* ── Baza skeleton ───────────────────────────────────────────── */
.dpr-skel {
  background: linear-gradient(
    90deg,
    var(--skel-base, #e0e0e0) 25%,
    var(--skel-shine, #ebebeb) 37%,
    var(--skel-base, #e0e0e0) 63%
  );
  background-size: 600px 100%;
  animation: dpr-shimmer 1.4s ease-in-out infinite;
  border-radius: 4px;
}
[data-theme="dark"] .dpr-skel {
  --skel-base:  #2a2a3a;
  --skel-shine: #363650;
}

/* ── Skeleton: Post Card ─────────────────────────────────────── */
.dpr-skel-post {
  background: var(--card, #fff);
  border-bottom: 8px solid var(--bg, #f0f2f5);
  padding: 14px;
}
.dpr-skel-post-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.dpr-skel-av {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dpr-skel-post-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dpr-skel-name {
  height: 13px;
  width: 55%;
  border-radius: 6px;
}
.dpr-skel-sub {
  height: 10px;
  width: 35%;
  border-radius: 6px;
}
.dpr-skel-body-line {
  height: 13px;
  border-radius: 6px;
  margin-bottom: 7px;
}
.dpr-skel-body-line:last-child { width: 70%; margin-bottom: 0; }
.dpr-skel-img {
  width: 100%;
  height: 220px;
  border-radius: 8px;
  margin: 10px 0;
}
.dpr-skel-post-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  border-top: 1px solid var(--border, #e4e6ea);
  padding-top: 10px;
}
.dpr-skel-act {
  flex: 1;
  height: 32px;
  border-radius: 8px;
}

/* ── Skeleton: Story Ring ────────────────────────────────────── */
.dpr-skel-stories {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  background: var(--card, #fff);
  border-bottom: 8px solid var(--bg, #f0f2f5);
  overflow: hidden;
}
.dpr-skel-story {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.dpr-skel-story-ring {
  width: 64px;
  height: 64px;
  border-radius: 50%;
}
.dpr-skel-story-label {
  width: 48px;
  height: 9px;
  border-radius: 5px;
}

/* ── Skeleton: Profil Hero ───────────────────────────────────── */
.dpr-skel-profil {
  background: var(--card, #fff);
}
.dpr-skel-cover {
  width: 100%;
  height: 160px;
  border-radius: 0;
}
.dpr-skel-profil-body {
  padding: 56px 16px 16px;
}
.dpr-skel-profil-av {
  position: absolute;
  bottom: -36px;
  left: 16px;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 3px solid var(--card, #fff);
}
.dpr-skel-profil-name {
  height: 20px;
  width: 48%;
  border-radius: 8px;
  margin-bottom: 8px;
}
.dpr-skel-profil-bio {
  height: 12px;
  width: 72%;
  border-radius: 6px;
  margin-bottom: 16px;
}
.dpr-skel-profil-stats {
  display: flex;
  gap: 20px;
}
.dpr-skel-stat {
  width: 56px;
  height: 32px;
  border-radius: 8px;
}

/* ── Skeleton: Chat Item ─────────────────────────────────────── */
.dpr-skel-chat {
  background: var(--card, #fff);
  border-bottom: 1px solid var(--border, #e4e6ea);
  padding: 12px 14px;
}
.dpr-skel-chat-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.dpr-skel-chat-av {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dpr-skel-chat-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.dpr-skel-chat-name {
  height: 13px;
  width: 45%;
  border-radius: 6px;
}
.dpr-skel-chat-preview {
  height: 11px;
  width: 72%;
  border-radius: 5px;
}
.dpr-skel-chat-time {
  width: 32px;
  height: 10px;
  border-radius: 5px;
  align-self: flex-start;
}

/* ── Skeleton: Group Card ────────────────────────────────────── */
.dpr-skel-group {
  background: var(--card, #fff);
  border-radius: 12px;
  padding: 14px;
  border: 1px solid var(--border, #e4e6ea);
}
.dpr-skel-group-img {
  width: 100%;
  height: 120px;
  border-radius: 8px;
  margin-bottom: 10px;
}
.dpr-skel-group-name {
  height: 15px;
  width: 60%;
  border-radius: 6px;
  margin-bottom: 7px;
}
.dpr-skel-group-meta {
  height: 11px;
  width: 40%;
  border-radius: 5px;
  margin-bottom: 12px;
}
.dpr-skel-group-btn {
  height: 36px;
  border-radius: 18px;
  width: 100%;
}

/* ── Like bounce ─────────────────────────────────────────────── */
.dpr-like-bounce {
  animation: dpr-like-bounce 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ── Confetti particule ──────────────────────────────────────── */
.dpr-confetti-particle {
  position: fixed;
  pointer-events: none;
  z-index: 99999;
  font-size: 16px;
  animation: dpr-confetti-fly 0.8s ease-out forwards;
}

/* ── Celebrate toast ─────────────────────────────────────────── */
.dpr-celebrate {
  animation: dpr-celebrate-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ── Offline indicator ───────────────────────────────────────── */
#dpr-offline-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 99998;
  background: #e41e3f;
  color: #fff;
  font: 600 13px/1 -apple-system, BlinkMacSystemFont, sans-serif;
  padding: 10px 16px;
  display: none;
  align-items: center;
  gap: 8px;
  animation: dpr-offline-slide-in 0.25s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
#dpr-offline-bar.visible { display: flex; }
#dpr-offline-bar svg { width: 16px; height: 16px; flex-shrink: 0; }
#dpr-offline-bar span { flex: 1; }
#dpr-offline-bar small { font-weight: 400; font-size: 11px; opacity: 0.85; }

/* ── Toast Stack (Step 20 — nu duplica daca exista) ─────────── */
#dpr-toast-stack {
  position: fixed;
  bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 99997;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: min(360px, 92vw);
}
.dpr-toast-msg {
  background: #1c1c2e;
  color: #fff;
  font: 500 13px/1.4 -apple-system, BlinkMacSystemFont, sans-serif;
  padding: 10px 16px;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 200px;
  max-width: 100%;
  animation: dpr-toast-in 0.25s ease forwards;
}
.dpr-toast-msg.success { border-left: 4px solid #42b72a; }
.dpr-toast-msg.error   { border-left: 4px solid #e41e3f; }
.dpr-toast-msg.info    { border-left: 4px solid #1877f2; }
.dpr-toast-msg.out     { animation: dpr-toast-out 0.2s ease forwards; }
.dpr-toast-close {
  background: none; border: none; color: rgba(255,255,255,0.6);
  font-size: 16px; cursor: pointer; padding: 0 0 0 6px;
  pointer-events: auto; line-height: 1;
}

/* ── Pull-to-refresh indicator ───────────────────────────────── */
#dpr-ptr {
  position: fixed;
  top: calc(var(--safe-top, 0px) + 56px);
  left: 50%;
  transform: translateX(-50%) translateY(-60px);
  z-index: 9990;
  width: 40px;
  height: 40px;
  background: var(--card, #fff);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.18);
  transition: transform 0.2s ease, opacity 0.2s ease;
  opacity: 0;
  pointer-events: none;
}
#dpr-ptr.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
#dpr-ptr.spinning svg {
  animation: dpr-ptr-spin 0.7s linear infinite;
}
#dpr-ptr svg {
  width: 20px; height: 20px;
  stroke: var(--brand, #7c3aed);
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
}

/* ── Spring physics helper ────────────────────────────────────── */
.dpr-spring-open {
  animation: dpr-celebrate-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ── Reduce motion ───────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .dpr-skel,
  .dpr-like-bounce,
  .dpr-confetti-particle,
  .dpr-celebrate,
  .dpr-spring-open,
  #dpr-ptr svg {
    animation: none !important;
    transition: none !important;
  }
}
