/* ══════════════════════════════════════════════════════
   SOLVIX — Loading & Animations Module
   Tela de splash, skeletons, transições e micro-animações
   ══════════════════════════════════════════════════════ */

/* ── Keyframes globais ──────────────────────────────── */
@keyframes spin       { to { transform: rotate(360deg); } }
@keyframes spinReverse{ to { transform: rotate(-360deg); } }
@keyframes pulse-ring { 0%,100%{transform:scale(.9);opacity:.6} 50%{transform:scale(1.1);opacity:1} }
@keyframes shimmer    { 0%{background-position:-600px 0} 100%{background-position:600px 0} }
@keyframes fadeIn     { from{opacity:0} to{opacity:1} }
@keyframes fadeUp     { from{opacity:0;transform:translateY(16px)} to{opacity:1;transform:translateY(0)} }
@keyframes fadeDown   { from{opacity:0;transform:translateY(-12px)} to{opacity:1;transform:translateY(0)} }
@keyframes scaleIn    { from{opacity:0;transform:scale(.92)} to{opacity:1;transform:scale(1)} }
@keyframes slideRight { from{transform:translateX(-100%)} to{transform:translateX(0)} }
@keyframes float      { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-6px)} }
@keyframes glow-pulse { 0%,100%{box-shadow:0 0 12px rgba(212,160,23,.3)} 50%{box-shadow:0 0 32px rgba(212,160,23,.7)} }
@keyframes orbit      {
  0%  { transform: rotate(0deg)   translateX(28px) rotate(0deg); }
  100%{ transform: rotate(360deg) translateX(28px) rotate(-360deg); }
}
@keyframes progress-bar {
  0%   { width: 0%; }
  30%  { width: 45%; }
  60%  { width: 72%; }
  85%  { width: 88%; }
  100% { width: 100%; }
}

/* ══ SPLASH SCREEN ══════════════════════════════════════
   Exibida no primeiro carregamento do app
   ═════════════════════════════════════════════════════ */
#splash-screen {
  position: fixed; inset: 0; z-index: 99999;
  background: #080808;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 0;
  transition: opacity .5s ease, visibility .5s ease;
}
#splash-screen.hiding {
  opacity: 0; visibility: hidden; pointer-events: none;
}

.splash-logo-wrap {
  position: relative;
  width: 120px; height: 120px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 32px;
  animation: float 3s ease-in-out infinite;
}

/* Anel externo girando */
.splash-ring-outer {
  position: absolute; inset: 0;
  border: 2px solid transparent;
  border-top-color: #D4A017;
  border-right-color: rgba(212,160,23,.3);
  border-radius: 50%;
  animation: spin 1.4s linear infinite;
}

/* Anel interno girando ao contrário */
.splash-ring-inner {
  position: absolute; inset: 14px;
  border: 2px solid transparent;
  border-bottom-color: #FFD700;
  border-left-color: rgba(255,215,0,.3);
  border-radius: 50%;
  animation: spinReverse 1s linear infinite;
}

/* Ponto orbitando */
.splash-orbit {
  position: absolute; inset: 0;
  animation: spin 2s linear infinite;
}
.splash-orbit::after {
  content: '';
  position: absolute; top: 4px; left: 50%;
  width: 8px; height: 8px;
  background: #D4A017;
  border-radius: 50%;
  transform: translateX(-50%);
  box-shadow: 0 0 10px #D4A017;
}

/* Logo no centro */
.splash-icon {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 36px; letter-spacing: 3px;
  background: linear-gradient(135deg, #D4A017, #FFD700);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative; z-index: 1;
}

.splash-brand {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 42px; letter-spacing: 8px;
  background: linear-gradient(135deg, #888, #fff, #888);
  background-size: 200% auto;
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 2s linear infinite;
  margin-bottom: 6px;
}

.splash-tagline {
  font-family: 'Outfit', sans-serif;
  font-size: 11px; letter-spacing: 4px;
  color: #444; text-transform: uppercase;
  margin-bottom: 48px;
}

/* Barra de progresso */
.splash-progress-track {
  width: 200px; height: 2px;
  background: rgba(255,255,255,.06);
  border-radius: 2px; overflow: hidden;
  margin-bottom: 16px;
}
.splash-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #8B6914, #D4A017, #FFD700);
  border-radius: 2px;
  animation: progress-bar 2.2s ease-out forwards;
  box-shadow: 0 0 8px rgba(212,160,23,.6);
}

.splash-status {
  font-family: 'Outfit', sans-serif;
  font-size: 11px; color: #333;
  letter-spacing: 1px;
  min-height: 16px;
  transition: opacity .3s;
}

/* ══ LOADING OVERLAY (ações) ════════════════════════════
   Usado pelo showLoading() durante operações
   ═════════════════════════════════════════════════════ */
#loading-overlay {
  position: fixed; inset: 0; z-index: 9998;
  background: rgba(8,8,8,.82);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 20px;
  animation: fadeIn .2s ease;
}

