/* ========================================
   VINSNAP EXPLORE — TIKTOK / TINDER STYLE
   Full-screen swipeable cards with action rail
   ======================================== */

/* Phase D — empty state for when there are no public posts to explore */
.community-explore-empty {
  margin: 32px auto;
  padding: 56px 24px;
  max-width: 520px;
  background: var(--dash-card-bg);
  border: 1px solid rgba(14, 165, 233, 0.0882);
  border-radius: var(--dash-radius-lg);
  text-align: center;
}

.community-explore-empty__icon {
  font-size: 48px;
  margin-bottom: 16px;
  filter: drop-shadow(0 0 16px rgba(250, 204, 21, 0.3));
}

.community-explore-empty__title {
  font-size: 20px;
  font-weight: 700;
  color: #f8fbff;
  margin-bottom: 8px;
}

.community-explore-empty__desc {
  color: #98a9c6;
  margin-bottom: 24px;
}

.community-explore-empty__cta {
  padding: 10px 22px;
  background: var(--dash-social-grad);
  color: #0b1328;
  border: none;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.15s, box-shadow 0.15s;
}

.community-explore-empty__cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px -8px rgba(250, 204, 21, 0.5);
}

/* ── Page container — full viewport ───────────────────────────── */

.community-explore-page.explore-tiktok {
  position: fixed;
  inset: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #000;
  z-index: 1;
}

/* ── Viewport — holds the card stack ─────────────────────────── */

.explore-viewport {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.explore-card-stack {
  position: relative;
  width: 100%;
  height: 100%;
}

/* ── The Card ─────────────────────────────────────────────────── */

.explore-card {
  position: absolute;
  inset: 0;
  border-radius: 0;
  overflow: hidden;
  background: #000;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
}

.explore-card-next {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.95);
}

/* ── Card Media (photo) ──────────────────────────────────────── */

.explore-card-media {
  position: absolute;
  inset: 0;
}

.explore-card-photo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.explore-card-video {
  object-fit: contain;
}

.explore-card-no-photo {
  width: 100%;
  height: 100%;
  background: #111;
}

.explore-photo-count {
  position: absolute;
  top: 12px;
  right: 60px;
  padding: 4px 10px;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 12px;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.85);
  font-weight: 600;
}

/* ── Overlay — author + content at bottom ────────────────────── */

.explore-card-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 70px; /* leave room for action rail */
  padding: 16px;
  padding-bottom: 80px;
  background: none;
  z-index: 2;
  pointer-events: none;
}

.explore-card-overlay * {
  pointer-events: auto;
}

.explore-card-author {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.explore-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255,255,255,0.25);
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
}

.explore-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.explore-author-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.explore-author-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  text-shadow: 0 1px 6px rgba(0,0,0,0.8), 0 0 12px rgba(0,0,0,0.5);
}

.explore-author-name:hover {
  text-decoration: underline;
}

.explore-post-time {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.55);
}

/* ── Card text content ───────────────────────────────────────── */

.explore-card-text {
  font-size: 0.88rem;
  color: rgba(255,255,255,0.92);
  line-height: 1.4;
  margin: 0 0 8px 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 1px 6px rgba(0,0,0,0.8), 0 0 12px rgba(0,0,0,0.5);
}

.explore-vehicle-pill {
  display: inline-block;
  padding: 3px 10px;
  background: rgba(34, 211, 166, 0.0735);
  border: 1px solid rgba(34, 211, 166, 0.1176);
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #c4b5fd;
  margin-bottom: 6px;
}

.explore-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.explore-tag {
  font-size: 0.72rem;
  color: rgba(34, 211, 166, 0.2499);
  font-weight: 600;
}

/* ── Action Rail — TikTok style right side ───────────────────── */

.explore-actions-rail {
  position: absolute;
  right: 10px;
  bottom: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  z-index: 5;
}

.rail-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  min-width: 50px;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease;
}

.rail-btn:active {
  transform: scale(0.9);
}

.rail-icon {
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border-radius: 50%;
  font-size: 1.5rem;
  transition: transform 0.2s ease;
  border: none;
  filter: drop-shadow(0 1px 4px rgba(0,0,0,0.6));
}

.rail-btn:hover .rail-icon {
  transform: scale(1.1);
}

.rail-count {
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.7);
}

.rail-count:empty {
  display: none;
}

/* Like active state */
.rail-btn.like-btn.active .rail-icon {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.5);
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.35);
}

/* Like pop animation */
.rail-btn.like-pop .rail-icon {
  animation: likePopAnim 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes likePopAnim {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.35); }
  60%  { transform: scale(0.95); }
  100% { transform: scale(1); }
}

/* Bookmark active state */
.rail-btn.bookmark-btn.active .rail-icon {
  background: rgba(34, 211, 166, 0.0735);
  border-color: rgba(34, 211, 166, 0.147);
  box-shadow: 0 0 16px rgba(34, 211, 166, 0.1029);
}

/* ── Swipe Hints ─────────────────────────────────────────────── */

.explore-swipe-hint {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  padding: 14px 22px;
  border-radius: 14px;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
}

.explore-swipe-hint--left {
  left: 20px;
  background: rgba(239, 68, 68, 0.2);
  border: 3px solid rgba(239, 68, 68, 0.7);
  color: #fca5a5;
}

