/* ── Wheel-Spin Generator admin — dark UI ── */

:root {
  --bg:       #0d1117;
  --bg-soft:  #161b22;
  --bg-card:  #1a2029;
  --border:   #2d333b;
  --text:     #e6edf3;
  --muted:    #9aa5b1;   /* lifted for readable hint text */
  --accent:   #4f8ff7;
  --gold:     #f0b429;
  --ok:       #3fb950;
  --err:      #f85149;
}

* { box-sizing: border-box; }

/* The hidden attribute must always beat display:flex/block rules below. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 'Segoe UI', system-ui, sans-serif;
}

.h2 { margin: 0; font-size: 24px; }
.muted { color: var(--muted); }
.mono { font-family: Consolas, monospace; font-size: 14px; }

/* ── Login ── */
.login {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
}
.login__card {
  width: 360px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px 28px;
  display: flex; flex-direction: column; gap: 16px;
}
.login__title { margin: 0 0 4px; font-size: 21px; text-align: center; }
.login__error { margin: 0; color: var(--err); font-size: 15px; text-align: center; }

/* ── Topbar ── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 22px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar__brand { font-weight: 700; font-size: 17px; cursor: pointer; }

/* ── Controls ── */
.input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
  font-size: 15px;
  outline: none;
}
.input:focus { border-color: var(--accent); }
.textarea { resize: vertical; line-height: 1.55; }

.btn {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 16px;
  font: inherit;
  font-size: 15px;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn--primary:hover { filter: brightness(1.1); border-color: var(--accent); }
.btn--gold { background: var(--gold); border-color: var(--gold); color: #1a1200; font-weight: 700; }
.btn--gold:hover { filter: brightness(1.08); border-color: var(--gold); }
.btn--ghost { background: transparent; }
.btn--sm { padding: 5px 11px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Styled file picker — the native input renders its own localized
   "Choose file / No file chosen" text, which would leak the browser's
   language into the UI. Hide it and drive it from this label instead. */
.file-btn {
  display: inline-flex;
  align-items: center;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 15px;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}
.file-btn:hover { border-color: var(--muted); }
.file-btn input[type="file"] {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ── List view ── */
.container { max-width: 1060px; margin: 0 auto; padding: 28px 22px; }
.list-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th, .table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.table tr:hover td { background: rgba(255,255,255,0.02); }
.table .row-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ── Editor layout ── */
.editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 415px;
  gap: 22px;
  padding: 22px;
  max-width: 1480px;
  margin: 0 auto;
}
.editor__form { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.editor__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.editor__head-actions { display: flex; gap: 8px; }

.editor__preview { position: relative; }
.preview-frame {
  position: sticky; top: 72px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #000;
}
.preview-frame__bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
}
.preview-frame iframe {
  display: block;
  width: 375px;
  height: calc(100vh - 150px);
  min-height: 500px;
  border: 0;
  margin: 0 auto;
  background: #000;
}

/* ── Cards / fields ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px 20px;
  margin: 0;
  display: flex; flex-direction: column; gap: 16px;
}
.card legend {
  padding: 0 8px;
  font-weight: 700;
  font-size: 15px;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; }
.row .input { flex: 1; }

.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field__label {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
/* Helper text under inputs — the main readability fix. */
.field__hint {
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}
.field--color input[type="color"] {
  width: 100%; height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  padding: 2px;
  cursor: pointer;
}

.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer;
  font-size: 15px;
}
.check input { accent-color: var(--accent); width: 17px; height: 17px; }

.logo-preview {
  height: 40px; max-width: 130px;
  object-fit: contain;
  background: #2a0005;
  border-radius: 6px;
  padding: 3px 6px;
}
.asset-preview {
  height: 48px; max-width: 76px;
  object-fit: contain;
  background: #10060a;
  border-radius: 6px;
  padding: 3px;
}

/* ── Payment library ── */
.pm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
/* empty-library note must span the whole grid, not sit in one narrow column */
.pm-empty { grid-column: 1 / -1; color: var(--muted); font-size: 14px; }

.pm-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 11px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  position: relative;
  font-size: 14px;
}
.pm-item--on { border-color: var(--accent); background: rgba(79,143,247,0.08); }
.pm-item img {
  height: 24px; max-width: 48px;
  object-fit: contain;
  background: #10060a;
  border-radius: 4px;
  padding: 2px;
}
.pm-item__name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-item__del {
  border: 0; background: none; color: var(--muted);
  cursor: pointer; font-size: 15px; padding: 0 2px;
}
.pm-item__del:hover { color: var(--err); }
.pm-upload { flex-wrap: wrap; }
.pm-upload .input { max-width: 220px; }

/* ── Parse info ── */
.parse-info {
  margin-top: 8px;
  padding: 12px 14px;
  background: rgba(79,143,247,0.07);
  border: 1px solid rgba(79,143,247,0.3);
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.6;
}
.parse-info__row { color: var(--text); }
.parse-info__row b { color: var(--gold); }
.parse-info__snippet {
  color: var(--muted);
  font-style: italic;
  display: block;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Notices ── */
.notice {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 15px;
}
.notice--ok  { background: rgba(63,185,80,0.12);  border: 1px solid rgba(63,185,80,0.4); }
.notice--err { background: rgba(248,81,73,0.12);  border: 1px solid rgba(248,81,73,0.4); color: #ffb4ae; }
.notice a { color: var(--ok); font-weight: 600; }

/* ── Responsive ── */
@media (max-width: 1150px) {
  .editor { grid-template-columns: 1fr; }
  .preview-frame { position: static; }
  .preview-frame iframe { height: 700px; }
}
@media (max-width: 700px) {
  .grid2, .grid3, .grid5, .checks { grid-template-columns: 1fr; }
}
