/* ============================================================
   JBB — Skeleton Loaders
   Location: assets/css/skeleton.css
   ============================================================ */

/* Base shimmering block */
.jbb-sk {
  background: linear-gradient(
    90deg,
    #ECE7E0 0%,
    #F5F1EA 40%,
    #ECE7E0 80%
  );
  background-size: 800px 100%;
  animation: jbb-sk-shimmer 1.4s linear infinite;
  border-radius: 6px;
}

@keyframes jbb-sk-shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

/* ---------- Product card skeleton ---------- */
.jbb-sk-card {
  background: #fff;
  border: 1px solid var(--c-line);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.jbb-sk-card-image {
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  width: 100%;
}

.jbb-sk-card-title {
  height: 14px;
  width: 80%;
}

.jbb-sk-card-price {
  height: 16px;
  width: 40%;
}

.jbb-sk-card-stars {
  height: 10px;
  width: 30%;
}

.jbb-sk-card-btn {
  height: 36px;
  width: 100%;
  border-radius: 8px;
  margin-top: 4px;
}

/* ---------- Line skeleton ---------- */
.jbb-sk-line {
  height: 12px;
  width: 100%;
}

.jbb-sk-line-sm { height: 10px; }
.jbb-sk-line-lg { height: 16px; }
.jbb-sk-line-60 { width: 60%; }
.jbb-sk-line-40 { width: 40%; }
.jbb-sk-line-30 { width: 30%; }

/* ---------- Text block skeleton ---------- */
.jbb-sk-text-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ---------- Detail page skeleton ---------- */
.jbb-sk-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  margin-bottom: 64px;
}

.jbb-sk-detail-img {
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  width: 100%;
}

.jbb-sk-detail-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.jbb-sk-detail-title {
  height: 28px;
  width: 70%;
}

.jbb-sk-detail-price {
  height: 24px;
  width: 40%;
}

@media (max-width: 900px) {
  .jbb-sk-detail {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

/* ---------- Cart row skeleton ---------- */
.jbb-sk-cart-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  border-top: 1px solid var(--c-line-2);
}

.jbb-sk-cart-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
}

.jbb-sk-cart-name {
  height: 14px;
  width: 60%;
}

.jbb-sk-cart-cell {
  height: 14px;
  width: 40%;
  margin: 0 auto;
}

@media (max-width: 640px) {
  .jbb-sk-cart-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

/* ---------- Grids ---------- */
.jbb-sk-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

@media (max-width: 1024px) {
  .jbb-sk-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .jbb-sk-grid { grid-template-columns: 1fr; }
}

/* ---------- Inline spinner (for buttons) ---------- */
.jbb-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: jbb-spin .7s linear infinite;
  vertical-align: -2px;
  margin-right: 6px;
}

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

/* ---------- Full-page loader overlay ---------- */
.jbb-loader-overlay {
  position: fixed;
  inset: 0;
  background: rgba(243, 235, 225, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9997;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  opacity: 0;
  transition: opacity .2s ease;
}

.jbb-loader-overlay.jbb-loader-in {
  opacity: 1;
}

.jbb-loader-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(192, 125, 90, 0.25);
  border-top-color: var(--c-brand);
  border-radius: 50%;
  animation: jbb-spin .8s linear infinite;
}

.jbb-loader-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--c-ink-3);
}

/* ---------- Empty / error state blocks ---------- */
.jbb-state-block {
  text-align: center;
  padding: 64px 24px;
  max-width: 460px;
  margin: 0 auto;
}

.jbb-state-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--c-brand-soft);
  color: var(--c-brand-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 28px;
  font-size: 30px;
}

.jbb-state-icon-danger {
  background: #FEE2E2;
  color: var(--c-danger);
}

.jbb-state-title {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 600;
  color: var(--c-ink);
  margin-bottom: 12px;
}

.jbb-state-text {
  font-size: 14px;
  color: var(--c-ink-4);
  line-height: 1.6;
  margin-bottom: 28px;
}

.jbb-state-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.jbb-state-btn {
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s ease;
}

.jbb-state-btn-primary {
  background: var(--c-ink);
  color: #fff;
}
.jbb-state-btn-primary:hover { background: #333; }

.jbb-state-btn-ghost {
  background: #fff;
  color: var(--c-ink);
  border: 1px solid var(--c-line);
}
.jbb-state-btn-ghost:hover { background: var(--c-line-2); }