@import url("https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&display=swap");

:root {
  --bg: #0b0f14;
  --panel: #121821;
  --panel-strong: #0f141c;
  --panel-soft: rgba(18, 24, 33, 0.78);
  --text: #f6f1e8;
  --muted: #9aa3b2;
  --accent: #f5b25e;
  --accent-strong: #ffd28b;
  --accent-deep: #f08b34;
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 20px 60px rgba(5, 7, 10, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Sora", "Space Grotesk", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 900px at 80% 10%, rgba(244, 178, 94, 0.18), transparent 70%),
    radial-gradient(900px 600px at 10% 20%, rgba(54, 94, 128, 0.25), transparent 60%),
    linear-gradient(180deg, #0b0f14 0%, #0b0f14 45%, #0a0c11 100%);
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(120deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0) 60%),
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.05), transparent 50%);
  opacity: 0.5;
  pointer-events: none;
}

.app {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 0;
  height: 100vh;
}

.sidebar {
  padding: 32px 28px 28px;
  background: linear-gradient(180deg, rgba(18, 24, 33, 0.92), rgba(12, 16, 22, 0.98));
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.sidebar-header h1 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 26px;
  margin: 0;
}

.sidebar-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.02em;
}

.sidebar-content {
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex: 1;
  min-height: 0;
}

.sidebar-fields {
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  padding-right: 6px;
  scrollbar-color: rgba(245, 178, 94, 0.6) rgba(9, 12, 16, 0.3);
  scrollbar-width: thin;
}

.sidebar-fields::-webkit-scrollbar {
  width: 10px;
}

.sidebar-fields::-webkit-scrollbar-track {
  background: rgba(9, 12, 16, 0.3);
  border-radius: 999px;
}

.sidebar-fields::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(245, 178, 94, 0.8), rgba(240, 139, 52, 0.65));
  border-radius: 999px;
  border: 2px solid rgba(9, 12, 16, 0.3);
  box-shadow: 0 0 10px rgba(245, 178, 94, 0.35);
}

.sidebar-fields::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(245, 178, 94, 0.95), rgba(240, 139, 52, 0.8));
}

.sidebar-fields::-webkit-scrollbar-button {
  display: none;
}

.section {
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px 16px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
  animation: fadeUp 0.6s ease both;
}

.section h3 {
  margin: 0 0 12px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}

textarea {
  width: 100%;
  height: 90px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(9, 12, 16, 0.7);
  color: var(--text);
  padding: 10px 12px;
  font-size: 13px;
  resize: none;
}

textarea:focus,
input:focus {
  outline: none;
  border-color: rgba(245, 178, 94, 0.6);
  box-shadow: 0 0 0 3px rgba(245, 178, 94, 0.2);
}

.option-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(10, 12, 16, 0.7);
  color: var(--text);
  font-size: 13px;
}

.option-chip span {
  color: var(--accent);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.radio-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.reference-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-radius: 16px;
  padding: 6px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.reference-actions input[type="file"] {
  display: none;
}

.reference-button {
  border-radius: 12px;
  padding: 10px 14px;
  background: rgba(245, 178, 94, 0.12);
  color: var(--accent-strong);
  border: 1px dashed rgba(245, 178, 94, 0.4);
  font-size: 13px;
  cursor: pointer;
}

.reference-actions.is-dragover {
  border: 1px dashed rgba(245, 178, 94, 0.7);
  box-shadow: 0 0 0 3px rgba(245, 178, 94, 0.2);
}

.reference-preview {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(9, 12, 16, 0.6);
  display: none;
}

.reference-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.generate-area {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.credit-badge {
  border: none;
  background: rgba(245, 178, 94, 0.15);
  color: var(--accent-strong);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
}

.credit-badge:hover {
  background: rgba(245, 178, 94, 0.25);
}

.generate-button {
  flex: 1;
  border: none;
  background: linear-gradient(120deg, var(--accent), var(--accent-deep));
  color: #18100b;
  font-weight: 700;
  font-size: 15px;
  padding: 12px 16px;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(245, 178, 94, 0.35);
}

.generate-button:hover {
  transform: translateY(-1px);
}

.gallery {
  position: relative;
  padding: 30px 32px;
  overflow: auto;
}

.gallery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.gallery-header h2 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 22px;
  margin: 0 0 6px;
}

.gallery-header p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.gallery-meta {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

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

.tile {
  position: relative;
  background: rgba(11, 15, 20, 0.8);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

.tile--interactive {
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tile--interactive:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(5, 7, 10, 0.45);
}

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

.tile--pending::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(18, 24, 33, 0.7), rgba(10, 12, 16, 0.85));
}

.tile--failed {
  color: #f37b7b;
  font-size: 12px;
  text-align: center;
  padding: 12px;
}

.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid rgba(245, 178, 94, 0.35);
  border-top-color: var(--accent-strong);
  z-index: 1;
}

.empty-state {
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  padding: 40px 0;
}

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

.modal.is-open {
  display: flex;
}

.modal-content {
  width: 520px;
  background: #121821;
  border-radius: 20px;
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
  position: relative;
}

.modal--image .modal-content {
  width: min(980px, 92vw);
  padding: 26px;
}

