/* =========================
   Cardapalooza — unified dark theme
   ========================= */

/* ---- CSS variables ---- */
:root{
  --bg:#0b1220;            /* page background */
  --panel:#121a2b;         /* card/panel background */
  --panel-border:#243249;  /* panel border */
  --divider:#223149;       /* dashed divider */
  --field-bg:#0e1626;      /* inputs */
  --field-border:#2a3a57;
  --field-focus:#6b8cff;   /* focus ring/outline */
  --text:#e7ecff;
  --muted:#9fb3d9;
  --accent:#9ecbff;        /* primary accent */
  --accent-hover:#86bbff;
  --accent-text:#ffffff;
  --btn-muted-bg:#222a3a;  /* secondary/cancel */
  --btn-muted-bd:#364563;
  --btn-muted-tx:#d0dbff;
}

/* ---- Base ---- */
body{
  background:var(--bg);
  color:var(--text);
  font-family:'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI',
              Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue',
              sans-serif;
  padding-top:0;
}

/* =========================
   Header / Logo
   ========================= */
.logo-header{
  width:100%;
  display:flex;
  justify-content:center;
  align-items:center;
  line-height:0;                 /* remove extra inline spacing */
  margin:8px 0 6px;
}

/* Cap and center logo images (handle various markup) */
.logo-header img,
img.site-logo,
header .logo img,
#logo img,
img#site-logo,
.brand img{
  display:block !important;
  margin:12px auto 8px !important;
  height:auto !important;
  width:auto !important;
  max-height:84px !important;    /* tweak this to resize the logo */
  max-width:360px !important;
}

/* =========================
   Panels / Forms
   ========================= */
.form-card{
  background:var(--panel);
  border:1px solid var(--panel-border);
  border-radius:12px;
  padding:16px;
}

label{display:block;margin-bottom:6px;font-weight:600;color:var(--text);}
.help,.meta{font-size:12px;color:var(--muted);}

/* Inputs */
input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea{
  padding:10px;
  border-radius:8px;
  border:1px solid var(--field-border);
  background:var(--field-bg);
  color:var(--text);
}
textarea{min-height:90px;}

input:focus,select:focus,textarea:focus{
  outline:2px solid var(--field-focus);
  outline-offset:0;
}

/* Datalist normalization */
input[list]{appearance:none;-webkit-appearance:none;background:var(--field-bg);
  border:1px solid var(--field-border);border-radius:8px;color:var(--text);padding:10px;}

/* Placeholders & autofill */
input::placeholder{color:var(--muted);opacity:1;}
input:-webkit-autofill,
input:-webkit-autofill:focus{
  -webkit-box-shadow:0 0 0 1000px var(--field-bg) inset;
  -webkit-text-fill-color:var(--text);
  caret-color:var(--text);
  transition:background-color 9999s ease-in-out 0s;
}

/* Dividers */
hr.form-divider{
  border:0;border-top:1px dashed var(--divider);margin:14px 0;
}

/* Alerts */
.alert.err{
  background:#3b0f12;border:1px solid #7a1b22;color:#ffd1d6;
  padding:10px;border-radius:8px;margin-bottom:12px;
}
.alert.ok{
  background:#0e1a12;border:1px solid #1f3b2a;color:#d6ffe4;
  padding:10px;border-radius:8px;margin-bottom:12px;
}

/* Actions & Buttons */
.actions{display:flex;gap:10px;justify-content:center;margin-top:16px;}
button{
  padding:10px 18px;border-radius:10px;border:1px solid var(--accent);
  background:var(--accent);color:var(--accent-text);cursor:pointer;
}
button:hover{background:var(--accent-hover);border-color:var(--accent-hover);}
.btn-secondary{
  background:var(--btn-muted-bg);color:var(--btn-muted-tx);border:1px solid var(--btn-muted-bd);
}
.btn-secondary:hover{filter:brightness(1.1);}

/* Calculated/readonly total */
input.total-auto[readonly]{
  font-weight:700;color:var(--accent);
  background-color:rgba(255,255,255,0.05);
  cursor:not-allowed;text-align:center;
}

/* =========================
   Search / Filter bar
   ========================= */
.search-bar{ text-align:center; margin:10px 0 16px; }

