/* ============================================
   SKELETON LOADING SCREENS — Premium Shimmer
   ============================================ */

/* Base shimmer animation */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

/* Skeleton base element */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(var(--color-slate-900-rgb, 19, 52, 59), 0.06) 25%,
    rgba(var(--color-slate-900-rgb, 19, 52, 59), 0.12) 50%,
    rgba(var(--color-slate-900-rgb, 19, 52, 59), 0.06) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.8s infinite ease-in-out;
  border-radius: var(--radius-base, 8px);
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  border-radius: 4px;
}

.skeleton-text.short  { width: 40%; }
.skeleton-text.medium { width: 65%; }
.skeleton-text.long   { width: 90%; }

.skeleton-title {
  height: 22px;
  width: 50%;
  margin-bottom: 12px;
  border-radius: 6px;
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
}

.skeleton-card {
  padding: 20px;
  border-radius: var(--radius-lg, 12px);
  border: 1px solid rgba(var(--color-brown-600-rgb, 94,82,64), 0.08);
  background: var(--color-surface, #fffffe);
}

.skeleton-card .skeleton-value {
  height: 32px;
  width: 60%;
  margin: 12px 0 8px;
  border-radius: 6px;
}

.skeleton-chart {
  height: 260px;
  border-radius: var(--radius-lg, 12px);
  margin-top: 16px;
}

.skeleton-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(0,0,0,0.04);
}

.skeleton-row:last-child { border-bottom: none; }

/* Skeleton grid templates */
.skeleton-grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.skeleton-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ============================================
   SECTION TRANSITIONS
   ============================================ */

/* Smooth section switch */
.content-section {
  animation: fadeInUp 0.35s var(--ease-standard, cubic-bezier(0.16, 1, 0.3, 1)) both;
}

.content-section[style*="display: none"] {
  animation: none;
}

/* Cards and items entrance animation */
.metric-card,
.kpi-tile,
.chart-card,
.rota-item,
.top-cliente-item {
  animation: fadeInUp 0.4s var(--ease-standard) both;
}

/* Stagger children for a cascading effect */
.metric-card:nth-child(1), .kpi-tile:nth-child(1) { animation-delay: 0ms; }
.metric-card:nth-child(2), .kpi-tile:nth-child(2) { animation-delay: 60ms; }
.metric-card:nth-child(3), .kpi-tile:nth-child(3) { animation-delay: 120ms; }
.metric-card:nth-child(4), .kpi-tile:nth-child(4) { animation-delay: 180ms; }
.metric-card:nth-child(5), .kpi-tile:nth-child(5) { animation-delay: 240ms; }
.metric-card:nth-child(6), .kpi-tile:nth-child(6) { animation-delay: 300ms; }

/* Smooth chart entrance */
canvas {
  animation: fadeIn 0.5s ease both;
  animation-delay: 200ms;
}

/* Table row stagger */
.data-table tbody tr {
  animation: fadeInUp 0.3s ease both;
}
.data-table tbody tr:nth-child(1) { animation-delay: 0ms; }
.data-table tbody tr:nth-child(2) { animation-delay: 30ms; }
.data-table tbody tr:nth-child(3) { animation-delay: 60ms; }
.data-table tbody tr:nth-child(4) { animation-delay: 90ms; }
.data-table tbody tr:nth-child(5) { animation-delay: 120ms; }
.data-table tbody tr:nth-child(6) { animation-delay: 150ms; }
.data-table tbody tr:nth-child(7) { animation-delay: 180ms; }
.data-table tbody tr:nth-child(8) { animation-delay: 210ms; }
.data-table tbody tr:nth-child(9) { animation-delay: 240ms; }
.data-table tbody tr:nth-child(10) { animation-delay: 270ms; }

/* Hover micro-interactions */
.metric-card {
  transition: transform 0.2s var(--ease-standard), box-shadow 0.2s var(--ease-standard);
}
.metric-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg, 0 10px 15px -3px rgba(0,0,0,0.06));
}

/* Smooth scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(var(--color-slate-900-rgb, 19,52,59), 0.15);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--color-slate-900-rgb, 19,52,59), 0.25);
}

/* Button press micro-animation */
.btn:active:not(:disabled) {
  transform: scale(0.97);
  transition: transform 80ms ease;
}

/* Focus visible ring for accessibility */
:focus-visible {
  outline: 2px solid var(--color-primary, #218d8d);
  outline-offset: 2px;
}

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