/* Component: deals (cards) - extracted from styles.css */

/* DEAL CARDS */

.deal-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.deal-card {
  display: grid;
  grid-template-columns: 110px 1fr; /* compact (mobile first) */
  gap: 0.5rem;
  padding: 0.45rem; /* reduced vertical padding */
  border-radius: 12px;
  background: linear-gradient(135deg, #0f172a, #0b0d12); /* uniform dark background */
  border: 1px solid rgb(255 255 255 / 6%);
  box-shadow: 0 8px 30px rgb(0 0 0 / 30%);
  transition: transform 0.14s ease, border-color 0.14s ease;
  min-height: 88px; /* slightly tighter card height */
  color: #f5f5f5; /* light text for contrast */
  align-items: start;
  overflow: hidden;

@media (min-width: 641px) {
  /* Desktop: image on the LEFT, info on the RIGHT - use consistent dark cards */
  .deal-card {
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr); /* fixed thumbnail column, flexible content column */
    gap: 0.75rem;
    padding: 0.6rem; /* slightly tighter */
    border-radius: 14px;
    background: linear-gradient(135deg, #0f172a, #0b0d12);
    color: #f5f5f5;
    border: 1px solid rgb(255 255 255 / 6%);
    box-shadow: 0 10px 30px rgb(0 0 0 / 28%);
    align-items: stretch; /* ensure left column can stretch to full card height */
  }

  /* Enforce grid and neutralize legacy float rules on desktop */
  .deal-card .deal-thumb {
    float: none;
    width: 160px;
    height: auto; /* allow height to follow card and stretch */
    min-width: 160px;
    min-height: 160px;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    border: 1px solid rgb(0 0 0 / 4%);
    padding: 0.5rem; /* add white padding to create a visible image card */
    box-shadow: 0 8px 24px rgb(0 0 0 / 10%);
    align-self: stretch; /* stretch to full card height */
    display: flex;
    align-items: center;
    justify-content: center;
    /* extend to the left edge of the card so the left column appears as a full white block */
    margin-left: -0.6rem;
    margin-top: -0.6rem;
    margin-bottom: -0.6rem;
    border-top-left-radius: 14px;
    border-bottom-left-radius: 14px;
    z-index: 1;
  }

  /* Desktop: make sure the contained image matches the box */
  .deal-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
  }

/* Screenshot navigator (dev helper) */
.screenshot-navigator {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 99999;
  background: rgb(11 13 18 / 90%);
  color: #fff;
  padding: 0.4rem;
  border-radius: 10px;
  display: flex;
  gap: 0.35rem;
  align-items: center;
  box-shadow: 0 8px 30px rgb(0 0 0 / 50%);
  font-size: 0.85rem;
}

.screenshot-navigator .snav-btn {
  background: transparent;
  color: #fff;
  border: 1px solid rgb(255 255 255 / 8%);
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  cursor: pointer;
}

.snav-btn.active {
  background: #FF6B35;
  border-color: #FF6B35;
  color: #0b0d12;
}


/* Highlighted deal-list styling */
.deal-list.screenshot-highlight {
  position: relative;
  z-index: 10001;
  box-shadow: 0 0 0 6px rgb(255 255 255 / 98%), 0 12px 40px rgb(0 0 0 / 45%);
  border-radius: 14px;
}

/* Full page dimmer used when highlighting */
.screenshot-overlay {
  position: fixed;
  inset: 0;
  background: rgb(2 6 23 / 60%);
  z-index: 10000;
  display: none;
}

.screenshot-overlay.visible {
  display: block;
}


  .deal-card .card-title {
    font-size: 1rem;
    margin: 0 0 0.2rem;
    font-weight: 700;
    color: #f5f5f5;
    line-height: 1.15;
  }

  .deal-card .desc {
    font-size: 0.92rem;
    color: rgb(245 245 245 / 76%);
    margin: 0 0 0.4rem;
    max-height: 3.2rem;
    overflow: hidden;
    margin-left: 0.1rem;
  }

  .deal-card .deal-meta-line {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    font-size: 0.88rem;
    color: rgb(245 245 245 / 60%);
    margin-bottom: 0.25rem;
    margin-left: 0.1rem;
  }

  .deal-card .price-line {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.25rem;
    flex-wrap: nowrap; /* avoid wrapping of price and votes */
  }

  .deal-card .deal-cta-btn {
    display: inline-block;
    padding: 0.5rem 0.75rem;
    border-radius: 10px;
    background: linear-gradient(135deg,#FF6B35,#FF8B5A);
    color: #0b0d12;
    font-weight: 700;
  }
}
}

.deal-thumb {
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  background: #fff; /* white background for image area */
  border: 1px solid rgb(0 0 0 / 4%);
  display: flex;
  align-items: center; /* vertical center */
  justify-content: center; /* horizontal center */
  flex-shrink: 0;
  padding: 0.5rem; /* slightly larger white padding around images */
  position: relative; /* allow z-index control */
  z-index: 0;

  /* default: allow sizing to be defined by the grid / media queries */
  height: auto;
  max-height: none;
  aspect-ratio: auto;
  align-self: stretch;
}  

.deal-body {
  position: relative;
  z-index: 1;
}

.deal-body h3.card-title {
  margin-top: 0;
  margin-bottom: 0.2rem;
}

/* Ensure deal titles are white on the default (dark) background */
.deal-list .deal-card .card-title,
.deal-card .card-title {
  color: #f5f5f5;
}

/* Keep a light-scheme helper if a light card needs dark titles explicitly */
.deal-card.light .card-title {
  color: #0f172a;
} 

@media (max-width: 640px) {
  .deal-thumb { max-height: 120px; }

  /* Hide any legacy mobile-only vote blocks to avoid duplication */
  .deal-card .vote-inline-mobile { display: none; }

  .deal-body h3.card-title {
    font-size: 0.95rem;
    line-height: 1.12;
  }
}

.deal-thumb img {
  width: auto;
  height: auto;
  max-height: 100%;
  max-width: 100%;
  object-fit: contain; /* preserve original aspect ratio */
  display: block;
  background: #fff;
  margin: auto; /* center if smaller than container */
  image-rendering: auto;
}

/* Desktop override: ensure the image fills the thumbnail container's height */
@media (min-width: 641px) {
  .deal-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }
}


