/* ═══════════════════════════════════════════════════════════════════════════
   LAYER 3 CO-LOCATED STYLES: FeedTimeline (`components/feed/FeedTimeline.css`)
   X-Style Timeline, Multi-Image Collage, Custom HTML5 Video Player & Right Rail
   ═══════════════════════════════════════════════════════════════════════════ */

.x-feed-layout {
  display: grid;
  grid-template-columns: minmax(0, 680px) 340px;
  gap: 24px;
  align-items: start;
  padding: 0 20px;
}

.x-timeline-col {
  border-left: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
  background: rgba(11, 15, 24, 0.55);
  min-height: calc(100dvh - 56px);
}

/* Sticky Underline Tabs */
.x-tabs-bar {
  position: sticky;
  top: 56px;
  z-index: var(--z-toolbar);
  display: flex;
  overflow-x: auto;
  background: rgba(8, 10, 15, 0.84);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border-subtle);
  scrollbar-width: none;
}
.x-tabs-bar::-webkit-scrollbar {
  display: none;
}

.x-tab-item {
  flex: 1 0 auto;
  min-width: 105px;
  padding: 14px 16px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  text-align: center;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.x-tab-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.x-tab-item.active {
  color: var(--text-primary);
  font-weight: 700;
}

.x-tab-item.active .x-tab-label {
  position: relative;
  padding-bottom: 13px;
}

.x-tab-item.active .x-tab-label::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3.5px;
  border-radius: 9999px;
  background: var(--accent);
}

/* Search Pill Row */
.x-inline-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.x-search-pill {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.x-search-pill:focus-within {
  background: var(--bg-surface-solid);
  border-color: var(--accent);
}

.x-search-icon {
  color: var(--text-secondary);
  display: inline-flex;
}

.x-search-pill input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
}

.x-search-clear {
  background: var(--accent);
  color: #ffffff;
  border: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.x-btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.x-btn-icon:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* Post Card */
.x-post {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.15s ease;
}

.x-post:hover {
  background: rgba(255, 255, 255, 0.025);
}

.x-post-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--bg-surface-solid);
  border: 1.5px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  color: var(--text-primary);
}

.x-post-main {
  min-width: 0;
}

.x-post-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
  flex-wrap: wrap;
}

.x-post-author-row {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  min-width: 0;
}

.x-post-display-name {
  font-weight: 700;
  font-size: 14.5px;
  color: var(--text-primary);
}

.x-verified-icon {
  color: var(--accent);
  flex-shrink: 0;
}

.x-post-handle,
.x-post-dot,
.x-post-time {
  font-size: 13.5px;
  color: var(--text-secondary);
}

.x-post-cat-tag {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  border: 1px solid var(--border-subtle);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.03);
}

.x-post-text {
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ─── MULTI-IMAGE COLLAGE & CUSTOM VIDEO PLAYER ───────────────────────────── */
.x-media-collage {
  margin-top: 12px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: #05070b;
  display: grid;
  gap: 2px;
}

.x-media-collage.count-1 {
  grid-template-columns: 1fr;
  max-height: 520px;
}

.x-media-collage.count-2 {
  grid-template-columns: 1fr 1fr;
  height: 290px;
}

.x-media-collage.count-3 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 145px 145px;
  height: 292px;
}

.x-media-collage.count-3 .x-media-cell:first-child {
  grid-row: 1 / span 2;
}

.x-media-collage.count-4 {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 150px 150px;
  height: 302px;
}

.x-media-cell {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #05070b;
}

.x-image-cell {
  cursor: zoom-in;
}

.x-image-cell img {
  width: 100%;
  height: 100%;
  max-height: 520px;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease;
}

.x-media-collage.count-1 .x-image-cell img {
  object-fit: contain;
  background: #04060a;
}

.x-image-cell:hover img {
  transform: scale(1.015);
}

.x-media-zoom-badge {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(8, 10, 15, 0.82);
  backdrop-filter: blur(8px);
  color: #ffffff;
  padding: 4px 9px;
  border-radius: 9999px;
  font-size: 11.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  pointer-events: none;
}

