/* ═══════════════════════════════════════════════════════════
   Stakgro UX Foundation — Empty States, Skeletons, Errors
   Include: <link rel="stylesheet" href="/js/ux-foundation.css">
   ═══════════════════════════════════════════════════════════ */

/* ─── CSS Variables (inherit from page or set defaults) ─── */
:root {
  --ux-gold: #C4A35A;
  --ux-gold-dim: rgba(196,163,90,0.12);
  --ux-gold-border: rgba(196,163,90,0.25);
  --ux-bg: #FAF8F5;
  --ux-surface: #FFFFFF;
  --ux-border: #E8E0D5;
  --ux-text: #2D2D2D;
  --ux-text-2: #5C5752;
  --ux-text-3: #9B9590;
  --ux-danger: #ef4444;
  --ux-success: #22c55e;
  --ux-radius: 12px;
}

/* ══════════════════════════════════════════════════════════
   EMPTY STATES
   ══════════════════════════════════════════════════════════ */
.sg-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 72px 24px;
  text-align: center;
  min-height: 300px;
}
.sg-empty-icon-wrap {
  width: 80px; height: 80px;
  background: var(--ux-gold-dim);
  border: 1.5px solid var(--ux-gold-border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
  margin-bottom: 24px;
  position: relative;
}
.sg-empty-icon-wrap::after {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 1px dashed var(--ux-gold-border);
}
.sg-empty-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--ux-text);
  margin-bottom: 10px;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.sg-empty-desc {
  font-size: 0.9rem;
  color: var(--ux-text-2);
  line-height: 1.65;
  max-width: 380px;
  margin-bottom: 28px;
}
.sg-empty-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--ux-gold);
  color: #fff;
  padding: 11px 24px;
  border-radius: 9px;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, transform 0.15s;
  letter-spacing: 0.01em;
}
.sg-empty-cta:hover {
  background: #B8944A;
  transform: translateY(-1px);
}
.sg-empty-cta-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--ux-text-2);
  padding: 10px 20px;
  border-radius: 9px;
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid var(--ux-border);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, color 0.15s;
  margin-left: 8px;
}
.sg-empty-cta-secondary:hover {
  border-color: var(--ux-gold);
  color: var(--ux-text);
}
.sg-empty-hint {
  font-size: 0.78rem;
  color: var(--ux-text-3);
  margin-top: 16px;
}

/* ─── Category showcase grid (for vendor empty state) ─── */
.sg-empty-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  max-width: 480px;
  margin-bottom: 28px;
}
.sg-empty-cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--ux-surface);
  border: 1px solid var(--ux-border);
  color: var(--ux-text-2);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 500;
  transition: border-color 0.12s, color 0.12s;
}
.sg-empty-cat-chip:hover {
  border-color: var(--ux-gold);
  color: var(--ux-text);
}

/* ══════════════════════════════════════════════════════════
   SKELETON LOADING
   ══════════════════════════════════════════════════════════ */
@keyframes sg-shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.sg-skeleton {
  background: linear-gradient(
    90deg,
    #E8E0D5 0px,
    #F0EAE2 80px,
    #E8E0D5 160px
  );
  background-size: 400px 100%;
  animation: sg-shimmer 1.4s ease-in-out infinite;
  border-radius: 6px;
  display: block;
}

/* Skeleton size helpers */
.sg-sk-line { height: 14px; margin-bottom: 10px; }
.sg-sk-line-sm { height: 11px; margin-bottom: 8px; }
.sg-sk-line-lg { height: 20px; margin-bottom: 12px; }
.sg-sk-title { height: 28px; margin-bottom: 16px; border-radius: 8px; }
.sg-sk-avatar { border-radius: 50%; }
.sg-sk-btn { height: 36px; border-radius: 8px; }
.sg-sk-card { height: 120px; border-radius: 12px; margin-bottom: 14px; }
.sg-sk-w-100 { width: 100%; }
.sg-sk-w-75 { width: 75%; }
.sg-sk-w-60 { width: 60%; }
.sg-sk-w-40 { width: 40%; }
.sg-sk-w-25 { width: 25%; }

/* Skeleton grid patterns */
.sg-skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.sg-skeleton-card {
  background: var(--ux-surface);
  border: 1px solid var(--ux-border);
  border-radius: 12px;
  padding: 18px;
}
.sg-skeleton-list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--ux-border);
}

/* ─── Page loading overlay ─── */
.sg-loading-screen {
  position: fixed; inset: 0;
  background: var(--ux-bg);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  transition: opacity 0.3s;
}
.sg-loading-screen.sg-fade-out {
  opacity: 0;
  pointer-events: none;
}
.sg-loading-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--ux-border);
  border-top-color: var(--ux-gold);
  border-radius: 50%;
  animation: sg-spin 0.8s linear infinite;
}
@keyframes sg-spin { to { transform: rotate(360deg); } }
.sg-loading-text {
  font-size: 0.85rem;
  color: var(--ux-text-3);
  font-family: 'Inter', sans-serif;
}

/* ─── Content fade-in when loaded ─── */
.sg-content-loading { opacity: 0; transition: opacity 0.25s ease; }
.sg-content-loaded { opacity: 1; }

/* ══════════════════════════════════════════════════════════
   INLINE ERROR STATES
   ══════════════════════════════════════════════════════════ */
.sg-error-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  background: rgba(239,68,68,0.06);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: 10px;
  margin: 16px 0;
  flex-wrap: wrap;
}
.sg-error-inline-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sg-error-inline-icon {
  width: 28px; height: 28px;
  background: rgba(239,68,68,0.12);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
  color: var(--ux-danger);
  flex-shrink: 0;
}
.sg-error-inline-msg {
  font-size: 0.875rem;
  color: var(--ux-text);
}
.sg-error-inline-sub {
  font-size: 0.78rem;
  color: var(--ux-text-2);
  margin-top: 2px;
}
.sg-error-retry {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--ux-danger);
  color: #fff;
  border: none;
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.sg-error-retry:hover { opacity: 0.85; }

/* ─── Network offline banner ─── */
.sg-offline-banner {
  position: fixed;
  bottom: 20px; left: 50%;
  transform: translateX(-50%);
  background: #1C1C1C;
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 5000;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  transition: opacity 0.3s, transform 0.3s;
}
.sg-offline-banner.sg-hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(20px);
  pointer-events: none;
}
.sg-offline-dot {
  width: 8px; height: 8px;
  background: var(--ux-danger);
  border-radius: 50%;
}
.sg-online-dot {
  width: 8px; height: 8px;
  background: var(--ux-success);
  border-radius: 50%;
}

/* ─── Session expired notice ─── */
.sg-session-expired {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 8000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sg-session-card {
  background: var(--ux-surface);
  border: 1px solid var(--ux-border);
  border-radius: 16px;
  padding: 36px 32px;
  text-align: center;
  max-width: 340px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.12);
}
.sg-session-icon { font-size: 2.5rem; margin-bottom: 16px; }
.sg-session-title { font-family: 'Playfair Display', Georgia, serif; font-size: 1.25rem; font-weight: 600; margin-bottom: 8px; color: var(--ux-text); }
.sg-session-msg { font-size: 0.875rem; color: var(--ux-text-2); margin-bottom: 24px; line-height: 1.6; }

/* ══════════════════════════════════════════════════════════
   PAGE TRANSITIONS
   ══════════════════════════════════════════════════════════ */
.sg-page-fade-in {
  animation: sg-fade-in 0.25s ease;
}
@keyframes sg-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
