/* ============================================
   main.css - GameItems Public Site
   ============================================ */

:root {
  --bg: #0f1117;
  --bg-card: #1a1d27;
  --bg-card-hover: #21253a;
  --border: #2a2d3e;
  --accent: #f5a623;
  --accent-hover: #e09400;
  --accent-dim: rgba(245, 166, 35, 0.12);
  --text: #e8eaf0;
  --text-muted: #8b8fa8;
  --text-dim: #555970;
  --green: #22c55e;
  --red: #ef4444;
  --blue: #3b82f6;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 20px rgba(0,0,0,0.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }

/* ---- NAVBAR ---- */
.navbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-logo {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent);
  white-space: nowrap;
}

.navbar-logo span { color: var(--text); }

.navbar-search {
  flex: 1;
  max-width: 500px;
  position: relative;
}

.navbar-search input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 16px 8px 38px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.navbar-search input:focus { border-color: var(--accent); }

.navbar-search .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 15px;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.btn {
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--accent);
  color: #000;
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.cart-btn {
  position: relative;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  color: var(--text);
  cursor: pointer;
  font-size: 16px;
  transition: border-color 0.2s;
}

.cart-btn:hover { border-color: var(--accent); }

.cart-count {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--accent);
  color: #000;
  font-size: 10px;
  font-weight: 700;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- CATEGORY TABS ---- */
.cat-tabs {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.cat-tabs::-webkit-scrollbar { display: none; }

.cat-tab {
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all 0.2s;
}

.cat-tab:hover { color: var(--text); }
.cat-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ---- MAIN LAYOUT ---- */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---- HERO BANNER ---- */
.hero {
  background: linear-gradient(135deg, #1a1d27 0%, #12141f 100%);
  border-bottom: 1px solid var(--border);
  padding: 40px 24px;
  text-align: center;
}

.hero h1 {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 8px;
}

.hero h1 span { color: var(--accent); }

.hero p {
  color: var(--text-muted);
  font-size: 15px;
  max-width: 500px;
  margin: 0 auto 20px;
}

.hero-search {
  display: flex;
  max-width: 500px;
  margin: 0 auto;
  gap: 8px;
}

.hero-search input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--text);
  font-size: 15px;
  outline: none;
}

.hero-search input:focus { border-color: var(--accent); }

/* ---- PRODUCT GRID ---- */
.section {
  padding: 28px 0;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
}

.results-count {
  color: var(--text-muted);
  font-size: 13px;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
}

.product-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.product-img {
  width: 100%;
  aspect-ratio: 16/10;
  object-fit: cover;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 32px;
}

.product-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-info {
  padding: 12px;
}

.product-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-price {
  font-size: 18px;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 8px;
}

.product-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
}

.badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-instant { background: rgba(34,197,94,0.15); color: var(--green); }
.badge-hot { background: rgba(239,68,68,0.15); color: var(--red); }
.badge-new { background: rgba(59,130,246,0.15); color: var(--blue); }

.product-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 12px;
}

.seller-rating { color: var(--accent); }

/* ---- PRODUCT DETAIL PAGE ---- */
.product-detail {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
  padding: 28px 0;
}

.product-detail-img {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
  aspect-ratio: 16/9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 60px;
}

.product-detail-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-detail-info {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
}

.order-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: sticky;
  top: 80px;
}

.order-box h3 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.form-control:focus { border-color: var(--accent); }

.qty-control {
  display: flex;
  align-items: center;
  gap: 12px;
}

.qty-btn {
  width: 32px;
  height: 32px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s;
}

.qty-btn:hover { border-color: var(--accent); }

.order-total {
  margin: 16px 0;
  padding: 12px;
  background: var(--accent-dim);
  border-radius: var(--radius-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.order-total span:first-child { color: var(--text-muted); font-size: 13px; }
.order-total strong { font-size: 20px; color: var(--accent); }

.btn-buy {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-buy:hover { background: var(--accent-hover); }

/* ---- CART PAGE ---- */
.cart-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  padding: 28px 0;
}

.cart-items { display: flex; flex-direction: column; gap: 12px; }

.cart-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  gap: 14px;
  align-items: center;
}

.cart-item-img {
  width: 70px;
  height: 50px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.cart-item-details { flex: 1; }
.cart-item-title { font-weight: 600; margin-bottom: 4px; }
.cart-item-price { color: var(--accent); font-weight: 700; }

.cart-remove {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
  transition: color 0.2s;
}

.cart-remove:hover { color: var(--red); }

.cart-summary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: sticky;
  top: 80px;
  height: fit-content;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.summary-row:last-of-type { border-bottom: none; }
.summary-total { font-size: 18px; font-weight: 700; color: var(--accent); }

/* ---- TOAST ---- */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 20px;
  color: var(--text);
  font-size: 14px;
  z-index: 9999;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s;
}

.toast.show { transform: translateY(0); opacity: 1; }

/* ---- EMPTY STATE ---- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 8px; }

/* ---- LOADING ---- */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---- FOOTER ---- */
footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 40px;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .product-detail { grid-template-columns: 1fr; }
  .cart-layout { grid-template-columns: 1fr; }
  .hero h1 { font-size: 22px; }
  .product-grid { grid-template-columns: repeat(2, 1fr); }
  .navbar { padding: 0 14px; gap: 12px; }
}