.loading-spinner-wrap {
  position: relative; width: 64px; height: 64px;
  display: flex; align-items: center; justify-content: center;
}
.loading-ring-1 {
  position: absolute; inset: 0;
  border: 3px solid rgba(212,160,23,.15);
  border-top-color: #D4A017;
  border-radius: 50%;
  animation: spin .9s linear infinite;
}
.loading-ring-2 {
  position: absolute; inset: 8px;
  border: 2px solid rgba(212,160,23,.1);
  border-bottom-color: #FFD700;
  border-radius: 50%;
  animation: spinReverse .7s linear infinite;
}
.loading-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #D4A017;
  box-shadow: 0 0 10px #D4A017;
  animation: pulse-ring 1s ease-in-out infinite;
}

.loading-text {
  font-family: 'Outfit', sans-serif;
  font-size: 14px; font-weight: 600;
  color: #e8e0d0; letter-spacing: .5px;
}
.loading-dots::after {
  content: '';
  animation: loading-ellipsis 1.4s infinite;
}
@keyframes loading-ellipsis {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
  100% { content: ''; }
}

/* ══ SKELETON LOADING ═══════════════════════════════════
   Placeholder animado enquanto dados carregam
   ═════════════════════════════════════════════════════ */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255,255,255,.04) 0%,
    rgba(255,255,255,.08) 40%,
    rgba(255,255,255,.04) 80%
  );
  background-size: 600px 100%;
  animation: shimmer 1.6s ease-in-out infinite;
  border-radius: 6px;
}
.skeleton-text  { height: 14px; margin-bottom: 8px; border-radius: 4px; }
.skeleton-title { height: 22px; width: 60%; margin-bottom: 12px; border-radius: 4px; }
.skeleton-card  { height: 80px; border-radius: 10px; margin-bottom: 10px; }
.skeleton-row   { height: 44px; border-radius: 6px; margin-bottom: 4px; }
.skeleton-btn   { height: 40px; width: 120px; border-radius: 6px; }

/* Skeleton para cards do dashboard */
.skeleton-dash-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px; margin-bottom: 16px;
}
.skeleton-dash-cards .skeleton-card { height: 88px; }

/* ══ TRANSIÇÕES DE ABA ══════════════════════════════════ */
.tab-content {
  animation: fadeUp .3s ease both;
}

/* ══ MICRO-ANIMAÇÕES ════════════════════════════════════ */

/* Cards aparecem em cascata */
.card-anim {
  animation: fadeUp .4s ease both;
}
.card-anim:nth-child(1) { animation-delay: .05s; }
.card-anim:nth-child(2) { animation-delay: .10s; }
.card-anim:nth-child(3) { animation-delay: .15s; }
.card-anim:nth-child(4) { animation-delay: .20s; }
.card-anim:nth-child(5) { animation-delay: .25s; }

/* Modais */
.modal {
  animation: scaleIn .25s cubic-bezier(.34,1.56,.64,1) both;
}

/* Botões com feedback */
.btn-p:active, .btn-sm:active, .nav-cta:active {
  transform: scale(.97);
}

/* Toast */
.toast {
  animation: slideUp .35s cubic-bezier(.34,1.56,.64,1);
}
@keyframes slideUp {
  from { transform: translateY(80px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* Rows de tabela */
.dt tbody tr {
  transition: background .15s ease;
}

/* Badges pulsantes para alertas */
.badge-alert {
  animation: glow-pulse 2s ease-in-out infinite;
}

/* Pipeline dot atual */
.pip-dot.atual {
  animation: pulse-ring 1.5s ease-in-out infinite;
}

/* ══ MODO CLARO — ajustes de skeleton ═══════════════════ */
body.light-mode .skeleton {
  background: linear-gradient(
    90deg,
    rgba(0,0,0,.04) 0%,
    rgba(0,0,0,.08) 40%,
    rgba(0,0,0,.04) 80%
  );
  background-size: 600px 100%;
}

@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}
