* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background-color: #121212;
  color: #ffffff;
  padding: 20px;
}

.header {
  margin-bottom: 30px;
}

.title-search-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100;
  background-color: #121212;
  padding: 15px 20px;
  border-bottom: 1px solid #333;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.title-section {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.title-section i {
  font-size: 2rem;
  color: #4caf50;
  margin-right: 12px;
  vertical-align: middle;
  text-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
  animation: pulse 2s infinite;
}

.title-section h1 {
  display: inline-block;
  vertical-align: middle;
  font-size: 1.8rem;
  font-weight: bold;
  background: linear-gradient(45deg, #4caf50, #8bc34a, #cddc39);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
}

.search-section {
  display: flex;
  gap: 15px;
  align-items: center;
  flex-grow: 1;
  max-width: 700px;
  justify-content: flex-end;
}

#searchInput,
#platformSelect {
  padding: 12px 15px;
  border-radius: 6px;
  border: none;
  background-color: #2a2a2a;
  color: white;
  font-size: 16px;
}

#searchInput {
  flex: 1;
  min-width: 200px;
}

#platformSelect {
  min-width: 150px;
}

.catalog-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
  margin-top: 100px;
}

@media (min-width: 768px) {
  .catalog-container {
    grid-template-columns: repeat(4, 1fr);
  }
}

.game-card {
  background-color: #1e1e1e;
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.3s ease;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
}

.game-card:hover {
  transform: translateY(-5px);
}

.game-cover {
  width: 100%;
  aspect-ratio: 5 / 7;
  object-fit: contain;
  background-color: #333;
  border-radius: 6px;
}

.game-info {
  padding: 15px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.game-title {
  font-size: 1.1rem;
  font-weight: bold;
  line-height: 1.2em;
  min-height: calc(1.2em * 2);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  margin-bottom: 6px;
  text-align: center;
}

.game-size {
  font-size: 0.9rem;
  color: #aaaaaa;
  margin-bottom: 12px;
  text-align: center;
  display: block;
}

.loading,
.error {
  text-align: center;
  padding: 20px;
  font-size: 18px;
}

.error {
  color: #ff5252;
}

@media (max-width: 768px) {
  .title-search-container {
    flex-direction: column;
    padding: 15px;
    gap: 15px;
  }
  .title-section {
    justify-content: center;
    margin-bottom: 10px;
  }
  .title-section i {
    font-size: 1.8rem;
  }
  .title-section h1 {
    font-size: 1.5rem;
  }
  .search-section {
    max-width: 100%;
    justify-content: center;
  }
  #searchInput {
    min-width: 150px;
  }
  #platformSelect {
    min-width: 120px;
  }
  .catalog-container {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 140px;
  }
  .game-title {
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .title-search-container {
    padding: 10px;
  }
  .title-section i {
    font-size: 1.5rem;
    margin-right: 8px;
  }
  .title-section h1 {
    font-size: 1.2rem;
  }
  .search-section {
    flex-direction: column;
    gap: 10px;
  }
  #searchInput,
  #platformSelect {
    width: 100%;
    min-width: auto;
  }
  .catalog-container {
    margin-top: 160px;
  }
}

.games-counter {
  display: block;
  text-align: center;
  margin: 20px 0;
  padding: 10px;
  background-color: #2a2a2a;
  border-radius: 6px;
  color: #aaaaaa;
  font-size: 14px;
  grid-column: 1 / -1;
}

.loading-indicator {
  display: none;
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 15px 25px;
  border-radius: 30px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  grid-column: 1 / -1;
  justify-self: center;
  margin: 20px 0;
}

.loading-spinner {
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top: 3px solid #4caf50;
  width: 25px;
  height: 25px;
  animation: spin 1s linear infinite;
  margin: 0 auto 8px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

.estrenos-btn {
  background-color: #e91e63;
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  font-size: 16px;
  transition: background-color 0.3s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.estrenos-btn:hover {
  background-color: #c2185b;
}

@media (min-width: 768px) {
  .search-section {
    justify-content: center;
    gap: 20px;
    margin-right: 100px;
  }

  .estrenos-btn {
    margin-right: 0;
  }
}

.cart-container {
  background: #1e1e1e;
  margin: 20px auto;
  padding: 15px;
  border-radius: 8px;
  max-width: 600px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.cart-container h2 {
  margin-bottom: 10px;
  text-align: center;
  color: #4caf50;
}

#cartList {
  list-style: none;
  padding: 0;
  margin: 0 0 10px 0;
}

#cartList li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #333;
  font-size: 14px;
}

.remove-btn {
  background-color: #222;
  border: none;
  color: #ff5252;
  cursor: pointer;
  font-size: 16px;
  border-radius: 4px;
  padding: 4px 8px;
  transition: background-color 0.3s, color 0.3s;
}

.remove-btn:hover {
  background-color: #333;
  color: #ff0000;
}

#cartTotal {
  font-weight: bold;
  margin: 10px 0;
  text-align: right;
  color: #fff;
}

.cart-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  margin-top: 16px;
  gap: 10px;
}

