/**
 * EPIC12 DENSE FEED UI — Sprint 12.22D INFORMATION-FIRST
 *
 * BREAKING CHANGES:
 * - Background Image System (15-25% opacity, blur, reduced brightness)
 * - Glass Overlay (backdrop-blur, semi-transparent, high-contrast)
 * - Zero Wasted Space (every pixel serves data display)
 * - Card Height: 110~125px (max 130px), 6 cards per mobile screen
 * - Responsive Typography: Route 18-20px bold, Price 18px bold, Meta 13px, CTA 14px
 *
 * NO legacy renderer. NO placeholder. NO white space. NO dead padding.
 *
 * Badge Colors:
 *   NEED_RIDE   → Blue   (#2563EB)
 *   OFFER_RIDE  → Green  (#10B981)
 *   NEED_CARGO  → Amber  (#F59E0B)
 *   OFFER_CARGO → Purple (#7C3AED)
 *
 * @package XOS_Lite
 * @version 9.0.0 — INFORMATION-FIRST UI (Sprint 12.22D)
 * @since   Sprint 12.22C
 */

/* ===========================================================
    1. DENSE CARD CONTAINER (DLC) — Sprint 12.22D
   =========================================================== */

.dlc-card {
  contain: layout style paint;
  content-visibility: auto;
  contain-intrinsic-size: auto 118px;

  position: relative;
  background: #FFFFFF;
  border-radius: 12px;
  border: 1px solid #E7EEF7;
  margin-bottom: 6px;
  overflow: hidden;
  transition: box-shadow 150ms ease, transform 100ms ease;
  animation: dlc-fade-in 200ms ease both;
  animation-delay: calc(var(--dlc-index, 0) * 30ms);
}

.dlc-card:active {
  transform: scale(0.99);
}

.dlc-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

@keyframes dlc-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===========================================================
    2. CARD LINK (full card clickable, zero wasted space)
   =========================================================== */

.dlc-card-link {
  display: block;
  position: relative;
  text-decoration: none;
  color: inherit;
  min-height: 110px;
  max-height: 130px;
  height: auto;
}

/* ===========================================================
    3. BACKGROUND IMAGE SYSTEM — Sprint 12.22D
       Image is decoration ONLY. 15-25% opacity, blurred, reduced brightness.
   =========================================================== */

.dlc-bg-wrap {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #F3F6FA;
}

.dlc-bg-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.18;
  filter: blur(6px) brightness(0.7);
  display: block;
  /* Prevent ghost drag on mobile */
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none;
}

/* Card without image — plain background */
.dlc-card:not(.dlc-card--has-bg) .dlc-card-link {
  background: #FFFFFF;
}

/* ===========================================================
    4. GLASS OVERLAY — Sprint 12.22D
       All information floats here. backdrop-blur, high contrast.
   =========================================================== */

.dlc-overlay {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 8px;
  min-width: 0;
  height: 100%;
  min-height: 110px;
  max-height: 130px;
  box-sizing: border-box;

  /* Glass effect */
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);

  /* For cards without background image, solid white */
  .dlc-card:not(.dlc-card--has-bg) & {
    background: #FFFFFF;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

/* ===========================================================
    5. HEADER ROW: Badges + Time + Verified
   =========================================================== */

.dlc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  flex-wrap: nowrap;
  min-height: 16px;
}

.dlc-badges {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
}

/* ── Marketplace Mode Badge (12px per EPIC 8) ── */

.dlc-mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 0.75rem;  /* 12px — EPIC 8 */
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 1px 6px;
  border-radius: 4px;
  line-height: 1.5;
  white-space: nowrap;
  flex-shrink: 0;
}

.dlc-badge--need-ride {
  background: #DBEAFE;
  color: #1D4ED8;
  border: 1px solid #BFDBFE;
}

.dlc-badge--offer-ride {
  background: #D1FAE5;
  color: #047857;
  border: 1px solid #A7F3D0;
}

.dlc-badge--need-cargo {
  background: #FEF3C7;
  color: #B45309;
  border: 1px solid #FDE68A;
}

.dlc-badge--offer-cargo {
  background: #F3E8FF;
  color: #6D28D9;
  border: 1px solid #E9D5FF;
}

/* ── Recommendation Badge (12px) ── */

.dlc-rec-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 0.75rem;  /* 12px */
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  line-height: 1.5;
  white-space: nowrap;
  flex-shrink: 0;
  animation: dlc-rec-pulse 2s ease infinite;
}

