/* ==========================================================================
   Raphy's Art Shop · heavy Minecraft theme
   - Pixel font: "Press Start 2P" for headings/buttons, "VT323" for body
   - Backgrounds and borders are CSS-drawn block textures (no asset deps)
   ========================================================================== */

:root {
  --grass-top: #7cb342;
  --grass-top-2: #689f38;
  --dirt: #8b5a2b;
  --dirt-2: #6e4520;
  --dirt-3: #573719;
  --stone: #9a9a9a;
  --stone-2: #7a7a7a;
  --stone-3: #5a5a5a;
  --cobble-hi: #b0b0b0;
  --cobble-lo: #4a4a4a;
  --plank: #b6884c;
  --plank-2: #8c6332;
  --emerald: #2ecc71;
  --emerald-2: #1f8b4c;
  --emerald-3: #155d33;
  --redstone: #c0392b;
  --redstone-2: #8e2620;
  --gold: #f1c40f;
  --ink: #2b2b2b;
  --ink-soft: #4a4a4a;
  --paper: #efe6c8;
  --paper-2: #d9cea0;
  --shadow: rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'VT323', 'Courier New', monospace;
  font-size: 22px;
  color: var(--ink);
  image-rendering: pixelated;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Pixelated, tiled block backgrounds (pure CSS, no images) ----------
   The body uses a stack: a "grass top" stripe at the top, then a tiled dirt
   pattern below. Each block is 64px square. Inner pixels are drawn via radial
   and conic gradients for that chunky lit/shadowed look. */
.bg-grass {
  background-color: var(--dirt);
  background-image:
    /* dirt block specks layer */
    radial-gradient(circle at 12px 18px, var(--dirt-3) 0 3px, transparent 4px),
    radial-gradient(circle at 38px 8px,  var(--dirt-2) 0 3px, transparent 4px),
    radial-gradient(circle at 50px 44px, var(--dirt-3) 0 2px, transparent 3px),
    radial-gradient(circle at 22px 52px, var(--dirt-2) 0 4px, transparent 5px),
    radial-gradient(circle at 4px 36px,  var(--dirt-3) 0 2px, transparent 3px),
    /* tile separator grid for that block feel */
    linear-gradient(to right,  rgba(0,0,0,0.18) 0 2px, transparent 2px),
    linear-gradient(to bottom, rgba(0,0,0,0.18) 0 2px, transparent 2px);
  background-size: 64px 64px;
}

.mc-main {
  flex: 1;
  width: min(1200px, 96vw);
  margin: 24px auto;
  padding: 0 8px 48px;
}

/* ---------- Header (grass-block top bar) ---------- */
.mc-header {
  background:
    linear-gradient(to bottom, var(--grass-top) 0 22px, var(--grass-top-2) 22px 30px, var(--dirt) 30px 100%);
  border-bottom: 4px solid #000;
  box-shadow: 0 4px 0 0 rgba(0,0,0,0.4);
  position: relative;
}
.mc-header::before {
  /* darker pixel grid for grass texture */
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right,  rgba(0,0,0,0.15) 0 2px, transparent 2px),
    linear-gradient(to bottom, rgba(0,0,0,0.15) 0 2px, transparent 2px);
  background-size: 16px 16px;
  pointer-events: none;
}
.mc-header-inner {
  position: relative;
  width: min(1200px, 96vw);
  margin: 0 auto;
  padding: 14px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.mc-logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #fff;
  text-shadow: 3px 3px 0 #000, 0 0 0 #000;
  font-family: 'Press Start 2P', monospace;
  font-size: 18px;
  letter-spacing: 1px;
}
.mc-logo-icon {
  width: 36px; height: 36px;
  display: inline-block;
  background:
    linear-gradient(to bottom, var(--grass-top) 0 12px, var(--grass-top-2) 12px 16px, var(--dirt) 16px 100%);
  border: 3px solid #000;
  box-shadow: inset -3px -3px 0 0 rgba(0,0,0,0.25), inset 3px 3px 0 0 rgba(255,255,255,0.18);
  image-rendering: pixelated;
}
.mc-logo-text { white-space: nowrap; }

