﻿:root {
  --bg-0: #030303;
  --bg-1: #080808;
  --bg-2: #101010;
  --panel: rgba(14, 14, 14, 0.88);
  --panel-solid: #151515;
  --surface: #1a1a1a;
  --surface-alt: #121212;
  --accent: #e69200;
  --accent-soft: rgba(230, 146, 0, 0.2);
  --accent-strong: rgba(230, 146, 0, 0.55);
  --text: #f4f4f4;
  --muted: #b2b2b2;
  --border: rgba(255, 255, 255, 0.14);
  --radius: 14px;
  --font-body: "Space Grotesk", "Segoe UI", sans-serif;
  --font-title: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  background:
    radial-gradient(1100px at 16% -8%, rgba(230, 146, 0, 0.2), transparent 58%),
    radial-gradient(900px at 86% 112%, rgba(230, 146, 0, 0.14), transparent 62%),
    linear-gradient(150deg, var(--bg-0), var(--bg-1) 45%, var(--bg-2));
  color: var(--text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.012) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.012) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.45;
}

.page {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 20px 36px;
}

header {
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 14px;
  width: 100%;
  margin: 0 0 22px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(18, 18, 18, 0.92), rgba(12, 12, 12, 0.86));
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

body:not(.admin-open) header {
  width: min(100%, 760px);
  margin: 0 auto 22px;
}

.header-copy {
  max-width: 860px;
  text-align: center;
}

.admin-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
}

.admin-bar > button,
.admin-bar > select {
  min-height: 40px;
}

.admin-bar #overlayProfileSelect {
  min-width: 220px;
  max-width: 250px;
}

.admin-bar #saveCurrentProfileBtn {
  display: none;
}

body.admin-open .admin-bar #saveCurrentProfileBtn {
  display: inline-block;
}

.admin-bar #groupSelect {
  display: none;
}

body.admin-open .admin-bar #groupSelect {
  display: block;
}

.admin-bar #createProfileBtn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.admin-mode-logo {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--accent-strong);
  background: linear-gradient(180deg, rgba(34, 24, 6, 0.95), rgba(20, 13, 2, 0.95));
  font-family: var(--font-title);
  font-size: 15px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fff0d2;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.4);
}

body.admin-open .admin-mode-logo {
  display: inline-flex;
}

.switch {
  position: relative;
  display: inline-block;
  width: 58px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  padding: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 1px;
  background: #3a3a3a;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 34px;
  transition: 0.2s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 2px;
  background: #f5f5f5;
  border-radius: 50%;
  transition: 0.2s;
}

.switch input:checked + .slider {
  background: var(--accent);
  border-color: rgba(0, 0, 0, 0.35);
}

.switch input:checked + .slider:before {
  transform: translateX(27px);
}

.eyebrow {
  margin: 0 0 4px;
  font-family: var(--font-title);
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent);
  font-size: 13px;
  line-height: 1.2;
}