.image-modal-body {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 20px;
  align-items: center;
}

.image-modal-preview {
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(9, 12, 16, 0.6);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

.image-modal-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-modal-details {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.image-modal-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
}

.image-modal-prompt {
  margin: 0;
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
  background: rgba(9, 12, 16, 0.6);
  border-radius: 14px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  min-height: 110px;
}

.image-modal-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 14px;
  background: linear-gradient(120deg, rgba(245, 178, 94, 0.9), rgba(240, 139, 52, 0.9));
  color: #1c140c;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 14px 30px rgba(245, 178, 94, 0.28);
}

.image-modal-download:hover {
  transform: translateY(-1px);
}

.modal-content h3 {
  margin: 0 0 6px;
  font-size: 20px;
}

.modal-content p {
  margin: 0 0 18px;
  color: var(--muted);
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 20px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 22px;
  cursor: pointer;
}

.modal-options {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}

.purchase-option {
  border-radius: 18px;
  padding: 18px 18px;
  background: linear-gradient(140deg, rgba(10, 14, 20, 0.96), rgba(14, 20, 30, 0.7));
  color: var(--text);
  border: 1px solid rgba(245, 178, 94, 0.35);
  box-shadow: 0 16px 34px rgba(2, 6, 12, 0.45);
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  font-size: 15px;
  min-height: 86px;
}

.purchase-option__meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.purchase-option__label {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.purchase-option__badge {
  align-self: flex-start;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(245, 178, 94, 0.2);
  border: 1px solid rgba(245, 178, 94, 0.4);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(245, 178, 94, 0.95);
}

.purchase-option__badge--value {
  background: rgba(96, 184, 255, 0.18);
  border-color: rgba(96, 184, 255, 0.45);
  color: rgba(150, 208, 255, 0.9);
}

.purchase-option__price {
  border: none;
  padding: 10px 16px;
  border-radius: 12px;
  background: linear-gradient(130deg, rgba(245, 178, 94, 0.9), rgba(240, 139, 52, 0.95));
  color: #1c140c;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(245, 178, 94, 0.25);
}

.purchase-option__price:hover {
  transform: translateY(-1px);
}

.purchase-option.selected {
  border-color: rgba(245, 178, 94, 0.75);
  box-shadow: 0 0 0 2px rgba(245, 178, 94, 0.25),
    0 16px 34px rgba(2, 6, 12, 0.45);
}

.pix-instructions {
  display: none;
  background: rgba(9, 12, 16, 0.6);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 14px;
  font-size: 13px;
  color: var(--muted);
}

.pix-instructions__lead {
  margin: 0 0 10px;
  color: var(--text);
  font-weight: 600;
}

.pix-instructions__amount {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}

.pix-qrcode {
  display: flex;
  justify-content: center;
  padding: 12px;
  margin-bottom: 12px;
  background: rgba(8, 10, 14, 0.6);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

#pix-qrcode-image {
  display: none;
  width: min(240px, 100%);
  height: auto;
  border-radius: 10px;
}

.pix-qrcode__label {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-weight: 600;
  font-size: 12px;
}

.pix-qrcode__input {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.pix-qrcode__input input {
  flex: 1;
  min-width: 200px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(11, 15, 20, 0.85);
  color: var(--text);
  font-size: 12px;
}

.pix-qrcode__input input:disabled {
  opacity: 0.9;
}

.pix-qrcode__input button {
  border: none;
  padding: 10px 14px;
  border-radius: 10px;
  background: linear-gradient(130deg, rgba(96, 184, 255, 0.9), rgba(52, 152, 240, 0.95));
  color: #081420;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(96, 184, 255, 0.25);
}

.pix-instructions strong {
  color: var(--text);
}

.pix-instructions.visible {
  display: block;
}

@media (max-width: 520px) {
  .pix-qrcode__input button {
    width: 100%;
  }
}

@media (max-width: 1100px) {
  .grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    height: auto;
    box-shadow: none;
  }

  body {
    overflow: auto;
  }

  .gallery {
    padding-top: 10px;
  }

  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .image-modal-body {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.admin-body {
  background: linear-gradient(160deg, rgba(15, 19, 25, 0.98), rgba(8, 11, 15, 0.98));
  overflow: auto;
}

.admin-wrapper {
  max-width: 900px;
  margin: 40px auto;
  padding: 0 20px 60px;
}

.admin-card {
  background: rgba(18, 24, 33, 0.9);
  border-radius: 18px;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.admin-card h2 {
  margin: 0 0 8px;
}

.admin-form {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
}

.admin-form input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(9, 12, 16, 0.6);
  color: var(--text);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th,
.admin-table td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
}

.admin-table input {
  width: 80px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(9, 12, 16, 0.6);
  color: var(--text);
}

.admin-table button {
  padding: 6px 10px;
  border-radius: 8px;
  border: none;
  background: rgba(245, 178, 94, 0.2);
  color: var(--accent-strong);
  cursor: pointer;
}

.admin-error {
  color: #f37b7b;
  margin-top: 12px;
  font-size: 13px;
}

.admin-status {
  color: #9fe3b2;
  margin-top: 12px;
  font-size: 13px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