.deal-card:hover {
  transform: translateY(-2px);
  border-color: rgb(255 107 53 / 18%);
}

@media (max-width: 640px) {
  .deal-list {
    margin-left: -1rem; /* full-bleed: cancel parent container padding */
    margin-right: -1rem;
    padding-left: 1rem; /* keep inner breathing room consistent */
    padding-right: 1rem;
  }

  .deal-card {
    grid-template-columns: 34% 1fr; /* left thumb slightly larger for visual parity */
    gap: 0.75rem;
    padding: 0.4rem; /* reduce horizontal padding to maximize space */
    border-radius: 12px; /* match desktop radius */
    align-items: stretch; /* ensure left column stretches to full card height */
    min-height: 150px; /* ensure consistent visual height similar to desktop */

    /* Force desktop-like visual theme on mobile for parity */
    background: linear-gradient(135deg, #0f172a, #0b0d12);
    color: #f5f5f5;
    border: 1px solid rgb(255 255 255 / 6%);
    box-shadow: 0 10px 30px rgb(0 0 0 / 28%);
  }

  /* Mobile: make the thumbnail column a full-height white block and center the image (flush to the card edge like desktop) */
  .deal-card .deal-thumb {
    float: none; /* neutralize older float-based rules */
    display: flex;
    width: 100%;
    height: 100%;
    min-height: 150px; /* raise min height to match card and desktop feel */
    aspect-ratio: auto; /* allow the thumbnail to match the card height */
    margin-left: 0; /* align flush like desktop */
    margin-top: 0;
    margin-bottom: 0;
    border-radius: 12px; /* match desktop */
    overflow: hidden;
    align-self: stretch; /* stretch to fill the grid cell height */
    flex-shrink: 0;
    box-shadow: 0 10px 30px rgb(0 0 0 / 6%); /* match desktop shadow density */
    padding: 0; /* remove inner padding so image fills the area like desktop */
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid rgb(0 0 0 / 4%);
    z-index: 1;
  }

  /* Ensure the image fills the thumbnail on mobile */
  .deal-card .deal-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
  }

  /* Prevent price and votes from wrapping on small screens */
  .deal-card .price-line {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: nowrap;
  }

  .deal-card .card-title {
    font-size: 0.95rem; /* match .deal-body h3 scale for consistency with homepage */
  }

  .deal-card .deal-meta-line {
    font-size: 0.6rem;
    gap: 0.35rem;
  }

  .vote-chip {
    padding: 0.12rem 0.2rem; /* more compact on mobile to avoid wrapping */
    font-size: 0.68rem; /* slightly larger for readability */
  }

  .vote-chip span,
  .vote-score-compact {
    font-size: 0.68rem;
  }

  .vote-score-compact {
    min-width: 44px; /* allow compact score on mobile */
    padding: 0.25rem 0.4rem;
  }

  /* Give the content column a small right padding for breathing room */
  .deal-card .deal-body {
    padding-right: 0.25rem;
  }



  .deal-card .price-current {
    font-size: 0.8rem;
  }

  .deal-card .desc {
    font-size: 0.75rem;
  }

  .deal-card .deal-cta-btn {
    display: block; /* full width CTA on mobile */
    width: 100%;
    box-sizing: border-box;
    padding: 0.55rem 0.75rem; /* slightly larger touch target */
    font-size: 0.9rem;
    border-radius: 10px;
    text-align: center;
    margin-top: 0.45rem;
  }

  .pill {
    padding: 0.18rem 0.35rem;
    font-size: 0.65rem;
  } 
} 