.whatsapp-btn {
  display: block;
  width: 100%;
  background-color: #25d366;
  color: #fff;
  text-align: center;
  text-decoration: none;
  padding: 12px;
  border-radius: 6px;
  font-weight: bold;
  font-size: 16px;
  transition: background-color 0.25s ease, box-shadow 0.25s ease,
    transform 0.25s ease;
}
.whatsapp-btn:hover {
  background-color: #23c85f;
  box-shadow: 0 0 6px rgba(37, 211, 102, 0.35);
}
.whatsapp-btn:active {
  background-color: #1ebe5d;
  transform: scale(0.98);
}

.clear-cart-btn {
  width: 100%;
  background-color: #d32f2f;
  color: #fff;
  border: none;
  padding: 12px;
  border-radius: 6px;
  font-weight: bold;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.25s ease, box-shadow 0.25s ease,
    transform 0.25s ease;
}
.clear-cart-btn:hover {
  background-color: #b71c1c;
  box-shadow: 0 0 6px rgba(211, 47, 47, 0.35);
}
.clear-cart-btn:active {
  background-color: #9a0007;
  transform: scale(0.98);
}

@media (max-width: 480px) {
  .whatsapp-btn,
  .clear-cart-btn {
    width: 100%;
    font-size: 14px;
    padding: 10px;
    box-shadow: none;
  }
}

.cart-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  background-color: #1e1e1e;
  border: 2px solid #e53935;
  text-decoration: none;
  box-shadow: 0 0 12px rgba(229, 57, 53, 0.6);
}

.cart-btn i {
  font-size: 2rem;
  color: #e53935;
  transition: transform 0.3s, color 0.3s;
}

.cart-btn:hover {
  background-color: #2a2a2a;
  box-shadow: 0 0 16px rgba(229, 57, 53, 0.9);
}

.cart-btn i:hover {
  transform: scale(1.2);
  color: #ff1744;
}

.cart-count {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #e53935;
  color: white;
  font-size: 0.75rem;
  font-weight: bold;
  border-radius: 50%;
  padding: 3px 5px;
  min-width: 18px;
  text-align: center;
  line-height: 1;
  box-shadow: 0 0 6px rgba(229, 57, 53, 0.8);
  transition: transform 0.2s;
}

.cart-count.bump {
  animation: bump 0.3s ease;
}

@keyframes bump {
  0% {
    transform: scale(1);
  }
  30% {
    transform: scale(1.3);
  }
  60% {
    transform: scale(0.9);
  }
  100% {
    transform: scale(1);
  }
}

.details-btn {
  background-color: #4caf50;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.3s;
  padding: 6px 8px;
  font-size: 0.85rem;
}
.details-btn:hover {
  background-color: #45a049;
}

.add-cart-btn {
  background-color: #e53935;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.3s;
  padding: 6px 8px;
  font-size: 0.85rem;
}
.add-cart-btn:hover {
  background-color: #c62828;
}
.add-cart-btn:disabled,
.add-cart-btn.in-cart {
  background-color: #777 !important;
  color: #fff;
  cursor: not-allowed;
}

.details-container {
  max-width: 900px;
  margin: 40px auto;
  background-color: #1e1e1e;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
}

.details-header {
  display: flex;
  flex-wrap: wrap;
}

.details-cover {
  width: 300px;
  height: auto;
  object-fit: cover;
}

.details-info {
  flex: 1;
  padding: 20px;
}

.details-title {
  font-size: 32px;
  margin-bottom: 15px;
  color: #ffffff;
}

.details-meta {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.meta-item {
  background-color: #2a2a2a;
  padding: 15px;
  border-radius: 6px;
}

.meta-label {
  font-size: 14px;
  color: #4caf50;
  margin-bottom: 5px;
  font-weight: bold;
}

.meta-value {
  font-size: 18px;
  font-weight: bold;
  color: #ffffff;
}

.details-description {
  padding: 20px;
  line-height: 1.6;
  background-color: #252525;
}

.details-description h2 {
  margin-bottom: 15px;
  color: #4caf50;
}

@media (max-width: 768px) {
  .details-header {
    flex-direction: column;
  }
  .details-cover {
    width: 100%;
    height: auto;
  }
  .details-title {
    font-size: 24px;
  }
  .details-meta {
    grid-template-columns: repeat(2, 1fr);
  }
}

.details-description p {
  white-space: pre-line;
}

.details-info .btn-group {
  display: flex;
  justify-content: center;
  margin-top: 15px;
}

.btn-group {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.details-btn,
.add-cart-btn {
  flex: 1;
  max-width: 120px;
  padding: 6px 10px;
  font-size: 0.85rem;
  box-sizing: border-box;
}

.title-section h1 {
  font-size: clamp(1.2rem, 5vw, 2rem);
  margin: 0;
  line-height: 1.2;
  word-break: break-word;
  text-align: center;
}

@media (max-width: 768px) {
  .title-search-container {
    flex-direction: column;
    align-items: flex-start;
  }

  .title-section h1 {
    text-align: left;
    font-size: 1.2rem;
  }

  .search-section {
    width: 100%;
    margin-top: 10px;
  }
}

.btn-group {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: nowrap;
}

.btn-group button {
  flex: 1 1 0;
  min-width: 0;
  font-size: clamp(0.6rem, 2vw, 0.9rem);
  padding: 6px 8px;
  white-space: normal;
  overflow-wrap: break-word;
  text-align: center;
}