.mc-nav { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Buttons (3D Minecraft GUI style) ---------- */
.mc-btn {
  display: inline-block;
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  padding: 12px 18px;
  text-decoration: none;
  color: #fff;
  text-shadow: 2px 2px 0 #000;
  cursor: pointer;
  border: 3px solid #000;
  user-select: none;
  line-height: 1;
  letter-spacing: 1px;
  transition: transform 60ms linear;
}
.mc-btn:active { transform: translateY(2px); }

.mc-btn-stone {
  background: var(--stone);
  box-shadow:
    inset 3px 3px 0 0 var(--cobble-hi),
    inset -3px -3px 0 0 var(--cobble-lo),
    3px 3px 0 0 #000;
}
.mc-btn-stone:hover { background: #ababab; }

.mc-btn-emerald {
  background: var(--emerald);
  box-shadow:
    inset 3px 3px 0 0 #74e29e,
    inset -3px -3px 0 0 var(--emerald-3),
    3px 3px 0 0 #000;
}
.mc-btn-emerald:hover { background: #3ddb84; }

.mc-btn-redstone {
  background: var(--redstone);
  box-shadow:
    inset 3px 3px 0 0 #e57369,
    inset -3px -3px 0 0 var(--redstone-2),
    3px 3px 0 0 #000;
}
.mc-btn-redstone:hover { background: #cf4034; }

.mc-btn-lg { font-size: 14px; padding: 16px 22px; }
.mc-btn-sm { font-size: 10px; padding: 8px 12px; }

/* ---------- Hero / titles ---------- */
.mc-hero {
  text-align: center;
  margin: 16px 0 28px;
}
.mc-title {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(28px, 5vw, 48px);
  color: #fff;
  text-shadow: 4px 4px 0 #000, 0 0 0 #000;
  margin: 0 0 12px;
  letter-spacing: 2px;
}
.mc-subtitle {
  font-size: 26px;
  color: var(--paper);
  text-shadow: 2px 2px 0 #000;
  margin: 0;
}

/* ---------- Inventory grid (gallery) ---------- */
.mc-inventory {
  background: var(--stone);
  border: 4px solid #000;
  padding: 20px;
  box-shadow:
    inset 4px 4px 0 0 var(--cobble-hi),
    inset -4px -4px 0 0 var(--cobble-lo),
    6px 6px 0 0 var(--shadow);
}

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

.mc-slot {
  display: flex;
  flex-direction: column;
  background: var(--stone-2);
  border: 3px solid #000;
  padding: 8px;
  text-decoration: none;
  color: #fff;
  text-shadow: 2px 2px 0 #000;
  box-shadow:
    inset 3px 3px 0 0 var(--cobble-lo),
    inset -3px -3px 0 0 var(--cobble-hi);
  transition: transform 80ms ease;
}
.mc-slot:hover {
  transform: translate(-2px, -2px);
  box-shadow:
    inset 3px 3px 0 0 var(--cobble-lo),
    inset -3px -3px 0 0 var(--cobble-hi),
    4px 4px 0 0 #000;
}

.mc-slot-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #000;
  border: 3px solid #000;
  box-shadow: inset 2px 2px 0 0 #2a2a2a;
  overflow: hidden;
}
.mc-slot-frame img {
  width: 100%; height: 100%;
  object-fit: cover;
  image-rendering: auto;
  display: block;
}

.mc-slot-info {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 20px;
}
.mc-slot-title { font-family: 'VT323', monospace; }
.mc-slot-price {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  color: var(--gold);
  text-shadow: 2px 2px 0 #000;
}

.mc-tag {
  position: absolute;
  top: 6px; right: 6px;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  padding: 4px 6px;
  border: 2px solid #000;
  color: #fff;
  text-shadow: 1px 1px 0 #000;
  box-shadow: 2px 2px 0 0 #000;
}
.mc-tag-sold { background: var(--redstone); }
.mc-tag-large { font-size: 14px; padding: 8px 12px; display: inline-block; position: static; margin: 0 0 12px; }

/* ---------- Empty state ---------- */
.mc-empty {
  text-align: center;
  padding: 40px 20px;
  color: #fff;
  text-shadow: 2px 2px 0 #000;
}
.mc-empty p { margin: 8px 0; font-size: 26px; }
.mc-empty .mc-empty-sub { color: var(--paper); font-size: 22px; }

/* ---------- Piece detail ---------- */
.mc-piece { margin-top: 8px; }
.mc-back {
  display: inline-block;
  margin-bottom: 14px;
  color: var(--paper);
  text-shadow: 2px 2px 0 #000;
  text-decoration: none;
  font-size: 22px;
}
.mc-back:hover { color: #fff; }

.mc-piece-card {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 24px;
  background: var(--stone);
  border: 4px solid #000;
  padding: 20px;
  box-shadow:
    inset 4px 4px 0 0 var(--cobble-hi),
    inset -4px -4px 0 0 var(--cobble-lo),
    6px 6px 0 0 var(--shadow);
}
@media (max-width: 720px) {
  .mc-piece-card { grid-template-columns: 1fr; }
}

.mc-piece-frame {
  background: #000;
  border: 3px solid #000;
  box-shadow: inset 2px 2px 0 0 #2a2a2a;
}
.mc-piece-frame img {
  width: 100%; height: auto; display: block;
}

.mc-piece-info {
  background: var(--paper);
  border: 4px solid #000;
  padding: 18px;
  box-shadow: inset 3px 3px 0 0 #fff5d8, inset -3px -3px 0 0 var(--paper-2);
  color: var(--ink);
}
.mc-piece-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 18px;
  margin: 0 0 14px;
  color: var(--ink);
  text-shadow: none;
}
.mc-piece-price {
  font-family: 'Press Start 2P', monospace;
  font-size: 16px;
  color: var(--emerald-3);
  margin: 0 0 14px;
}
.mc-piece-desc {
  font-size: 22px;
  line-height: 1.4;
  white-space: pre-wrap;
  margin: 0 0 18px;
}

/* ---------- Admin panels & forms ---------- */
.mc-admin { color: #fff; text-shadow: 2px 2px 0 #000; }
.mc-admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.mc-panel {
  background: var(--paper);
  border: 4px solid #000;
  padding: 22px;
  box-shadow:
    inset 4px 4px 0 0 #fff5d8,
    inset -4px -4px 0 0 var(--paper-2),
    6px 6px 0 0 var(--shadow);
  color: var(--ink);
  text-shadow: none;
  max-width: 640px;
  margin: 0 auto;
}
.mc-panel-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 16px;
  margin: 0 0 16px;
  color: var(--ink);
}

.mc-form { display: flex; flex-direction: column; gap: 14px; }
.mc-label { display: flex; flex-direction: column; gap: 6px; }
.mc-label > span {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  color: var(--ink);
}
.mc-input {
  font-family: 'VT323', monospace;
  font-size: 22px;
  padding: 8px 10px;
  background: #fff;
  border: 3px solid #000;
  box-shadow: inset 2px 2px 0 0 #d8d8d8, inset -2px -2px 0 0 #fff;
  color: var(--ink);
  outline: none;
}
.mc-input:focus { box-shadow: inset 2px 2px 0 0 #d8d8d8, inset -2px -2px 0 0 #fff, 0 0 0 3px var(--emerald); }
.mc-textarea { font-family: 'VT323', monospace; resize: vertical; min-height: 80px; }
.mc-file { padding: 6px; }

.mc-checkbox { display: inline-flex; align-items: center; gap: 8px; font-size: 22px; color: var(--ink); }

.mc-form-actions {
  display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; flex-wrap: wrap;
}

/* ---------- Login page centering ---------- */
.mc-login { display: flex; justify-content: center; padding: 40px 0; }

/* ---------- Edit preview ---------- */
.mc-edit-preview {
  margin-bottom: 14px;
  border: 3px solid #000;
  background: #000;
  width: 200px; height: 200px;
  overflow: hidden;
}
.mc-edit-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- Admin table ---------- */
.mc-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--paper);
  border: 4px solid #000;
  color: var(--ink);
  text-shadow: none;
  box-shadow: 6px 6px 0 0 var(--shadow);
}
.mc-table th, .mc-table td {
  padding: 8px 10px;
  border-bottom: 2px solid #000;
  text-align: left;
  font-size: 20px;
}
.mc-table th {
  background: var(--plank);
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  color: #fff;
  text-shadow: 2px 2px 0 #000;
  border-bottom: 4px solid #000;
}
.mc-table tbody tr:nth-child(even) { background: var(--paper-2); }
.mc-table tbody tr:last-child td { border-bottom: 0; }
.mc-table a { color: var(--emerald-3); }
.mc-thumb-tiny { width: 48px; height: 48px; object-fit: cover; border: 2px solid #000; display: block; }
.mc-actions { white-space: nowrap; display: flex; gap: 6px; }

/* ---------- Flash messages ---------- */
.mc-flash {
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  border: 3px solid #000;
  padding: 12px 14px;
  margin-bottom: 16px;
  color: #fff;
  text-shadow: 2px 2px 0 #000;
  box-shadow: 4px 4px 0 0 var(--shadow);
}
.mc-flash-ok  { background: var(--emerald-2); }
.mc-flash-err { background: var(--redstone); }

/* ---------- Error pages ---------- */
.mc-error {
  text-align: center;
  padding: 48px 20px;
  color: #fff;
  text-shadow: 3px 3px 0 #000;
}
.mc-error p { font-size: 26px; margin: 8px 0 24px; }

/* ---------- Footer (cobblestone) ---------- */
.mc-footer {
  margin-top: auto;
  background: var(--stone);
  border-top: 4px solid #000;
  background-image:
    radial-gradient(circle at 8px 8px,  var(--cobble-lo) 0 3px, transparent 4px),
    radial-gradient(circle at 22px 18px, var(--cobble-hi) 0 3px, transparent 4px),
    radial-gradient(circle at 34px 6px, var(--cobble-lo) 0 2px, transparent 3px),
    radial-gradient(circle at 14px 28px, var(--cobble-hi) 0 2px, transparent 3px);
  background-size: 48px 48px;
}
.mc-footer-inner {
  width: min(1200px, 96vw);
  margin: 0 auto;
  padding: 18px 8px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 20px;
  color: #fff;
  text-shadow: 2px 2px 0 #000;
}

/* ---------- Mobile tweaks ---------- */
@media (max-width: 540px) {
  .mc-logo { font-size: 14px; }
  .mc-btn { font-size: 11px; padding: 10px 12px; }
  .mc-btn-lg { font-size: 12px; padding: 14px 16px; }
  .mc-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .mc-table { display: block; overflow-x: auto; }
}
