/* ==========================================================================
   rps-logistics — shared skeleton placeholders
   Drop-in shimmer blocks used to replace "Loading…" text nodes during the
   first paint of pages whose data arrives via fetch. All sizes are
   intentionally loose — wrap them in whatever grid/list container the
   real content will eventually fill, and the shimmer will inherit width.
   ========================================================================== */

.skeleton {
  /* --skeleton-base/-peak (style.css) are strong enough to read as
     "loading" on both themes; the surface colours they replace were
     1.1:1 on the dark canvas and looked like an empty page. */
  background: linear-gradient(90deg,
    var(--skeleton-base, #e9e6e1) 0%,
    var(--skeleton-peak, #f6f4f1) 50%,
    var(--skeleton-base, #e9e6e1) 100%);
  background-size: 200% 100%;
  animation: skel-shimmer 1.4s ease-in-out infinite;
  border-radius: 6px;
  display: block;
}

.skeleton-line       { height: 12px; margin: 8px 0; }
.skeleton-line.short { width: 40%; }
.skeleton-line.med   { width: 65%; }
.skeleton-line.long  { width: 90%; }
.skeleton-line.lg    { height: 22px; }
.skeleton-line.xl    { height: 32px; width: 50%; }

.skeleton-card {
  padding: 20px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  background: var(--surface, #fff);
}

.skeleton-row {
  display: flex; gap: 16px; align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border, #e2e8f0);
}
.skeleton-circle { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; }
.skeleton-row .skeleton-line { flex: 1; margin: 4px 0; }

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

@keyframes skel-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Respect users who've opted out of motion */
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
}

/* ---- Mobile toolkit: list + card placeholders ----------------------------
   Shape-matched stand-ins for the phone layouts, so content doesn't jump
   when data lands:

   <div class="skeleton-list" aria-busy="true" aria-label="Loading">
     <div class="skeleton-row"><span class="skeleton skeleton-circle"></span>
       <span class="skeleton-stack"><span class="skeleton skeleton-line med"></span>
       <span class="skeleton skeleton-line long"></span></span></div>
     …
   </div>

   <div class="skeleton-cards" aria-busy="true">      (card-view table rows)
     <div class="skeleton-card"><span class="skeleton skeleton-line lg med"></span>
       <span class="skeleton skeleton-line long"></span><span class="skeleton skeleton-line short"></span></div>
     …
   </div>
*/
.skeleton-list { display: flex; flex-direction: column; }
.skeleton-list .skeleton-row:last-child { border-bottom: 0; }
.skeleton-stack { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.skeleton-cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.skeleton-cards .skeleton-card { padding: 14px; border-radius: var(--radius-sm, 10px); }
@media (max-width: 640px) {
  .skeleton-cards { grid-template-columns: 1fr; }
  .skeleton-row { padding: 14px 16px; }
}

/* ---- Table row placeholders ----------------------------------------------
   rpsSkeletonRows(cols, rows) in app.js returns <tr class="skeleton-tr">
   rows for a <tbody>: a list that loads into a table keeps its columns
   instead of showing a card skeleton inside the table. */
.skeleton-tr td { padding: 14px; border-bottom: 1px solid var(--border, #e2e8f0); }
.skeleton-tr .skeleton { height: 12px; margin: 0; width: 70%; }
.skeleton-tr td:first-child .skeleton { width: 85%; }
.skeleton-tr td:nth-child(3n) .skeleton { width: 45%; }
.skeleton-tr td:nth-child(4n) .skeleton { width: 60%; }
.skeleton-tr:nth-child(even) .skeleton { width: 55%; }
@media (max-width: 640px) {
  /* Card-view tables: each placeholder row becomes a card-sized block. */
  .skeleton-tr { display: block; padding: 14px; margin-bottom: 10px; border: 1px solid var(--border); border-radius: var(--r-sm, 8px); background: var(--surface); }
  .skeleton-tr td { display: block; padding: 4px 0; border: 0; }
  .skeleton-tr td::before { display: none !important; }
}