h1 {
  margin: 0 0 6px;
  font-family: var(--font-title);
  font-size: clamp(30px, 4vw, 40px);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

h2,
h3,
h4 {
  font-family: var(--font-title);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.sub {
  margin: 0;
  color: var(--muted);
}

button {
  background: linear-gradient(180deg, #181818, #101010);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
  font-family: var(--font-body);
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

button:hover {
  transform: translateY(-1px);
  border-color: var(--accent-strong);
  box-shadow: 0 8px 24px rgba(230, 146, 0, 0.17);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

#downloadBtn,
#createProfileBtn,
#saveCurrentProfileBtn,
#addSlotBtn,
#applyBottomGrid,
#textSave,
#iconSave,
#btnSelectGift,
#btnResizeGift,
#applyPanel {
  background: linear-gradient(180deg, #f2a019, #cd7f00);
  color: #180f00;
  border: 1px solid rgba(0, 0, 0, 0.35);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.28);
}

.preview-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  backdrop-filter: blur(8px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  max-width: 760px;
  margin: 0 auto;
}

.preview-wrapper {
  position: relative;
  width: min(100%, 720px);
  aspect-ratio: 9 / 16;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(180deg, #070707, #101010);
  border: 1px solid var(--border);
  display: flex;
  justify-content: center;
  align-items: center;
}

.toolbar {
  position: absolute;
  display: none;
  gap: 8px;
  background: rgba(8, 8, 8, 0.95);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  z-index: 10;
}

.toolbar.show { display: flex; }

.toolbar button {
  padding: 8px 10px;
  font-size: 16px;
  border-radius: 8px;
}

#btnSelectGift,
#btnResizeGift {
  font-size: 18px;
  font-weight: 900;
  text-shadow:
    0 0 0.5px rgba(0, 0, 0, 0.95),
    0 1px 1px rgba(255, 255, 255, 0.35),
    0 0 6px rgba(0, 0, 0, 0.55);
  -webkit-text-stroke: 0.5px rgba(0, 0, 0, 0.82);
}

/* Plus overlay (non exporte) */
#plusOverlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.plus-btn {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(230, 146, 0, 0.85);
  color: #ffd387;
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
}

.plus-btn:hover { background: rgba(0, 0, 0, 0.9); }

main { display: block; }

body.admin-open .page { max-width: 1460px; }

body.admin-open main {
  display: grid;
  grid-template-columns: minmax(680px, 1fr) 420px;
  gap: 14px;
  align-items: start;
}

body.admin-open .preview-card {
  margin: 0;
  max-width: none;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.token-image-panel {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(16, 16, 16, 0.75);
  padding: 10px;
}

.token-image-panel.hidden {
  display: none;
}

.token-image-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

#tokenImageUrl {
  width: 100%;
  background: var(--surface-alt);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
}

.token-image-status {
  margin-top: 8px;
  min-height: 16px;
}

.token-image-status.error {
  color: #ff7a7a;
}

.token-image-status.success {
  color: #90e7b1;
}

.hint {
  color: var(--muted);
  font-size: 13px;
  margin-top: 8px;
}

.preview-card input[type="text"],
.modal-content input[type="text"],
.modal-content textarea,
.modal-content input[type="search"],
.modal-content select,
.modal-content input[type="color"],
.modal-content input[type="range"],
.modal-content input[type="number"],
.admin-bar select,
.admin-bar input[type="text"],
.admin-bar input[type="number"],
.admin-panel input,
.admin-panel textarea,
.admin-panel select {
  width: 100%;
  background: var(--surface-alt);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 14px;
}

.modal-content input[type="range"],
.admin-panel input[type="range"] {
  padding: 0;
}

.modal-content textarea,
.admin-panel textarea {
  resize: vertical;
  min-height: 60px;
}

input[type="color"] {
  padding: 4px;
  height: 42px;
}

.swatch-row {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.swatch {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  cursor: pointer;
  transition: transform 100ms ease, border-color 120ms ease;
}

.swatch:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

select#giftSelect {
  height: 200px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.modal.show { display: flex; }

.modal-content {
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  width: min(440px, 92vw);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
}

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

.close {
  padding: 8px 12px;
}

.gift-list {
  margin-top: 10px;
  max-height: 360px;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}

.gift-category-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.gift-category-chip {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 12px;
  background: #131313;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: border-color 120ms ease, color 120ms ease, background-color 120ms ease;
}

.gift-category-chip:hover {
  border-color: var(--accent);
  color: var(--text);
  box-shadow: none;
  transform: none;
}

.gift-category-chip.is-active {
  border-color: rgba(0, 0, 0, 0.35);
  color: #1b1100;
  background: var(--accent);
}

.gift-card {
  display: flex;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #131313;
  cursor: pointer;
  transition: border 120ms ease, transform 120ms ease;
}

.gift-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.gift-card img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.gift-name {
  margin: 0;
  font-weight: 600;
}

.gift-value {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: center;
}

.modal-actions {
  margin-top: 12px;
  text-align: right;
}

@media (max-width: 1100px) {
  .page { padding: 22px 14px 36px; }
  .admin-bar {
    flex-wrap: wrap;
    justify-content: center;
  }
  .admin-bar #overlayProfileSelect {
    min-width: 180px;
  }
}

/* Admin panel */
.admin-panel {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(12, 12, 12, 0.94), rgba(8, 8, 8, 0.88));
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
}

body.admin-open .admin-panel {
  margin-top: 0;
  position: sticky;
  top: 10px;
  max-height: calc(100vh - 20px);
  overflow: auto;
}

.admin-panel.hidden { display: none; }

.admin-panel h3 { margin: 0 0 6px; }
.admin-panel h4 { margin: 0 0 8px; }

.admin-panel label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
}

.admin-panel input[type="color"] {
  min-height: 38px;
}

.admin-panel .inline-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 8px;
  font-size: 13px;
  color: var(--muted);
}

.admin-panel .inline-check input[type="checkbox"] {
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  accent-color: var(--accent);
}

.admin-history {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 10px;
}

.admin-history button {
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.2;
}

.admin-add-slot {
  width: 100%;
  margin: 0;
}

.admin-slot-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 10px;
}

.admin-delete-slot {
  width: 100%;
  margin: 0;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.admin-block {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  padding: 10px;
}

.admin-block.hidden-by-toggle {
  display: none;
}

.admin-fields-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 10px;
}

.admin-fields-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px 10px;
  margin-top: 6px;
}

.admin-panel .swatch-row { margin-bottom: 6px; }
.admin-panel .muted { color: var(--muted); font-size: 13px; margin: 0 0 8px; }
.admin-apply { margin-top: 10px; width: 100%; }

body.embedded-editor .page {
  max-width: none;
  padding: 0;
}

body.embedded-editor header {
  display: none;
}

body.embedded-editor {
  background: transparent;
}

body.embedded-editor::before {
  display: none;
}

body.embedded-editor main {
  display: block;
}

body.embedded-editor .preview-card {
  max-width: none;
  margin: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  border-radius: 0;
}

body.embedded-editor .preview-wrapper {
  width: 100%;
  aspect-ratio: auto;
  min-height: 840px;
  background: transparent;
  border: none;
  border-radius: 0;
}

body.embedded-editor .admin-panel {
  display: none !important;
}

body.embedded-editor .hint {
  display: none;
}

body.embedded-editor .actions {
  margin: 0;
  padding: 8px 10px;
  display: flex;
  justify-content: flex-end;
  position: sticky;
  top: 0;
  z-index: 15;
}

body.embedded-editor #downloadBtn {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
}

@media (max-width: 1250px) {
  body.admin-open main {
    grid-template-columns: 1fr;
  }
  body.admin-open .admin-panel {
    position: static;
    max-height: none;
  }
}

@media (max-width: 760px) {
  .admin-history {
    grid-template-columns: 1fr;
  }
  .admin-fields-2,
  .admin-fields-3 {
    grid-template-columns: 1fr;
  }
}





