@import url("/fondos/assets/fonts.css");

:root {
  --bg-0: #0f1324;
  --bg-1: #222740;
  --panel: rgba(11, 15, 33, 0.82);
  --line: rgba(255, 255, 255, 0.14);
  --text: #f4f7ff;
  --muted: #bac2dd;
  --accent: #f2b705;
  --accent-2: #16f2b3;
  --accent-soft: rgba(22, 242, 179, 0.18);
  --danger: #ff7d7d;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.34);
  --font-ui: "Montserrat", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--text);
  background:
    radial-gradient(circle at 15% 20%, rgba(61, 30, 95, 0.9) 0%, transparent 35%),
    radial-gradient(circle at 82% 10%, rgba(19, 73, 100, 0.8) 0%, transparent 34%),
    linear-gradient(130deg, var(--bg-0) 5%, var(--bg-1) 95%);
}

.backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 28px 28px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  background: rgba(6, 8, 20, 0.72);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

.brand-mark {
  width: 44px;
  height: 44px;
}

.brand-sub {
  color: var(--accent-2);
  letter-spacing: 0.12em;
}

.topbar h1 {
  margin: 0;
  font-size: 1.45rem;
}

.topbar-note {
  margin: 0;
  color: var(--muted);
  max-width: 320px;
  text-align: right;
}

.topbar-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.topbar-btn {
  text-decoration: none;
}

.auth-gate {
  max-width: 980px;
  margin: 24px auto 0;
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
}

.hidden {
  display: none !important;
}

.layout {
  position: relative;
  z-index: 1;
  max-width: 1380px;
  margin: 24px auto;
  padding: 0 16px 28px;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr);
  gap: 18px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.preview-panel {
  position: sticky;
  top: 94px;
  align-self: start;
  max-height: calc(100dvh - 116px);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  overflow: hidden;
}

.section-block + .section-block {
  margin-top: 26px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-2);
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h2 {
  margin: 0;
  font-size: 1.2rem;
}

.muted {
  color: var(--muted);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.82rem;
  white-space: nowrap;
}

.status-chip.accent {
  color: #081d17;
  background: linear-gradient(90deg, #78ffd6, #baffed);
}

.status-chip.success {
  color: #08211b;
  background: linear-gradient(90deg, #b5ffc1, #7dffb2);
}

.gallery-toolbar {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 12px;
  margin-top: 18px;
}

.gallery-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin: 14px 0;
}

.cards {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.card {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.28);
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.3);
}

.card.is-selected {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 2px rgba(22, 242, 179, 0.26) inset;
}

.card button {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.card-media {
  display: grid;
  place-items: center;
  padding: 10px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.1), transparent 45%),
    rgba(5, 8, 20, 0.92);
}

.card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.card-body {
  padding: 12px;
}

.card h3 {
  margin: 0 0 8px;
  font-size: 0.98rem;
}

.card-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mini-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 0.76rem;
}

.font-global-box,
.field-card,
.selected-meta {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 16px;
}

.font-global-box {
  display: grid;
  gap: 16px;
  padding: 18px;
  margin-top: 18px;
}

.font-global-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.font-global-copy {
  display: grid;
  gap: 6px;
}

.font-global-copy .muted {
  margin: 0;
}

.font-global-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.font-toggle {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
}

.font-toggle-copy {
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
}

.font-toggle-control {
  position: relative;
  display: inline-flex;
}

.font-toggle-control input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.font-toggle-slider {
  width: 52px;
  height: 30px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  transition: background 160ms ease;
}

.font-toggle-slider::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.28);
  transition: transform 160ms ease;
}

.font-toggle-control input:checked + .font-toggle-slider {
  background: linear-gradient(90deg, rgba(22, 242, 179, 0.88), rgba(125, 255, 178, 0.9));
}

.font-toggle-control input:checked + .font-toggle-slider::after {
  transform: translateX(22px);
}

.font-toggle-control input:focus-visible + .font-toggle-slider {
  outline: 2px solid var(--accent-soft);
  outline-offset: 3px;
}

.font-global-select {
  gap: 8px;
}

.font-global-select select:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.field-grid {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.field-card {
  padding: 14px;
}

.field-card.is-active {
  border-color: rgba(22, 242, 179, 0.75);
  box-shadow: 0 0 0 2px rgba(22, 242, 179, 0.18) inset;
}

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

.field-head h3 {
  margin: 0;
  font-size: 0.98rem;
}

.field-card-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-card-grid .full {
  grid-column: 1 / -1;
}

label,
.control-group {
  display: grid;
  gap: 6px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 11px 12px;
  border-radius: 12px;
  font: inherit;
}

textarea {
  resize: vertical;
  min-height: 88px;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent-2);
}

input[type="range"] {
  padding: 0;
}

.color-input {
  min-height: 52px;
  padding: 6px;
  cursor: pointer;
}

.color-input::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-input::-webkit-color-swatch,
.color-input::-moz-color-swatch {
  border: 0;
  border-radius: 10px;
}

