/* /css/styles.css
   Cardapalooza — consolidated baseline styles
   Goals:
   - Stop "giant everything" surprises
   - Make index card images edge-to-edge (no padding around image area)
   - Keep rules scoped to avoid collateral damage
*/

/* ---------- Base / Reset-ish ---------- */
html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: Arial, sans-serif;
  padding: 20px;
  box-sizing: border-box;
}

*, *::before, *::after {
  box-sizing: border-box;
}

/* Do NOT globally force every image to block/100% (it can break other layouts).
   Keep image behavior scoped where needed. */


/* ---------- Header / Logo ---------- */
.logo-header {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 8px 0 18px;
}

.site-logo {
  max-width: 520px;
  width: 100%;
  height: auto;
  display: block;
}


/* ---------- Cart Icon ---------- */
.cart-icon-container {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 16px;
}

.cart-link {
  position: relative;
  text-decoration: none;
  color: inherit;
}

.cart-count {
  position: absolute;
  top: -10px;
  right: -10px;
  background: red;
  color: white;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 50%;
}


/* ---------- Search Bar ---------- */
.search-bar {
  text-align: center;
  margin: 0 auto 20px;
}

.search-bar form {
  display: inline-block;
  max-width: 980px;
  width: 100%;
}

.search-bar input[type="text"] {
  padding: 10px;
  width: min(520px, 70vw);
  font-size: 16px;
}

.search-bar button {
  padding: 10px 14px;
  font-size: 16px;
  cursor: pointer;
}

.search-button,
.reset-button {
  padding: 10px 14px;
  font-size: 16px;
  height: 42px;
  line-height: 1;
  background-color: #eee;
  color: #333;
  border: 1px solid #ccc;
  border-radius: 6px;
  cursor: pointer;
  vertical-align: middle;
  transition: background-color 0.2s ease;
}

.search-button:hover,
.reset-button:hover {
  background-color: #ddd;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  justify-content: center;
  align-items: center;
  margin-top: 14px;
}

.filter-bar input[type="number"] {
  width: 95px;
  padding: 8px;
}

.filter-bar select {
  padding: 8px;
  min-width: 140px;
}


/* ---------- Card Grid (INDEX) ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  justify-items: center;
  align-items: start;

  max-width: 1200px;
  margin: 0 auto;
  padding: 0;
}

/* Card tile */
.card-grid .card {
  width: 100%;
  max-width: 320px;

  display: flex;
  flex-direction: column;

  border: 1px solid #ccc;
  border-radius: 10px;
  background-color: #f9f9f9;

  overflow: hidden;          /* IMPORTANT: makes image flush to rounded border */
  text-align: center;
  transition: transform 0.2s ease;
}

.card-grid .card:hover {
  transform: scale(1.03);
}

/* Title/condition have padding, NOT the image area */
.card-grid .card h2.player-name {
  font-size: 0.9rem;
  font-weight: 700;
  margin: 10px 12px 6px;
  white-space: normal;
  word-wrap: break-word;
}

.card-grid .card .card-condition {
  font-size: 0.8rem;
  font-style: italic;
  color: #666;
  margin: 0 12px 10px;
}

/* ---------- EDGE-TO-EDGE IMAGE AREA ---------- */
/*
  Your HTML currently is basically:
    <a ...>
      <img src="...">
    </a>

  This block forces:
  - link = block (so no inline weirdness)
  - image = full width of card, no max-width, no margins
  - image area is flush to the card edges
*/
.card-grid .card a {
  display: block;
  text-decoration: none;
  color: inherit;
}

/* If you add a wrapper later (recommended), it will still work */
.card-grid .card .card-media,
.card-grid .card .card-image {
  width: 100%;
  margin: 0;
  padding: 0;
  line-height: 0;            /* removes tiny inline-image gaps */
}

/* If your index uses <img> directly (no wrapper), still works */
.card-grid .card a > img,
.card-grid .card .card-media img,
.card-grid .card .card-image img,
.card-grid .card img.card-img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  padding: 0;
  border-radius: 0;          /* IMPORTANT: prevents “fake padding” look */
  background: transparent;
}

/* If you WANT a fixed-height image window without padding (optional):
   uncomment these 2 blocks. It will keep tiles uniform but may add letterboxing
   INSIDE the image area if aspect ratio differs.

.card-grid .card a {
  height: 320px;
}
.card-grid .card a > img {
  height: 100%;
  object-fit: contain;
}
*/


/* Details under image */
.card-grid .card-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px 0;
}

.card-grid .card-details p {
  margin: 0.15rem 0;
  font-size: 0.8rem;
  word-wrap: break-word;
}

.card-grid .card-price {
  margin: 10px 12px 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: #1b5e20;
}

/* Add to cart area */
.card-grid .card a {
  display: flex;
  justify-content: center;
  align-items: center;

  /* this sets the visual "slot" height */
  height: 280px;

  /* keep it clean */
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.card-grid .card button {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;

  border-radius: 8px;
  border: 1px solid #aaa;
  background: #fff;
}


/* ---------- Card Detail Page ---------- */
.card-detail {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

.card-images {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 20px 0;
  flex-wrap: wrap;
}

/* INDEX: never crop card images */
.card-grid .card a {
  height: auto !important;
  overflow: visible !important;
}

.card-grid .card a > img {
  height: auto !important;
  max-height: none !important;
  object-fit: contain;
}


.card-detail-img {
  max-width: 320px;
  height: auto;
  border-radius: 10px;
  border: 1px solid #ccc;
  display: block;
}
 /* the actual image */
.card-grid .card a > img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  max-height: 100%;
}

/* ---------- Tables ---------- */
table {
  width: min(1000px, 92vw);
  margin: 0 auto;
  border-collapse: collapse;
}

th, td {
  padding: 12px;
  border: 1px solid #ccc;
}


/* ---------- Checkout ---------- */
.checkout-form {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

.checkout-form label {
  font-weight: bold;
  display: block;
  margin-top: 15px;
}

.checkout-form input[type="text"],
.checkout-form input[type="email"],
.checkout-form input[type="number"] {
  width: 100%;
  padding: 10px;
  margin-top: 6px;
}

.checkout-form .form-row {
  display: flex;
  gap: 15px;
  margin-top: 10px;
}

.checkout-form .form-row > div {
  flex: 1;
}

.checkout-form button {
  margin: 30px auto 0;
  display: block;
  padding: 12px 22px;
  font-size: 16px;
  background-color: #1b5e20;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}


/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  body { padding: 14px; }

  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
  }

  .card-grid .card {
    max-width: 320px;
  }
}
