/* JTB Social — skeleton shimmer, top progress bar, auth spinners */

/* ── Top NProgress-style bar ── */
#jtb-top-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 10001;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

#jtb-top-progress.active {
  opacity: 1;
}

#jtb-top-progress .jtb-top-progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--jtb-yellow, #ffcc00), #ffe066, var(--jtb-yellow-hover, #f5b800));
  box-shadow: 0 0 8px rgba(255, 204, 0, 0.55);
  transition: width 0.25s ease;
  border-radius: 0 2px 2px 0;
}

#jtb-top-progress.complete .jtb-top-progress-bar {
  transition: width 0.15s ease;
}

/* ── Shimmer base ── */
@keyframes jtbShimmer {
  0% { background-position: -468px 0; }
  100% { background-position: 468px 0; }
}

.jtb-shimmer {
  background: linear-gradient(90deg, #e8eaed 0%, #f5f6f7 40%, #e8eaed 80%);
  background-size: 800px 100%;
  animation: jtbShimmer 1.25s ease-in-out infinite;
  border-radius: 8px;
}

html[data-theme="dark"] .jtb-shimmer {
  background: linear-gradient(90deg, #3a3b3c 0%, #4e4f50 40%, #3a3b3c 80%);
  background-size: 800px 100%;
}

.jtb-skeleton-host {
  position: relative;
  min-height: 24px;
}

.jtb-skeleton-wrap {
  animation: jtbSkeletonIn 0.2s ease;
}

.jtb-skeleton-wrap.jtb-skeleton-fade-out {
  animation: jtbSkeletonOut 0.18s ease forwards;
}

.jtb-content-fade-in {
  animation: jtbContentIn 0.22s ease;
}

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

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

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

/* Search dropdown skeleton */
.jtb-sk-search-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
}

.jtb-sk-search-item .jtb-shimmer-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
}

.jtb-sk-search-item .jtb-shimmer-lines {
  flex: 1;
  min-width: 0;
}

.jtb-sk-line {
  height: 10px;
  margin-bottom: 8px;
  border-radius: 6px;
}

.jtb-sk-line:last-child {
  margin-bottom: 0;
  width: 60%;
}

.jtb-sk-line.w80 { width: 80%; }
.jtb-sk-line.w50 { width: 50%; }

/* Friend row skeleton */
.jtb-sk-friend-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border, #e4e6eb);
}

.jtb-sk-friend-row:last-child {
  border-bottom: none;
}

.jtb-sk-friend-row .jtb-shimmer-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.jtb-sk-friend-row .jtb-shimmer-lines {
  flex: 1;
}

.jtb-sk-friend-row .jtb-shimmer-btn {
  width: 88px;
  height: 32px;
  border-radius: 8px;
  flex-shrink: 0;
}

/* Messenger thread skeleton */
.jtb-sk-chat-thread {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  min-height: 280px;
}

.jtb-sk-bubble {
  height: 36px;
  border-radius: 18px;
  max-width: 65%;
}

.jtb-sk-bubble.mine {
  align-self: flex-end;
  width: 45%;
}

.jtb-sk-bubble.theirs {
  align-self: flex-start;
  width: 55%;
}

.jtb-sk-bubble.tall {
  height: 72px;
}

.jtb-sk-chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border, #e4e6eb);
}

/* Comment skeleton */
.jtb-sk-comment {
  display: flex;
  gap: 10px;
  padding: 8px 0;
}

.jtb-sk-comment .jtb-shimmer-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
}

.jtb-sk-comment .jtb-shimmer-bubble {
  flex: 1;
  height: 48px;
  border-radius: 16px;
  max-width: 75%;
}

/* ── Auth form spinner overlay ── */
.jtb-auth-loading {
  position: relative;
  pointer-events: none;
}

.jtb-auth-loading .jtb-auth-spinner-overlay {
  display: flex;
}

.jtb-auth-spinner-overlay {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 20;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.72);
  border-radius: inherit;
  backdrop-filter: blur(2px);
}

