/* StoneBloom Inventory Restoration Form */

:root {
  --purple:      #a06be8;
  --purple-dark: #c4a0f0;
  --purple-lite: #7a3ec8;

  --bg:       #120e1e;
  --bg-panel: #1c1830;
  --bg-input: #0e0b1a;

  --border:     #3a2d60;
  --text:       #e8e0ff;
  --text-dim:   #b8a0e0;
  --text-muted: #7060a0;

  --green: #34d399;
  --red:   #f87171;

  --inv-w: 528px;
  --inv-h: 235px;
  --slot:  54px;

  --slot-hover: rgba(160, 107, 232, 0.15);
  --slot-over:  rgba(160, 107, 232, 0.28);
  --slot-rm:    rgba(220, 60, 60, 0.25);
}

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

html { font-size: 16px; font-family: system-ui, sans-serif; }

body {
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* Buttons */
.btn {
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 8px 16px;
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { cursor: not-allowed; opacity: 0.45; }

.btn-primary {
  background: var(--purple);
  border-color: var(--purple-dark);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--purple-dark); }

.btn-secondary {
  background: var(--bg-input);
  border-color: var(--border);
  color: var(--text-dim);
}
.btn-secondary:hover:not(:disabled) { border-color: var(--purple); color: var(--purple); }

.btn-danger {
  background: transparent;
  border-color: var(--red);
  color: var(--red);
}
.btn-danger:hover:not(:disabled) { background: var(--red); color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
}
.btn-ghost:hover:not(:disabled) { color: var(--purple); }

.btn-sm   { padding: 4px 10px; font-size: 0.8rem; }
.btn-lg   { padding: 11px 24px; font-size: 1rem; }
.btn-full { width: 100%; }

/* Form elements */
.form-label { font-size: 0.8rem; font-weight: 600; color: var(--text-dim); }

.form-input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  padding: 8px 12px;
  width: 100%;
  outline: none;
}
.form-input:focus { border-color: var(--purple); }
.form-input::placeholder { color: var(--text-muted); }

.form-error { color: var(--red); font-size: 0.8rem; }

/* Card */
.card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 18px;
}

/* Spinner */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  display: inline-block;
}

/* Page shell */
#app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Header */
.page-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.page-header-text { flex: 1; }
.page-header h1 { font-size: 1.4rem; font-weight: 700; color: var(--text); }
.page-header p { color: var(--text-muted); font-size: 0.875rem; margin-top: 3px; }

/* Main layout */
main { display: flex; gap: 16px; align-items: flex-start; }

/* Search panel */
#search-panel {
  flex: 0 0 220px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#search-panel h2 {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

#search-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  padding: 7px 10px;
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
}
#search-input:focus { border-color: var(--purple); }
#search-input::placeholder { color: var(--text-muted); }

#item-list {
  overflow-y: auto;
  max-height: 480px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.item-result {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 6px;
  border-radius: 2px;
  cursor: grab;
  user-select: none;
  border: 1px solid transparent;
}
.item-result:hover  { background: var(--bg-input); border-color: var(--border); }
.item-result:active { cursor: grabbing; }
.item-result img {
  width: 28px; height: 28px;
  image-rendering: pixelated;
  flex-shrink: 0;
}
.item-result span {
  font-size: 0.78rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Inventory panel */
#inventory-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#inventory-panel h2 {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}
.hint { font-size: 0.75rem; color: var(--text-muted); }

#inventory-wrap { display: flex; justify-content: center; }

#inventory-bg {
  width: var(--inv-w);
  height: var(--inv-h);
  background-image: url('/textures/shulker_box.png');
  background-size: 100% 100%;
  image-rendering: pixelated;
  position: relative;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

/* Inventory slots */
.inv-slot {
  position: absolute;
  width: var(--slot);
  height: var(--slot);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  border-radius: 2px;
}
.inv-slot:hover          { background: var(--slot-hover); }
.inv-slot.drag-over      { background: var(--slot-over); outline: 2px solid var(--purple-lite); }
.inv-slot.occupied       { cursor: pointer; }
.inv-slot.occupied:hover { background: var(--slot-rm); }

.inv-slot img {
  width: 80%; height: 80%;
  image-rendering: pixelated;
  pointer-events: none;
}
.inv-slot .item-count {
  position: absolute;
  bottom: 2px; right: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  text-shadow: 1px 1px 0 #000, -1px 1px 0 #000, 1px -1px 0 #000, -1px -1px 0 #000;
  pointer-events: none;
  font-family: monospace;
  line-height: 1;
}

/* Form panel */
#form-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field-row { display: flex; gap: 16px; flex-wrap: wrap; }

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-width: 200px;
}