.x-media-more-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 800;
  color: #ffffff;
}

/* Custom Video Player */
.x-video-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  min-height: 240px;
}

.x-video-el {
  width: 100%;
  max-height: 500px;
  display: block;
  cursor: pointer;
}

.x-video-big-play {
  position: absolute;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(29, 155, 240, 0.92);
  border: 3px solid #ffffff;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.65);
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.x-video-big-play:hover {
  transform: scale(1.08);
}

.x-video-wrap.is-playing .x-video-big-play {
  opacity: 0;
  pointer-events: none;
}

.x-video-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px 12px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.88));
  display: flex;
  align-items: center;
  gap: 10px;
}

.x-vid-btn {
  background: transparent;
  border: none;
  color: #ffffff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.x-vid-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

.x-vid-scrubber {
  flex: 1;
  accent-color: var(--accent);
  height: 4px;
  cursor: pointer;
}

.x-vid-time {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: #e2e8f0;
  font-variant-numeric: tabular-nums;
}

/* Action Bar */
.x-post-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 480px;
  margin-top: 10px;
}

.x-action-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  margin-left: -10px;
  border-radius: 9999px;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.x-action-btn:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.x-action-oracle {
  color: #7dd3fc;
}

.x-action-btn.is-bookmarked {
  color: var(--amber);
}

.x-action-btn.is-bookmarked:hover {
  background: var(--amber-soft);
}

/* Right Sidebar Rail */
.x-right-rail {
  position: sticky;
  top: 72px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.x-widget-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.01) 100%), var(--bg-surface);
  backdrop-filter: var(--liquid-blur);
  -webkit-backdrop-filter: var(--liquid-blur);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow-sm), var(--glass-highlight);
}

.x-widget-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.x-widget-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.x-trend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 9px 11px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 11px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.x-trend-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.x-trend-row.active {
  background: var(--accent-soft);
  border-color: rgba(29, 155, 240, 0.3);
}

.x-trend-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.x-trend-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.x-trend-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
}

.x-feed-empty {
  padding: 64px 24px;
  text-align: center;
}

.x-feed-empty-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.x-feed-empty-sub {
  font-size: 13.5px;
  color: var(--text-secondary);
}

@media (max-width: 1120px) {
  .x-feed-layout {
    grid-template-columns: 1fr;
    padding: 0;
  }
  .x-right-rail {
    display: none;
  }
  .x-timeline-col {
    border-left: none;
    border-right: none;
  }
}

/* ─── X INLINE SWIPEABLE CAROUSEL & VIDEO SPEED PILL ─────────────────────── */
.x-inline-carousel {
  margin-top: 12px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #05070b;
  position: relative;
}

.x-inline-carousel-stage {
  position: relative;
  width: 100%;
  max-height: 520px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.x-inline-carousel-stage .x-image-cell img {
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  display: block;
  cursor: zoom-in;
}

.x-carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: rgba(12, 15, 24, 0.82);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 6;
  transition: all 0.16s ease;
}

.x-carousel-nav:hover {
  background: rgba(29, 155, 240, 0.85);
  border-color: #38bdf8;
  transform: translateY(-50%) scale(1.06);
}

.x-carousel-prev {
  left: 12px;
}

.x-carousel-next {
  right: 12px;
}

.x-carousel-top-badges {
  position: absolute;
  top: 10px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 6;
}

.x-carousel-counter {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(10, 13, 20, 0.82);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #f8fafc;
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.x-carousel-mode-btn,
.x-collage-mode-floating {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(10, 13, 20, 0.84);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  z-index: 6;
}

.x-collage-mode-floating {
  position: absolute;
  top: 10px;
  left: 10px;
}

.x-carousel-dots {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(10, 13, 20, 0.72);
  backdrop-filter: blur(8px);
  z-index: 6;
}

.x-carousel-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  border: none;
  padding: 0;
  background: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  transition: all 0.16s ease;
}

.x-carousel-dot.active {
  width: 18px;
  background: #38bdf8;
}

.x-vid-speed-btn {
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 10.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
