/* Global Layout & Fonts */
body {
  margin: 0;
  font-family: "Poppins", sans-serif;
  background: #121212;
  color: #fff;
}

/* Header Section */
.hero {
  padding: 3rem 1rem 2rem;
  background: linear-gradient(to bottom right, #1e1e2f, #2d2d44);
  color: white;
  text-align: center;
}

.hero-inner {
  max-width: 600px;
  margin: 0 auto;
  position: relative;
}

.hero h1 {
  font-size: 2.5rem;
  margin: 0;
  position: relative;
}

.hero .emoji {
  position: absolute;
  left: -2rem;
  top: 0.3rem;
  font-size: 4rem;
  line-height: 1;
  animation: pulseWiggle 3s ease-in-out infinite;
}

@keyframes pulseWiggle {
  0%,
  100% {
    transform: scale(1) rotate(0deg);
  }
  25% {
    transform: scale(1.1) rotate(-5deg);
  }
  50% {
    transform: scale(1.15) rotate(5deg);
  }
  75% {
    transform: scale(1.1) rotate(-3deg);
  }
}

.hero p {
  margin: 0.5rem 0 1.5rem;
  font-size: 1.2rem;
  color: #ccc;
}

#searchInput {
  padding: 0.75rem 1rem;
  width: 100%;
  max-width: 400px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  outline: none;
  display: block;
  margin: 0 auto;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

/* Filters Section */
.filters {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
}

.platform-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.filter-btn {
  background-color: #2a2a40;
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background-color 0.3s ease;
}

.filter-btn:hover,
.filter-btn.active {
  background-color: #00c4ff;
  color: #000;
}

.view-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  font-weight: 500;
}

.view-controls label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Results Grid */
.results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem; /* ✅ vertical and horizontal spacing */
  padding: 2rem 5vw;
  justify-items: start;
  align-items: stretch;
}

.results.compact {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  padding: 1.5rem 4vw;
}

/* Light Theme */
body.light {
  background: #f4f4f4;
  color: #111;
}

body.light .card {
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

body.light .card-footer a {
  background-color: #007acc;
  color: #fff;
}

body.light .fav-btn {
  color: #333;
}

body.light .fav-btn.favorited {
  color: crimson;
}

body.light .fav-btn:hover:not(.favorited) {
  color: deeppink;
}

/* Card Structure */
.card {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  justify-content: space-between;
  height: auto;
  min-height: 340px;
  padding: 1.5rem 1rem 2rem; /* top, sides, bottom */
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  transition: transform 0.2s ease;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.card:hover {
  transform: scale(1.03);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

/* Card Content */
.card-body {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.card-body h3 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-body em {
  display: inline-block;
  max-height: 2.5em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1rem;
  margin-bottom: 0.5rem; /* ✅ adds breathing room before card ends */
}

/* Giveaway Image */
.giveaway-img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  margin-bottom: 10px;
}

/* Claim Button */
.card-footer a {
  background-color: #00c4ff;
  color: #000;
  font-weight: 600;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: all 0.2s ease-in-out;
  position: relative;
}

.card-footer a::after {
  content: "";
  position: absolute;
  bottom: 6px;
  left: 0;
  width: 100%;
  height: 2px;
  background: #000;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

.card-footer a:hover {
  background-color: #00a7dc;
}

.card-footer a:hover::after {
  transform: scaleX(1);
  transform-origin: right;
}

/* Favorite Button */
.fav-btn {
  background: none;
  border: none;
  font-size: 2.25rem;
  margin-left: 1rem;
  cursor: pointer;
  color: white;
  transition: color 0.2s ease, transform 0.2s ease;
  line-height: 1;
  touch-action: manipulation;
}

.fav-btn:hover:not(.favorited) {
  color: gold;
  transform: scale(1.3);
}

.fav-btn.favorited {
  color: red;
  transform: scale(1.2);
  animation: pulse 0.3s ease;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.4);
  }
  100% {
    transform: scale(1.2);
  }
}

/* Timer Styling */
.expires {
  font-size: 0.85rem;
  font-style: italic;
  color: #ff6b6b;
  margin-top: 0.25rem;
}

/* Skeleton Card */
/* Skeleton Card Container */
.skeleton-card {
  border-radius: 12px;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.05); /* matches your card style */
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Shared shimmer animation */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.skeleton-img,
.skeleton-line,
.skeleton-heart {
  background: linear-gradient(90deg, #2a2a40 25%, #3c3c55 50%, #2a2a40 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
}

/* Fake image block */
.skeleton-img {
  height: 140px;
  border-radius: 8px;
  margin-bottom: 1rem;
}

/* Fake text lines */
.skeleton-line {
  height: 12px;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.skeleton-line.short {
  width: 60%;
}

.skeleton-line.small {
  width: 40%;
}

/* Fake heart button */
.skeleton-heart {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
}

.giveaway-card {
  opacity: 0;
  animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

/* Small devices (phones, less than 600px) */
@media (max-width: 599px) {
  .filters,
  .platform-tabs,
  .view-controls {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    padding: 0 1rem;
    box-sizing: border-box;
  }

  .filter-btn,
  .view-controls label {
    width: 100%;
    text-align: center;
  }

  .results {
    grid-template-columns: 1fr;
    padding: 1rem 2vw;
    gap: 1rem;
  }

  .card {
    min-height: 300px;
    padding: 1rem;
  }

  input#searchInput {
    width: 100%;
  }

  /* Hero emoji adjustments */
  .hero .emoji {
    left: -1rem;
    top: 0rem;
    font-size: 3rem;
  }

  /* Card footer adjustments for mobile - keep heart on right */
  .card-footer {
    flex-direction: row; /* keep in row */
    justify-content: space-between; /* spread buttons */
    align-items: center;
    gap: 0.5rem;
  }

  .fav-btn {
    font-size: 2rem;
    margin-left: 0;
    padding: 0;
    flex-shrink: 0; /* prevent shrinking */
    color: white; /* ensures unfavorited hearts are white */
  }

  .fav-btn.favorited {
    color: red; /* favorited hearts */
  }

  .fav-btn:hover:not(.favorited) {
    color: gold;
  }

  .card-footer a {
    flex-grow: 1; /* let claim button take available space */
    text-align: center;
  }
}

/* Medium devices (tablets, 600px to 899px) */
@media (min-width: 600px) and (max-width: 899px) {
  .results {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    padding: 1.5rem 4vw;
    gap: 1.25rem;
  }

  .filters,
  .view-controls {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    width: auto;
    padding: 0;
  }

  .card {
    min-height: 320px;
  }

  .card-footer {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
  }

  .fav-btn {
    font-size: 2.25rem;
    margin-left: 1rem;
    padding: 0;
    color: white;
  }

  .fav-btn.favorited {
    color: red;
  }

  .fav-btn:hover:not(.favorited) {
    color: gold;
  }

  .card-footer a {
    width: auto;
    text-align: center;
  }
}

/* Large devices (desktops, 900px and up) */
@media (min-width: 900px) {
  .results {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    padding: 2rem 5vw;
    gap: 2rem;
  }

  .card {
    min-height: 340px;
  }

  .card-footer {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
  }

  .fav-btn {
    font-size: 2.25rem;
    margin-left: 1rem;
    padding: 0;
    color: white;
  }

  .fav-btn.favorited {
    color: red;
  }

  .fav-btn:hover:not(.favorited) {
    color: gold;
  }

  .card-footer a {
    width: auto;
    text-align: center;
  }
}
