@import url('https://fonts.googleapis.com/css2?family=Syne:wght@700;800&family=IBM+Plex+Mono:wght@400;600&family=Outfit:wght@400;500;600&display=swap');

:root {
  --bg: #0a0a0e;
  --panel: #111116;
  --panel2: #18181f;
  --border: #26262e;
  --gold: #f5c842;
  --green: #3ddc84;
  --red: #f0605a;
  --text: #ededf5;
  --sub: #7a7a95;
}

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

body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ---------- HEADER ---------- */
header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.logo-box {
  width: 45px;
  height: 45px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
}

.logo-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.logo-text {
  font-weight: 700;
  font-size: 18px;
}

.logo-text span { color: var(--gold); }

.logo-sub {
  font-size: 12px;
  color: var(--sub);
}

.step-indicator {
  margin-left: auto;
  display: flex;
  gap: 8px;
  font-size: 12px;
  color: var(--sub);
  flex-wrap: wrap;
}

.step {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel2);
}

.step.active {
  background: var(--gold);
  color: #1a1a20;
  border-color: var(--gold);
  font-weight: 600;
}

.step.done {
  border-color: var(--green);
  color: var(--green);
}

/* ---------- LAYOUT ---------- */
.wrap {
  max-width: 900px;
  margin: auto;
  padding: 20px;
}

.page { display: none; }
.page.active { display: block; }

/* ---------- FORM CARD ---------- */
.form-card {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 18px;
  border-radius: 12px;
  margin-bottom: 20px;
}

.form-card h3 {
  margin-bottom: 8px;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.row-actions .grow { flex: 1; }
.row-actions h3 { margin-bottom: 2px; }
.row-actions .hint { margin-bottom: 0; }

.hint {
  font-size: 12px;
  color: var(--sub);
  margin-bottom: 12px;
}

.hint code {
  background: var(--panel2);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--gold);
}

/* ---------- DROP ZONE ---------- */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 50px 15px;
  text-align: center;
  color: var(--sub);
  font-size: 14px;
  cursor: pointer;
  transition: 0.15s ease;
  margin-bottom: 14px;
}

.drop-zone:hover {
  border-color: var(--gold);
  color: var(--text);
}

.drop-zone.drag {
  border-color: var(--gold);
  background: var(--panel2);
  color: var(--text);
}

/* ---------- STATUS ---------- */
.status-box {
  margin: 0 0 14px;
  padding: 10px 12px;
  font-size: 13px;
  border-radius: 8px;
  min-height: 22px;
  background: var(--panel2);
  border: 1px solid var(--border);
  color: var(--sub);
}

.status-box.ok {
  border-color: var(--green);
  color: var(--green);
}

.status-box.error {
  border-color: var(--red);
  color: var(--red);
}

.status-box b { color: var(--text); }

/* ---------- BUTTONS ---------- */
button {
  padding: 12px 18px;
  border: none;
  border-radius: 10px;
  background: var(--gold);
  color: #1a1a20;
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: 0.15s ease;
}

button:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

button:disabled {
  background: #3a3a50;
  color: var(--sub);
  cursor: not-allowed;
  opacity: 0.6;
}

button.secondary {
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--border);
}

button.secondary:hover:not(:disabled) {
  border-color: var(--gold);
}

#confirmBtn,
#generateBtn {
  width: 100%;
}

.row-actions #confirmBtn,
.row-actions #generateBtn {
  width: auto;
  flex-shrink: 0;
}

/* ---------- TABS ---------- */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 16px;
}

.tab {
  flex: 1;
  padding: 10px 14px;
  background: transparent;
  color: var(--sub);
  border: none;
  border-radius: 7px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: 0.15s;
}

.tab:hover:not(.active) {
  color: var(--text);
  background: var(--panel2);
  transform: none;
}

.tab.active {
  background: var(--gold);
  color: #1a1a20;
}

/* ---------- USER CARDS (Page 2 By User view) ---------- */
.user-card {
  padding: 14px 16px;
}

.user-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

.user-name {
  font-weight: 700;
  font-size: 16px;
  color: var(--gold);
}

.user-meta {
  font-size: 12px;
  color: var(--sub);
}

.user-items {
  list-style: none;
  margin: 0 0 10px 0;
  padding: 10px 12px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.user-items li {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 4px 0;
  border-bottom: 1px dashed var(--border);
}

.user-items li:last-child { border-bottom: none; }

.item-name {
  flex: 1;
  word-break: break-word;
  padding-right: 12px;
}

.item-price {
  color: var(--gold);
  font-weight: 600;
  flex-shrink: 0;
}

.user-total {
  text-align: right;
  font-weight: 700;
  font-size: 14px;
  color: var(--green);
  padding-top: 4px;
}

/* ---------- AWARD CARDS (page 2) ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
}

.award-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.award-thumb {
  width: 90px;
  height: 90px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  background: var(--panel2);
}

.award-thumb.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sub);
  font-size: 11px;
  border: 1px dashed var(--border);
}

.award-body { flex: 1; min-width: 0; }

.card-title {
  font-weight: 700;
  word-break: break-word;
}

.card-msg {
  font-size: 12px;
  color: var(--sub);
  margin-top: 4px;
}

.card-price {
  color: var(--gold);
  font-weight: 700;
  margin: 6px 0;
}

.winners {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--panel2);
  border: 1px solid var(--border);
  color: var(--green);
  font-size: 13px;
  font-weight: 600;
}

/* ---------- REPLIES DROPDOWN ---------- */
details.replies {
  margin-top: 8px;
  font-size: 12px;
}

details.replies summary {
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--panel2);
  border: 1px solid var(--border);
  color: var(--sub);
  user-select: none;
  list-style: none;
}

details.replies summary::-webkit-details-marker { display: none; }

details.replies summary::before {
  content: "▶ ";
  font-size: 9px;
  margin-right: 4px;
  display: inline-block;
  transition: transform 0.15s;
}

details[open].replies summary::before {
  transform: rotate(90deg);
}

details.replies summary:hover {
  border-color: var(--gold);
  color: var(--text);
}

details.replies ul {
  list-style: none;
  margin-top: 6px;
  padding-left: 0;
}

details.replies li {
  padding: 5px 10px;
  border-radius: 6px;
  margin-bottom: 4px;
  background: var(--panel2);
  border-left: 3px solid var(--border);
}

details.replies li.winner {
  color: var(--green);
  border-left-color: var(--green);
}

details.replies li.late {
  color: var(--sub);
  border-left-color: var(--sub);
  text-decoration: line-through;
  text-decoration-color: rgba(122,122,149,0.4);
}

details.replies li.rejected {
  color: var(--red);
  border-left-color: var(--red);
}

details.replies li b { color: inherit; }

/* ---------- MESSAGE CARDS (page 3) ---------- */
.msg-card {
  padding: 12px 14px;
}

.msg-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.msg-name {
  font-weight: 700;
  font-size: 15px;
}

.msg-meta {
  font-size: 12px;
  color: var(--sub);
  margin-top: 2px;
}

.msg-body {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text);
  max-height: 140px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.copy-btn {
  padding: 6px 12px;
  font-size: 12px;
  background: var(--gold);
  color: #1a1a20;
  border-radius: 8px;
  flex-shrink: 0;
}

.copy-btn.ok {
  background: var(--green);
  color: #1a1a20;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 600px) {
  .row-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .row-actions button {
    width: 100%;
  }

  .award-card {
    flex-direction: column;
  }

  .award-thumb {
    width: 100%;
    height: 180px;
  }

  .step-indicator {
    margin-left: 0;
    width: 100%;
  }
}