.explore-swipe-hint--right {
  right: 80px;
  background: rgba(34, 197, 94, 0.2);
  border: 3px solid rgba(34, 197, 94, 0.7);
  color: #86efac;
}

/* ── Exit Animations ─────────────────────────────────────────── */

.explore-card-exit-right {
  animation: cardExitRight 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.explore-card-exit-left {
  animation: cardExitLeft 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes cardExitRight {
  from { transform: translateX(0) rotate(0deg); opacity: 1; }
  to   { transform: translateX(120%) rotate(15deg); opacity: 0; }
}

@keyframes cardExitLeft {
  from { transform: translateX(0) rotate(0deg); opacity: 1; }
  to   { transform: translateX(-120%) rotate(-15deg); opacity: 0; }
}

/* ── Comments Drawer — slides up from bottom ─────────────────── */

.comments-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0);
  z-index: 990;
  transition: background 0.3s ease;
}

.comments-drawer-overlay.open {
  background: rgba(0,0,0,0.5);
}

.comments-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 70vh;
  background: var(--bg-secondary, #1a1a2e);
  border-radius: 20px 20px 0 0;
  z-index: 995;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 -8px 32px rgba(0,0,0,0.5);
}

.comments-drawer.open {
  transform: translateY(0);
}

.comments-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}

.comments-drawer-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary, #fff);
}

.comments-drawer-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.08);
  color: var(--text-primary, #fff);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.comments-drawer-close:hover {
  background: rgba(255,255,255,0.15);
}

.comments-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  min-height: 200px;
}

/* ── Loading & Empty ─────────────────────────────────────────── */

/* Only visible when no cards are present — hidden by JS otherwise */
.explore-tiktok-loading,
.explore-tiktok-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  background: #0a0a0f;
}

/* Hidden state */
.explore-tiktok-loading[hidden],
.explore-tiktok-empty[hidden] {
  display: none !important;
}

/* When cards exist in the stack, loading shows as a subtle bottom indicator */
.explore-card-stack:not(:empty) ~ .explore-tiktok-loading {
  display: none;
}

.explore-card-stack:not(:empty) ~ .explore-tiktok-empty {
  display: none;
}

/* ── Car loading animation ──────────────────────────────────── */

.explore-car-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.explore-car-svg {
  width: 140px;
  height: 48px;
  animation: explore-car-bounce 1s ease-in-out infinite;
}

.explore-car-wheel-back,
.explore-car-wheel-front {
  animation: explore-wheel-spin 0.5s linear infinite;
  transform-origin: center;
}

.explore-car-wheel-back {
  transform-origin: 34px 30px;
}

.explore-car-wheel-front {
  transform-origin: 82px 30px;
}

.explore-car-road {
  width: 180px;
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(34, 211, 166, 0.1176) 20%,
    rgba(34, 211, 166, 0.1764) 50%,
    rgba(34, 211, 166, 0.1176) 80%,
    transparent 100%
  );
  border-radius: 1px;
  animation: explore-road-pulse 1.5s ease-in-out infinite;
}

.explore-car-text {
  font-size: 0.9rem;
  font-weight: 600;
  color: rgba(167, 139, 250, 0.8);
  letter-spacing: 0.05em;
  margin: 0;
}

@keyframes explore-car-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

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

@keyframes explore-road-pulse {
  0%, 100% { opacity: 0.5; width: 140px; }
  50% { opacity: 1; width: 200px; }
}

.explore-tiktok-empty .empty-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  opacity: 0.6;
}

.explore-tiktok-empty h3 {
  font-size: 1.15rem;
  color: var(--text-primary, #fff);
  margin-bottom: 0.5rem;
}

.explore-tiktok-empty p {
  font-size: 0.85rem;
  color: var(--text-secondary, rgba(255,255,255,0.5));
}

/* ── Toast ────────────────────────────────────────────────────── */

.explore-toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 24px;
  background: rgba(34, 211, 166, 0.2646);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 12px;
  z-index: 9999;
  animation: toastIn 0.25s ease, toastOut 0.25s ease 1.75s forwards;
  box-shadow: 0 4px 16px rgba(34, 211, 166, 0.1176);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toastOut {
  from { opacity: 1; }
  to   { opacity: 0; transform: translateX(-50%) translateY(-10px); }
}

/* ── Desktop tweaks ──────────────────────────────────────────── */

@media (min-width: 769px) {
  .community-explore-page.explore-tiktok {
    align-items: center;
  }

  .explore-card-stack {
    max-width: 480px;
    max-height: 90vh;
    margin: 0 auto;
  }

  .explore-card {
    border-radius: 16px;
  }

  .comments-drawer {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    border-radius: 20px 20px 0 0;
  }

  .comments-drawer.open {
    transform: translateX(-50%) translateY(0);
  }
}

/* ── Mobile adjustments ──────────────────────────────────────── */

@media (max-width: 768px) {
  .explore-actions-rail {
    right: 8px;
    bottom: 100px;
  }

  .explore-card-overlay {
    padding-bottom: 100px;
  }
}

/* ── Reduced motion ──────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .explore-card,
  .explore-card-exit-right,
  .explore-card-exit-left,
  .rail-btn,
  .rail-icon,
  .comments-drawer,
  .comments-drawer-overlay,
  .explore-toast {
    animation: none !important;
    transition: none !important;
  }
}