.field label { font-size: 0.8rem; font-weight: 600; color: var(--text-dim); }

.field input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  padding: 8px 12px;
  width: 100%;
  outline: none;
}
.field input:focus { border-color: var(--purple); }
.field input::placeholder { color: var(--text-muted); }
.field small { font-size: 0.75rem; color: var(--text-muted); min-height: 14px; }

.input-with-status { display: flex; align-items: center; gap: 6px; }
.input-with-status input { flex: 1; }

.status-icon { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; }

.mc-avatar {
  width: 34px; height: 34px;
  image-rendering: pixelated;
  border-radius: 2px;
  flex-shrink: 0;
}
.mc-avatar.hidden { display: none; }

#submit-btn { align-self: flex-end; }

/* Amount modal */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
#modal-overlay.hidden { display: none; }

#modal {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 20px;
  width: 280px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#modal-item-preview { display: flex; align-items: center; gap: 10px; }
#modal-icon { width: 38px; height: 38px; image-rendering: pixelated; }
#modal-name { font-size: 0.95rem; font-weight: 600; color: var(--text); }

#modal label { font-size: 0.75rem; font-weight: 600; color: var(--text-dim); }

#modal-amount {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  padding: 8px 10px;
  font-size: 1.1rem;
  font-family: monospace;
  outline: none;
  text-align: center;
}
#modal-amount:focus { border-color: var(--purple); }

.modal-buttons { display: flex; gap: 8px; }
.modal-buttons button { flex: 1; }

/* Admin login */
#login-panel {
  max-width: 340px;
  margin: 60px auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
#login-panel h1 { font-size: 1.2rem; font-weight: 700; color: var(--text); text-align: center; }
#login-panel p  { color: var(--text-muted); font-size: 0.85rem; text-align: center; }

#pin-input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  padding: 10px;
  font-size: 1.2rem;
  outline: none;
  width: 100%;
  text-align: center;
  letter-spacing: 6px;
  font-family: monospace;
}
#pin-input:focus { border-color: var(--purple); }

#login-error { color: var(--red); font-size: 0.8rem; text-align: center; min-height: 16px; }

/* Admin panel */
#admin-panel { display: flex; flex-direction: column; gap: 16px; }

.admin-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.admin-header h1 { font-size: 1.15rem; font-weight: 700; color: var(--text); flex: 1; margin: 0; }
#submissions-count { color: var(--text-muted); font-size: 0.8rem; font-weight: 600; }

/* Admin carousel */
#carousel-area { display: flex; flex-direction: column; gap: 14px; }

.carousel-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.carousel-nav-btn { padding: 7px 16px; }

#carousel-pos {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  min-width: 50px;
  text-align: center;
  white-space: nowrap;
}

#player-select {
  flex: 1;
  min-width: 180px;
  max-width: 360px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 7px 10px;
  outline: none;
  cursor: pointer;
}
#player-select:focus { border-color: var(--purple); }