.dlc-rec--top {
  background: #FFF7ED;
  color: #C2410C;
  border: 1px solid #FED7AA;
}

.dlc-rec--nearby {
  background: #CCFBF1;
  color: #0F766E;
  border: 1px solid #99F6E4;
}

.dlc-rec--popular {
  background: #FEE2E2;
  color: #B91C1C;
  border: 1px solid #FECACA;
}

@keyframes dlc-rec-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.72; }
}

/* ── Header Meta (Time + Verified) ── */

.dlc-header-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.dlc-verified {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #10B981;
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}

.dlc-time-ago {
  font-size: 0.6875rem;  /* 11px */
  color: #9CA3AF;
  white-space: nowrap;
}

/* ===========================================================
    6. ROUTE ROW — Bold 18-20px (EPIC 8)
   =========================================================== */

.dlc-route {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 1.125rem;  /* 18px — EPIC 8 */
  font-weight: 700;
  color: #1F2937;
  line-height: 1.25;
  overflow: hidden;
  flex: 1;
}

.dlc-route-origin,
.dlc-route-dest {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.dlc-route-arrow {
  flex-shrink: 0;
  color: #9CA3AF;
}

/* ===========================================================
    7. INFO ROW: Date · Time + Capacity + Price
   =========================================================== */

.dlc-info-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.dlc-info-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.8125rem;  /* 13px — EPIC 8 Meta */
  color: #4B5563;
  line-height: 1.4;
}

.dlc-info-time svg {
  flex-shrink: 0;
}

.dlc-info-price {
  font-weight: 700;
  color: #DC2626;
  font-size: 1.125rem;  /* 18px bold — EPIC 8 Price */
  margin-left: auto;
  flex-shrink: 0;
}

/* ===========================================================
    8. BOTTOM ROW: Avatar + Name + Trust + Rating + CTA
   =========================================================== */

.dlc-bottom-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 2px;
}

/* ── User Info ── */

.dlc-user {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.dlc-avatar-wrap {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  overflow: hidden;
}

.dlc-avatar-img {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
}

.dlc-avatar-default {
  display: block;
  width: 22px;
  height: 22px;
}

.dlc-user-name {
  font-size: 0.75rem;  /* 12px */
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80px;
}

.dlc-user-trust {
  font-size: 0.75rem;
  flex-shrink: 0;
}

.dlc-user-rating {
  font-size: 0.6875rem;  /* 11px */
  color: #F59E0B;
  font-weight: 600;
  flex-shrink: 0;
}

/* ── Action Buttons (14px — EPIC 8 CTA) ── */

.dlc-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  margin-left: auto;
}

.dlc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;  /* 14px — EPIC 8 CTA */
  font-weight: 700;
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 8px;
  line-height: 1.3;
  transition: all 120ms ease;
  white-space: nowrap;
  touch-action: manipulation;
  min-height: 32px;
}

.dlc-btn--outline {
  border: 1.5px solid #D1D5DB;
  color: #374151;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.dlc-btn--outline:active {
  background: #F3F6FA;
  border-color: #9CA3AF;
}

.dlc-btn--primary {
  border: 1.5px solid #2563EB;
  color: #FFFFFF;
  background: #2563EB;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}

.dlc-btn--primary:active {
  background: #1D4ED8;
  border-color: #1D4ED8;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}

/* ===========================================================
    9. SKELETON LOADING (zero wasted space)
   =========================================================== */

.dlc-skeleton {
  background: #FFFFFF;
  border-radius: 12px;
  border: 1px solid #E7EEF7;
  margin-bottom: 6px;
  overflow: hidden;
  min-height: 110px;
  max-height: 130px;
}

.dlc-skeleton-inner {
  display: flex;
  flex-direction: column;
  padding: 8px 8px;
  gap: 6px;
  min-height: 110px;
  max-height: 130px;
  box-sizing: border-box;
}

.dlc-skeleton-thumb {
  display: none; /* No thumbnail skeleton in Information-First UI */
}

.dlc-skeleton-lines {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
}

.dlc-skeleton-line {
  height: 12px;
  border-radius: 4px;
  background: linear-gradient(90deg, #F3F6FA 25%, #E7EEF7 50%, #F3F6FA 75%);
  background-size: 200% 100%;
  animation: dlc-shimmer 1.5s ease-in-out infinite;
}

.dlc-skeleton-line--sm { width: 35%; }
.dlc-skeleton-line--md { width: 60%; }
.dlc-skeleton-line--lg { width: 85%; }

@keyframes dlc-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===========================================================
    10. INFINITE SCROLL LOADER
   =========================================================== */

.dlc-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 0;
  gap: 8px;
}

.dlc-loader-spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid #E7EEF7;
  border-top-color: #2563EB;
  border-radius: 50%;
  animation: dlc-spin 600ms linear infinite;
}

.dlc-loader-text {
  font-size: 0.6875rem;
  color: #9CA3AF;
}

@keyframes dlc-spin {
  to { transform: rotate(360deg); }
}

/* ===========================================================
    11. EMPTY STATE
   =========================================================== */

.dlc-empty-state {
  text-align: center;
  padding: 32px 16px;
}

.dlc-empty-icon {
  margin-bottom: 8px;
  opacity: 0.6;
}

.dlc-empty-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: #374151;
  margin: 0 0 4px;
}

