/* GameKey Store - Game CD Key Online Store */
:root {
  --bg-dark: #0d1117;
  --bg-card: #161b22;
  --bg-hover: #21262d;
  --accent: #58a6ff;
  --accent-hover: #79b8ff;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --border: #30363d;
  --success: #3fb950;
  --radius: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header */
.header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
  gap: 1rem;
  flex-wrap: wrap;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: inherit;
}

.logo:hover {
  color: var(--text);
}

.logo-img {
  height: 44px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.nav {
  display: flex;
  gap: 1.5rem;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-link:hover,
.nav-link.active {
  color: var(--accent);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.search-container {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.search-input {
  padding: 0.5rem 1rem;
  border: none;
  background: var(--bg-dark);
  color: var(--text);
  width: 200px;
  font-size: 0.9rem;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-btn {
  padding: 0.5rem 0.75rem;
  background: var(--bg-hover);
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}

.cart-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  position: relative;
}

.cart-btn:hover {
  background: var(--accent-hover);
}

.cart-count {
  background: rgba(0,0,0,0.2);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.8rem;
}

/* Hero */
.hero {
  padding: 3rem 0;
  text-align: center;
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-dark) 100%);
}

.hero-title {
  font-size: 2.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.hero-subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* Filters */
.filters {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.filters .container {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: center;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-group label {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.filter-select {
  padding: 0.5rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
}

/* Games section */
.games-section {
  padding: 2rem 0 4rem;
}

.section-title {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
}

.game-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
}

.game-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.game-image {
  width: 100%;
  aspect-ratio: 16/10;
  object-fit: cover;
  background: var(--bg-hover);
}

.game-info {
  padding: 1rem;
}

.game-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.game-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.game-platform,
.game-genre {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-hover);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.game-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.game-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--success);
}

.game-price old {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: line-through;
  margin-right: 0.25rem;
}

.btn-add {
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
}

.btn-add:hover {
  background: var(--accent-hover);
}

.btn-details {
  padding: 0.4rem 0.8rem;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  margin-top: 0.5rem;
  width: 100%;
}

.btn-details:hover {
  background: rgba(88, 166, 255, 0.1);
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-large {
  max-width: 560px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 1.25rem;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem;
}

.close-btn:hover {
  color: var(--text);
}

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
}

.cart-items {
  min-height: 80px;
  margin-bottom: 1rem;
}

.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
}

.cart-item:last-child {
  border-bottom: none;
}

.cart-item-name {
  font-weight: 500;
}

.cart-item-price {
  color: var(--success);
}

.cart-item-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
}

.cart-item-remove:hover {
  color: #f85149;
}

.cart-footer {
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.cart-total {
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.checkout-btn {
  width: 100%;
  padding: 0.75rem;
  background: var(--success);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}

.checkout-btn:hover {
  opacity: 0.9;
}

.cart-empty {
  color: var(--text-muted);
  text-align: center;
  padding: 1.5rem;
}

/* Game details in modal */
.game-details img {
  width: 100%;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.game-details .game-price {
  font-size: 1.5rem;
  margin: 0.5rem 0 1rem;
}

/* Footer */
.footer {
  padding: 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  border-top: 1px solid var(--border);
}

@media (max-width: 640px) {
  .header-content {
    flex-direction: column;
    align-items: stretch;
  }
  .nav {
    justify-content: center;
  }
  .search-input {
    width: 100%;
  }
  .hero-title {
    font-size: 1.5rem;
  }
}