/* Submission card */
.submission-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card-header { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.card-info   { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.card-username { font-size: 1.15rem; font-weight: 700; color: var(--text); }
.card-discord  { font-size: 0.85rem; color: var(--text-dim); }
.card-uuid     { font-size: 0.72rem; font-family: monospace; color: var(--text-muted); }
.card-ts       { font-size: 0.75rem; color: var(--text-muted); }
.card-items    { font-size: 0.8rem; font-weight: 700; color: var(--purple); margin-top: 2px; }
.card-actions  { display: flex; gap: 6px; align-items: flex-start; flex-shrink: 0; }

/* Admin inventory (read-only) */
#admin-inv-wrap { display: flex; justify-content: center; }

#admin-inv-bg {
  width: var(--inv-w);
  height: var(--inv-h);
  background-image: url('/textures/shulker_box.png');
  background-size: 100% 100%;
  image-rendering: pixelated;
  position: relative;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.admin-inv-slot {
  position: absolute;
  width: var(--slot);
  height: var(--slot);
  display: flex;
  align-items: center;
  justify-content: center;
}
.admin-inv-slot img {
  width: 80%; height: 80%;
  image-rendering: pixelated;
  pointer-events: none;
}
.admin-inv-slot .item-count {
  position: absolute;
  bottom: 2px; right: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  text-shadow: 1px 1px 0 #000, -1px 1px 0 #000, 1px -1px 0 #000, -1px -1px 0 #000;
  pointer-events: none;
  font-family: monospace;
  line-height: 1;
}

/* Admin edit modal */
#edit-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
#edit-overlay.hidden { display: none; }

#edit-modal {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 24px;
  width: 540px;
  max-width: 95vw;
  max-height: 88vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
#edit-modal h2 { font-size: 1rem; font-weight: 700; color: var(--text); }
.edit-meta     { font-size: 0.78rem; color: var(--text-muted); font-family: monospace; }
.edit-lbl      { font-size: 0.75rem; font-weight: 600; color: var(--text-dim); margin-bottom: 4px; }

#edit-discord {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  font-family: inherit;
  padding: 8px 12px;
  font-size: 0.9rem;
  outline: none;
  width: 100%;
}
#edit-discord:focus { border-color: var(--purple); }

#edit-inventory {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  padding: 8px 10px;
  font-size: 0.8rem;
  font-family: monospace;
  outline: none;
  width: 100%;
  height: 230px;
  resize: vertical;
}
#edit-inventory:focus { border-color: var(--purple); }

.inv-hint   { font-size: 0.75rem; color: var(--text-muted); }
#edit-error { color: var(--red); font-size: 0.8rem; min-height: 16px; }
.edit-footer { display: flex; gap: 8px; justify-content: flex-end; }

/* Utilities */
.hidden  { display: none !important; }
.no-data {
  color: var(--text-muted);
  padding: 48px 20px;
  text-align: center;
  font-size: 0.9rem;
}

/* Evidence upload (player form) */
#evidence-section { display: flex; flex-direction: column; gap: 5px; }

.evidence-label-row { display: flex; align-items: baseline; gap: 8px; }
.evidence-label-row label { font-size: 0.8rem; font-weight: 600; color: var(--text-dim); }

.optional-tag { font-size: 0.75rem; color: var(--text-muted); }

#evidence-status {
  font-size: 0.75rem;
  color: var(--text-muted);
  flex: 1;
  text-align: right;
}
.evidence-status-ok    { color: var(--green) !important; }
.evidence-status-error { color: var(--red)   !important; }

#evidence-drop-zone {
  border: 1px dashed var(--border);
  border-radius: 3px;
  background: var(--bg-input);
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
}
#evidence-drop-zone:hover,
#evidence-drop-zone.drag-active { border-color: var(--purple); }

#evidence-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 14px;
  text-align: center;
}
.evidence-hint-text { font-size: 0.85rem; color: var(--text-dim); }
.evidence-hint-sub  { font-size: 0.72rem; color: var(--text-muted); }

.link-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: var(--purple);
  cursor: pointer;
  text-decoration: underline;
}
.link-btn:hover { color: var(--purple-dark); }

#evidence-preview-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  width: 100%;
}

#evidence-preview {
  height: 68px;
  max-width: 200px;
  object-fit: cover;
  border-radius: 2px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

/* Evidence display (admin card) */
.evidence-section { display: flex; flex-direction: column; gap: 8px; }

.evidence-heading {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.evidence-img-wrap { display: flex; align-items: flex-start; }

.evidence-loading { font-size: 0.8rem; color: var(--text-muted); padding: 6px 0; }

.evidence-img {
  max-width: 100%;
  max-height: 400px;
  object-fit: contain;
  border: 1px solid var(--border);
  cursor: zoom-in;
}