.dlc-empty-text {
  font-size: 0.75rem;
  color: #9CA3AF;
  margin: 0 0 12px;
  line-height: 1.5;
}

.dlc-empty-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #FFFFFF;
  background: #2563EB;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 8px;
  transition: background 120ms ease;
}

.dlc-empty-btn:active {
  background: #1D4ED8;
}

/* ===========================================================
    12. LIVE HEADER (compact)
   =========================================================== */

.dlc-live-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  padding: 0 2px;
}

.dlc-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10B981;
  animation: dlc-live-dot 1.2s ease-in-out infinite;
}

@keyframes dlc-live-dot {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.3; }
}

.dlc-live-label {
  font-size: 0.6875rem;
  font-weight: 700;
  color: #059669;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dlc-live-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #374151;
  margin: 0;
}

.dlc-live-counter {
  font-weight: 700;
  color: #2563EB;
}

/* ===========================================================
    13. RESPONSIVE — EPIC 8 Typography Scaling
   =========================================================== */

@media (min-width: 640px) {
  .dlc-card {
    border-radius: 14px;
    margin-bottom: 8px;
  }

  .dlc-card-link {
    min-height: 118px;
    max-height: 130px;
  }

  .dlc-overlay {
    min-height: 118px;
    max-height: 130px;
  }

  .dlc-mode-badge,
  .dlc-rec-badge {
    font-size: 0.8125rem;  /* 13px */
  }

  .dlc-route {
    font-size: 1.25rem;  /* 20px — EPIC 8 desktop */
  }

  .dlc-info-item {
    font-size: 0.875rem;  /* 14px */
  }

  .dlc-info-price {
    font-size: 1.25rem;  /* 20px */
  }

  .dlc-btn {
    font-size: 0.875rem;  /* 14px */
    padding: 5px 12px;
  }

  .dlc-user-name {
    font-size: 0.8125rem;
  }
}

@media (min-width: 1024px) {
  .dlc-container {
    max-width: 768px;
    margin: 0 auto;
  }
}

/* ===========================================================
    14. PERFORMANCE: GPU acceleration
   =========================================================== */

.dlc-card,
.dlc-card-link,
.dlc-bg-wrap,
.dlc-overlay,
.dlc-btn {
  will-change: transform;
  -webkit-tap-highlight-color: transparent;
}

.dlc-card:active,
.dlc-btn:active {
  transform: scale(0.97);
  transition: transform 80ms ease;
}

/* Prevent image drag on mobile */
.dlc-bg-img,
.dlc-avatar-img {
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none;
}

/* ===========================================================
    15. OUTDOOR READABILITY — High contrast, sunlight-ready
   =========================================================== */

/* Glass overlay ensures text is always readable */
.dlc-overlay {
  /* Slightly more opaque for outdoor readability */
  background: rgba(255, 255, 255, 0.78);
}

.dlc-route {
  text-shadow: 0 0 1px rgba(255, 255, 255, 0.5);
}

.dlc-info-price {
  text-shadow: 0 0 1px rgba(255, 255, 255, 0.5);
}

/* ===========================================================
    16. ZERO WASTED SPACE — Hunting down every dead pixel
   =========================================================== */

/* Remove all legacy spacing */
.dlc-card *,
.dlc-overlay * {
  margin-top: 0;
  margin-bottom: 0;
}

/* Feed container — tightly spaced */
.dlc-feed {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* No extra padding on feed container */
.dlc-container .dlc-live-header {
  padding-top: 0;
}