html[data-theme="dark"] .jtb-auth-spinner-overlay {
  background: rgba(36, 37, 38, 0.78);
}

.jtb-auth-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid var(--border, #e4e6eb);
  border-top-color: var(--jtb-yellow, #ffcc00);
  border-radius: 50%;
  animation: jtbAuthSpin 0.75s linear infinite;
}

@keyframes jtbAuthSpin {
  to { transform: rotate(360deg); }
}

.jtb-auth-loading .fb-btn-login,
.jtb-auth-loading .fb-btn-signup,
.jtb-auth-loading .fb-btn-social,
.jtb-auth-loading #register-submit {
  opacity: 0.65;
}

/* Group form validation */
.form-control.is-invalid,
.fb-input.is-invalid {
  border-color: #e41e3f !important;
  box-shadow: 0 0 0 2px rgba(228, 30, 63, 0.15);
}

.form-field-error {
  color: #e41e3f;
  font-size: 0.82rem;
  font-weight: 600;
  margin-top: 6px;
}

.group-form-field .form-field-error:empty {
  display: none;
}

/* ── App shell wireframe skeletons (instant paint before JS) ── */
.jtb-sk-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-h, 56px);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: var(--bg-card, #fff);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  z-index: 100;
  box-sizing: border-box;
}

.jtb-sk-topbar-logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
}

.jtb-sk-topbar-search {
  flex: 1;
  max-width: 240px;
  height: 40px;
  border-radius: 20px;
}

.jtb-sk-topbar-nav {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.jtb-sk-topbar-nav span {
  width: 112px;
  height: 48px;
  border-radius: 8px;
}

.jtb-sk-topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.jtb-sk-topbar-actions span {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.jtb-sk-sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 0;
}

.jtb-sk-sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
}

.jtb-sk-sidebar-item .jtb-shimmer-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
}

.jtb-sk-sidebar-item .jtb-shimmer-line {
  height: 12px;
  flex: 1;
  max-width: 140px;
  border-radius: 6px;
}

.jtb-sk-sidebar-heading {
  height: 10px;
  width: 90px;
  margin: 12px 12px 4px;
  border-radius: 6px;
}

.jtb-sk-widget {
  background: var(--bg-card, #fff);
  border: 1px solid var(--border, #e4e6eb);
  border-radius: var(--radius-lg, 8px);
  padding: 12px;
  margin-bottom: 16px;
}

.jtb-sk-widget-title {
  height: 12px;
  width: 45%;
  margin-bottom: 12px;
  border-radius: 6px;
}

.jtb-sk-pymk {
  display: flex;
  gap: 12px;
  padding: 0 16px 16px;
  overflow: hidden;
}

.jtb-sk-pymk-card {
  width: 160px;
  height: 200px;
  border-radius: 10px;
  flex-shrink: 0;
}

.jtb-sk-market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.jtb-sk-market-card {
  border-radius: var(--radius-lg, 8px);
  overflow: hidden;
  border: 1px solid var(--border, #e4e6eb);
  background: var(--bg-card, #fff);
}

.jtb-sk-market-thumb {
  height: 160px;
}

.jtb-sk-market-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.jtb-sk-profile-cover {
  height: 260px;
  background: var(--bg-page, #f0f2f5);
}

.jtb-sk-profile-head {
  padding: 0 16px 16px;
  margin-top: -40px;
}

.jtb-sk-profile-avatar {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 4px solid var(--bg-card, #fff);
  margin-bottom: 12px;
}

.jtb-sk-profile-name {
  height: 28px;
  width: 220px;
  margin-bottom: 8px;
  border-radius: 8px;
}

.jtb-sk-profile-meta {
  height: 14px;
  width: 160px;
  margin-bottom: 8px;
  border-radius: 6px;
}

.jtb-sk-profile-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.jtb-sk-profile-sidebar-card {
  height: 120px;
  border-radius: var(--radius-lg, 8px);
  margin-bottom: 12px;
}