@media (max-width: 480px) {
  .deal-card {
    grid-template-columns: 30% 1fr; /* keep image around 30% for consistency */
    gap: 0.6rem;
    padding: 0.6rem;
  }
}

.deal-body h3 {
  font-size: clamp(0.95rem, 2.5vw, 1rem);
  margin: 0 0 0.15rem;
  color: #f5f5f5;
  line-height: 1.12;
}

.deal-body .desc {
  color: rgb(255 255 255 / 88%);
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  line-height: 1.3;
  max-height: 3.5rem;
  overflow: hidden;
} 

.deal-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
} 

@media (max-width: 640px) {
  .price-line {
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  .vote-inline-desktop {
    display: none; /* hide the desktop-positioned votes; moved via JS */
  }

  /* mobile tweaks: keep gap and alignment — display defined globally */
  .vote-inline {
    margin-left: auto;
    gap: 0.4rem;
  }

  .vote-inline .vote-chip {
    padding: 0.25rem 0.45rem;
    font-size: 0.78rem;
  }
}


  .vote-inline .vote-score-compact {
    min-width: 44px;
    padding: 0.28rem 0.45rem;
    font-size: 0.78rem;
  }

/* Canonical vote styles (moved from legacy `styles.css`) - keep visuals consistent across home & detail */
.vote-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.vote-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.6rem;
  border-radius: 10px;
  border: 1px solid rgb(255 255 255 / 12%);
  background: rgb(255 255 255 / 5%);
  color: #f5f5f5;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.vote-chip:hover {
  background: rgb(255 255 255 / 8%);
  border-color: rgb(255 255 255 / 20%);
}

.vote-chip.up {
  color: #8ef3c5;
  border-color: rgb(34 197 94 / 25%);
}

.vote-chip.down {
  color: #fda29b;
  border-color: rgb(239 68 68 / 25%);
}

.vote-chip.active {
  background: rgb(255 255 255 / 12%);
  box-shadow: 0 6px 18px rgb(0 0 0 / 6%);
  transform: translateY(-2px);
}

.vote-score-compact {
  position: relative; /* for delta animation */
  background: rgb(255 255 255 / 4%);
  border: 1px solid rgb(255 255 255 / 8%);
  border-radius: 10px;
  padding: 0.35rem 0.6rem;
  font-weight: 700;
  color: #e5e7eb;
  min-width: 56px;
  display: inline-block;
}

.vote-score-compact.positive {
  color: #16a34a; /* green */
  border-color: rgb(16 163 82 / 18%);
  background: rgb(16 163 82 / 4%);
}

.vote-score-compact.negative {
  color: #dc2626; /* red */
  border-color: rgb(220 38 38 / 12%);
  background: rgb(220 38 38 / 3%);
}

.vote-score.positive {
  color: #16a34a;
  font-weight: 800;
}

.vote-score.negative {
  color: #dc2626;
  font-weight: 800;
}

.vote-delta {
  position: absolute;
  inset: auto 8px 100%; /* place above */
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 800;
  opacity: 1;
  transform: translateY(0);
  transition: transform 600ms ease, opacity 600ms ease;
  pointer-events: none;
}

.vote-delta.out {
  transform: translateY(-12px);
  opacity: 0;
}

@keyframes score-pulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.vote-score-compact.pulse,
.vote-score.pulse { animation: score-pulse 540ms cubic-bezier(.2,.9,.2,1); }

.vote-score-compact.pulse.positive { box-shadow: 0 8px 20px rgb(16 163 82 / 12%); }
.vote-score-compact.pulse.negative { box-shadow: 0 8px 20px rgb(220 38 38 / 12%); }

.vote-score.pulse.positive { text-shadow: 0 2px 8px rgb(16 163 82 / 12%); }
.vote-score.pulse.negative { text-shadow: 0 2px 8px rgb(220 38 38 / 12%); }