.filter-bar{
  display:flex;flex-wrap:wrap;justify-content:center;align-items:center;
  gap:8px 12px;margin-top:8px;
}
.filter-bar label{
  display:inline-flex;align-items:center;gap:6px;white-space:nowrap;margin:0 4px;
}
.filter-bar input[type="number"]{ width:90px; }
.filter-bar select{ min-width:150px; }

/* =========================
   Home: Card grid
   ========================= */
.card-grid{
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  gap:16px;
  margin:0 auto;
}
.card-grid .card{
  flex:1 1 220px;              /* min width ~220px; auto-fit columns */
  max-width:280px;
  display:flex;
  flex-direction:column;

  /* placard surface */
  background: var(--panel) !important;
  border: 1px solid var(--panel-border) !important;
  border-radius: 12px;
  padding: 10px;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.card-grid .card:hover{
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 6px 16px rgba(0,0,0,.25);
}

/* Uniform image frame (“mat”) */
.card-grid .card > a:first-of-type{
  display:block;
  background: var(--bg);       /* page background around the photo/scan */
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  aspect-ratio: 3 / 4;         /* consistent tile height */
  padding: 8px;
  overflow: hidden;
}

/* FORCE the image to live inside the frame */
.card-grid .card > a:first-of-type > img.card-img{
  display:block;
  width:100% !important;
  height:100% !important;      /* override any height:auto elsewhere */
  object-fit: contain !important;
}

/* player/title */
.card-grid .player-name{
  margin: 6px 0 2px;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.2;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;           /* clamp long names to 2 lines */
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* condition badge */
.card-grid .card-condition{
  display: inline-block;
  margin: 0 0 6px;
  padding: 2px 8px;
  font-size: 12px;
  color: #e9eeff;
  background: #1b2340;
  border: 1px solid #33446a;
  border-radius: 999px;
}

/* details text */
.card-grid .card-details p{
  margin: 2px 0;
  color: #c3d0f2;              /* brighter than --muted for readability */
  font-size: 13px;
}

/* platform badges row (optional) */
.platform-badges{ display:flex; gap:6px; margin:6px 0 2px; }
.pf-icon{ width:18px; height:18px; opacity:.9; vertical-align:middle; }
.pf-icon:hover{ opacity:1; }

/* price + button */
.card-grid .card-price{
  margin: 6px 0 4px;
  color: #90b6ff;              /* readable accent */
  font-weight: 800;
  font-size: 18px;
}
.card-grid .card form button{
  width: 100%;
  margin-top: 4px;
  background: #2c3f7a !important;
  border-color: #3f57aa !important;
  color: #fff !important;
}
.card-grid .card form button:hover{
  background: #364f95 !important;
  border-color: #4d6ad1 !important;
}
/* Explicit image frame so the dark mat always shows */
.card-grid .img-frame{
  display:block;
  background: var(--bg);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  aspect-ratio: 3 / 4;   /* consistent tile height */
  padding: 8px;
  overflow: hidden;
}
.card-grid .img-frame > img.card-img{
  display:block;
  width:100% !important;
  height:100% !important;     /* override any height:auto elsewhere */
  object-fit: contain !important;
}
/* Guaranteed dark “mat” around every image */
.card-grid .img-frame{ display:block; }

.card-grid .img-frame .img-mat{
  display:block;
  background: var(--bg) !important;         /* force dark, not white */
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 8px;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  box-sizing: border-box;
}

/* Image fills the mat but never crops */
.card-grid .img-frame .img-mat > img.card-img{
  display:block;
  width:100% !important;
  height:100% !important;
  object-fit: contain !important;
  background: transparent !important;       /* defeat any old white bg rules */
}

/* Keep price + button aligned to bottom across cards */
.card-grid .card { display:flex; flex-direction:column; }
.card-grid .card-price { margin-top:auto; }   /* pushes price+button down */
/* Photo hover zoom (subtle; no layout shift) */
.card-grid .img-frame .img-mat > img.card-img{
  transition: transform .18s ease, filter .18s ease;
  will-change: transform;
}
.card-grid .card:hover .img-frame .img-mat > img.card-img,
.card-grid .img-frame:focus-visible .img-mat > img.card-img{
  transform: scale(1.07);
  filter: saturate(1.05);
}

/* Respect reduced-motion */
@media (prefers-reduced-motion: reduce){
  .card-grid .img-frame .img-mat > img.card-img{ transition: none; }
}