.range-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--muted);
}

.nudge-grid {
  display: none;
}

.nudge-group {
  grid-column: 1 / -1;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(7, 12, 26, 0.16)),
    rgba(9, 13, 31, 0.55);
}

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

.nudge-head span:first-child {
  font-weight: 600;
}

.nudge-panel {
  display: grid;
  grid-template-columns: repeat(3, 52px);
  grid-template-rows: repeat(3, 52px);
  gap: 8px;
  justify-content: start;
  align-items: center;
}

.nudge-core {
  grid-column: 2;
  grid-row: 2;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(5, 11, 25, 0.82);
  color: var(--muted);
  font-size: 1.2rem;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.nudge-btn,
.ghost-btn,
.primary-btn {
  border: 0;
  border-radius: 12px;
  padding: 11px 14px;
  font-weight: 700;
  cursor: pointer;
}

.nudge-btn {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background:
    radial-gradient(circle at 50% 32%, rgba(255, 255, 255, 0.16), transparent 56%),
    linear-gradient(180deg, rgba(40, 47, 76, 0.96), rgba(20, 25, 46, 0.98));
  color: var(--text);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 10px 24px rgba(0, 0, 0, 0.24);
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.nudge-btn[data-dir="up"] {
  grid-column: 2;
  grid-row: 1;
}

.nudge-btn[data-dir="left"] {
  grid-column: 1;
  grid-row: 2;
}

.nudge-btn[data-dir="right"] {
  grid-column: 3;
  grid-row: 2;
}

.nudge-btn[data-dir="down"] {
  grid-column: 2;
  grid-row: 3;
}

.nudge-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(22, 242, 179, 0.34);
  background:
    radial-gradient(circle at 50% 28%, rgba(130, 255, 226, 0.22), transparent 56%),
    linear-gradient(180deg, rgba(51, 61, 99, 0.98), rgba(23, 30, 56, 1));
}

.nudge-btn:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 3px;
}

.nudge-btn span {
  font-size: 1.24rem;
  line-height: 1;
}

.ghost-btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.primary-btn {
  color: #1f1503;
  background: linear-gradient(90deg, #ffd36b, #f2b705);
}

.primary-btn:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.selected-meta {
  padding: 14px;
  margin: 18px 0 0;
}

.selected-meta h3 {
  margin: 0 0 8px;
}

.preview-stage-shell {
  min-height: 0;
  display: grid;
  align-items: center;
  justify-items: center;
  margin-top: 18px;
}

.preview-stage {
  position: relative;
  width: min(100%, calc(var(--preview-max-height, min(72vh, 760px)) * var(--preview-ratio, 0.8)));
  min-height: clamp(280px, 42vh, 420px);
  max-height: min(100%, var(--preview-max-height, min(72vh, 760px)));
  margin-inline: auto;
  display: grid;
  place-items: center;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 211, 107, 0.18), transparent 30%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
}

.preview-stage.has-image {
  min-height: 0;
}

.preview-bg {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.preview-empty {
  max-width: 360px;
  text-align: center;
  padding: 18px;
  color: var(--muted);
}

.poster-overlay {
  position: absolute;
  inset: 0;
}

.poster-text-layer {
  position: absolute;
  transform: translate(-50%, -50%);
  width: min(82%, max-content);
  max-width: 82%;
  border: 1px dashed transparent;
  background: transparent;
  color: #ffffff;
  text-align: center;
  white-space: pre-wrap;
  text-shadow: none;
  line-height: 1.08;
  user-select: none;
  cursor: grab;
  padding: 6px 10px;
  paint-order: stroke fill;
}

.poster-text-layer.is-active {
  border-color: rgba(22, 242, 179, 0.8);
  background: rgba(5, 12, 26, 0.18);
}

.poster-text-layer.dragging {
  cursor: grabbing;
}

.preview-status {
  margin: 14px 0 0;
}

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

.empty-state {
  border: 1px dashed rgba(255, 255, 255, 0.24);
  border-radius: 16px;
  padding: 22px;
  text-align: center;
  color: var(--muted);
}

@keyframes shimmer {
  to {
    background-position-x: -220%;
  }
}

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

  .preview-panel {
    position: static;
    max-height: none;
    display: block;
    overflow: visible;
  }

  .preview-stage {
    width: min(100%, calc(var(--preview-max-height, min(78vh, 900px)) * var(--preview-ratio, 0.8)));
    max-height: var(--preview-max-height, min(78vh, 900px));
  }
}

@media (max-width: 760px) {
  .topbar {
    padding: 16px;
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-links {
    justify-content: flex-start;
  }

  .gallery-toolbar,
  .field-card-grid {
    grid-template-columns: 1fr;
  }

  .font-global-head {
    flex-direction: column;
    align-items: stretch;
  }

  .font-toggle {
    justify-content: space-between;
  }

  .cards {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }

  .nudge-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .preview-stage {
    width: 100%;
    max-height: var(--preview-max-height, 70vh);
  }
}
