/* JetLog Shared States — states.css */
/* Loading, empty, error, stale states for all data containers */

/* ===== Loading spinner ===== */
.jl-state-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 48px 16px;
  color: var(--jl-text-dimmed);
  font-size: 13px;
}

.jl-state-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--jl-border);
  border-top-color: var(--jl-brand);
  border-radius: 50%;
  animation: jl-spin 0.6s linear infinite;
}

@keyframes jl-spin {
  to { transform: rotate(360deg); }
}

/* ===== Skeleton shimmer rows (tables) ===== */
.jl-skeleton-row td {
  padding: 12px 16px !important;
  border: none !important;
}

.jl-skeleton-bar {
  height: 12px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--jl-border) 25%, var(--jl-surface-hover) 50%, var(--jl-border) 75%);
  background-size: 200% 100%;
  animation: jl-shimmer 1.5s ease-in-out infinite;
}

.jl-skeleton-bar.short { width: 40%; }
.jl-skeleton-bar.medium { width: 65%; }
.jl-skeleton-bar.long { width: 85%; }

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

/* ===== Skeleton cards (KPI stats) ===== */
.jl-skeleton-card {
  background: var(--jl-surface);
  border: 1px solid var(--jl-border);
  border-radius: 12px;
  padding: 16px 18px;
  min-height: 72px;
}

/* ===== Empty state ===== */
.jl-state-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 16px;
  text-align: center;
}

.jl-state-icon {
  margin-bottom: 12px;
  line-height: 1;
}

/* Lucide icon inside state icon */
.jl-state-icon .jl-state-lucide,
.jl-state-icon .lucide {
  width: 48px;
  height: 48px;
  stroke-width: 1.25;
  color: var(--jl-text-dimmed);
}

/* Emoji icon */
.jl-state-emoji {
  font-size: 36px;
  display: block;
}

.jl-state-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--jl-text-muted);
  margin: 0 0 4px;
}

.jl-state-subtitle {
  font-size: 13px;
  color: var(--jl-text-dimmed);
  margin: 0 0 16px;
  max-width: 320px;
  line-height: 1.5;
}

.jl-state-action {
  display: inline-block;
  padding: 8px 16px;
  background: transparent;
  color: var(--jl-brand);
  border: 1px solid var(--jl-brand);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.jl-state-action:hover { background: var(--jl-brand); color: #fff; }

/* ===== Positive empty state ===== */
.jl-state-positive .jl-state-icon .jl-state-lucide,
.jl-state-positive .jl-state-icon .lucide {
  color: #16a34a;
}
.jl-state-positive .jl-state-title {
  color: var(--jl-green-text);
}

/* ===== Error state ===== */
.jl-state-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 16px;
  text-align: center;
}

.jl-state-error .jl-state-title {
  color: var(--jl-red-text);
}

.jl-state-error .jl-state-icon .jl-state-lucide,
.jl-state-error .jl-state-icon .lucide,
.jl-state-icon-error {
  color: var(--jl-red-text);
}

.jl-state-retry {
  display: inline-block;
  padding: 8px 16px;
  background: var(--jl-brand);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 12px;
  transition: background 0.15s;
}
.jl-state-retry:hover { background: var(--jl-brand-hover); }

/* ===== Stale data banner ===== */
.jl-state-stale {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  background: var(--jl-yellow-subtle);
  border: 1px solid rgba(234,179,8,0.3);
  border-radius: 6px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--jl-yellow-text);
}

.jl-state-stale button {
  background: none;
  border: 1px solid currentColor;
  color: inherit;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.jl-state-stale button:hover {
  background: rgba(234,179,8,0.15);
}

/* ===== TD wrapper (removes td styling for full-width states) ===== */
.jl-state-td {
  padding: 0 !important;
  border: none !important;
}

/* ===== Fade-in animation ===== */
.jl-state-fade-in {
  animation: jl-fade-in 0.3s ease-out;
}

@keyframes jl-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Mobile responsive ===== */
@media (max-width: 640px) {
  .jl-state-empty,
  .jl-state-error {
    padding: 40px 12px;
  }
  .jl-state-icon .jl-state-lucide,
  .jl-state-icon .lucide {
    width: 36px;
    height: 36px;
  }
  .jl-state-emoji {
    font-size: 28px;
  }
  .jl-state-title {
    font-size: 14px;
  }
  .jl-state-subtitle {
    font-size: 12px;
    max-width: 260px;
  }
}
