/* ============================================================
   MI ESPACIO — Editor
   ============================================================ */

.editor {
  padding-block: var(--space-7) var(--space-9);
  background: var(--paper);
}

/* Page head */
.editor__head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: var(--space-5);
  padding-bottom: var(--space-5);
  margin-bottom: var(--space-7);
  border-bottom: 1px solid var(--ink);
}
.editor__head h1 {
  font-family: var(--font-serif);
  font-size: clamp(2.25rem, 1.5rem + 2vw, 3.5rem);
  font-weight: var(--fw-light);
  letter-spacing: -0.03em;
  line-height: 0.95;
}
.editor__head h1 em { font-style: italic; color: var(--green); }

.editor__head .eyebrow { margin-bottom: var(--space-2); display: block; }

.editor__head-actions { display: flex; gap: var(--space-2); }

/* Flash banner */
.editor-flash {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-5);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  line-height: 1.45;
  border-left: 4px solid;
  animation: fadeUp var(--t-slow) both;
}
.editor-flash__icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
  font-weight: var(--fw-bold);
  flex-shrink: 0;
}
.editor-flash--success {
  background: var(--green-mist);
  color: var(--green-deep);
  border-left-color: var(--green);
}
.editor-flash--success .editor-flash__icon { background: var(--green); color: var(--white); }
.editor-flash--success .editor-flash__link {
  margin-left: auto;
  font-family: var(--font-sans);
  font-weight: var(--fw-semi);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: var(--fs-xs);
  color: var(--green-deep);
  border-bottom: 1px solid currentColor;
  padding-bottom: 2px;
  white-space: nowrap;
}
.editor-flash--success .editor-flash__link:hover { color: var(--orange); }
.editor-flash--error {
  background: rgba(179, 38, 30, 0.08);
  color: #861d18;
  border-left-color: #b3261e;
}
.editor-flash--error .editor-flash__icon { background: #b3261e; color: var(--white); }
.editor-flash--error ul { margin-top: var(--space-1); padding-left: var(--space-4); }
.editor-flash--error ul li { list-style: disc; }

/* Layout principal */
.editor__layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--space-7);
  align-items: start;
}

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

.editor__form { display: flex; flex-direction: column; gap: var(--space-5); }

/* Sidebar resumen (sticky) */
.editor__sidebar {
  position: sticky;
  top: 100px;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
@media (max-width: 1100px) {
  .editor__sidebar { position: static; }
}

/* Card resumen */
.editor-summary {
  background: var(--paper-warm);
  border-radius: var(--radius-md);
  padding: var(--space-5);
}
.editor-summary h4 {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: var(--space-4);
}
.editor-summary__row {
  display: flex;
  justify-content: space-between;
  padding-block: var(--space-2);
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
}
.editor-summary__row:last-child { border-bottom: 0; }
.editor-summary__row .label {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  text-transform: uppercase;
}
.editor-summary__row .value {
  font-family: var(--font-serif);
  font-size: var(--fs-md);
  color: var(--ink);
}
.editor-summary__row .value em { font-style: italic; color: var(--green); }

.editor-summary__progress {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--rule);
}
.editor-summary__progress-head {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  margin-bottom: var(--space-2);
  color: var(--ink-muted);
  letter-spacing: 0.08em;
}
.editor-summary__progress-head strong { color: var(--green); font-family: var(--font-serif); font-style: italic; font-size: var(--fs-md); letter-spacing: 0; font-weight: var(--fw-regular); }
.editor-summary__progress-bar {
  height: 6px;
  background: var(--rule);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.editor-summary__progress-fill {
  height: 100%;
  background: var(--green);
  border-radius: var(--radius-pill);
  transition: width var(--t-slow);
}

/* Sección editor */
.editor-section {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.editor-section__head {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: var(--space-4);
  align-items: center;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--rule);
  background: var(--paper-warm);
}

.editor-section__num {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 2rem;
  line-height: 1;
  color: var(--orange);
  font-weight: var(--fw-light);
}

.editor-section__title {
  font-family: var(--font-serif);
  font-size: var(--fs-lg);
  letter-spacing: -0.015em;
}
.editor-section__title em { font-style: italic; color: var(--green); }
.editor-section__title .sub {
  display: block;
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  color: var(--ink-muted);
  letter-spacing: 0;
  font-style: normal;
  margin-top: 2px;
}

.editor-section__check {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--green);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--t-fast);
}
.editor-section.is-complete .editor-section__check { opacity: 1; }
.editor-section__check svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2.2; }

.editor-section__body { padding: var(--space-5); }

.editor-grid {
  display: grid;
  gap: var(--space-4);
}
.editor-grid--2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 640px) { .editor-grid--2 { grid-template-columns: 1fr; } }

.editor-field { display: flex; flex-direction: column; gap: var(--space-2); }
.editor-field label {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  font-weight: var(--fw-medium);
}
.editor-field label .required { color: var(--orange); }
.editor-field input,
.editor-field select,
.editor-field textarea {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  background: var(--paper);
  color: var(--ink);
  transition: border-color var(--t-fast);
  width: 100%;
}
.editor-field input:focus, .editor-field select:focus, .editor-field textarea:focus {
  outline: none;
  border-color: var(--green);
}
.editor-field textarea { min-height: 100px; resize: vertical; line-height: 1.55; font-family: var(--font-serif); font-size: var(--fs-md); font-style: italic; font-weight: var(--fw-light); }
.editor-field .hint {
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  color: var(--ink-muted);
}

/* ============================================================
   LOGO UPLOADER (dropzone circular con preview)
   ============================================================ */
.logo-field {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: var(--space-5);
  align-items: start;
}
@media (max-width: 640px) { .logo-field { grid-template-columns: 1fr; } }

.logo-preview {
  position: relative;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: var(--green-mist);
  border: 2px dashed var(--rule);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  transition: all var(--t-base);
  flex-shrink: 0;
}
.logo-preview:hover {
  border-color: var(--green);
  background: var(--paper);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.logo-preview.has-image {
  border-style: solid;
  background: var(--paper);
  border-color: var(--rule);
}

.logo-preview__letter {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 4rem;
  font-weight: var(--fw-light);
  color: var(--green-deep);
  line-height: 1;
  user-select: none;
  transition: opacity var(--t-fast);
}
.logo-preview.has-image .logo-preview__letter { display: none; }

.logo-preview__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}
.logo-preview.has-image .logo-preview__img { display: block; }

.logo-preview__overlay {
  position: absolute;
  inset: 0;
  background: rgba(20, 20, 15, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: var(--space-1);
  color: var(--paper);
  opacity: 0;
  transition: opacity var(--t-fast);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.logo-preview:hover .logo-preview__overlay { opacity: 1; }
.logo-preview__overlay svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.6; }

.logo-preview__remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--rule);
  color: var(--ink-muted);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--t-fast);
  z-index: 2;
  font-family: var(--font-sans);
  font-weight: var(--fw-bold);
  font-size: 14px;
  line-height: 1;
}
.logo-preview.has-image .logo-preview__remove { display: flex; }
.logo-preview__remove:hover { background: #b3261e; color: var(--white); border-color: #b3261e; }

.logo-preview input[type=file] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.logo-field__meta {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-top: var(--space-2);
}
.logo-field__meta-row { display: flex; flex-direction: column; gap: var(--space-2); }
.logo-field__meta-row label {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  font-weight: var(--fw-medium);
}
.logo-field__meta-row input {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  background: var(--paper);
  color: var(--ink);
  transition: border-color var(--t-fast);
  width: 100%;
}
.logo-field__meta-row input:focus { outline: none; border-color: var(--green); }
.logo-field__hint {
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  color: var(--ink-muted);
  line-height: 1.5;
}
.logo-field__hint strong { color: var(--ink); font-weight: var(--fw-medium); }

/* Selector de plantilla */
.template-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
}
@media (max-width: 720px) { .template-picker { grid-template-columns: 1fr; } }

.template-option {
  border: 2px solid var(--rule);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--t-base);
  position: relative;
  background: var(--paper);
}
.template-option:hover { border-color: var(--ink); transform: translateY(-3px); }
.template-option input { position: absolute; opacity: 0; pointer-events: none; }
.template-option.is-selected {
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-mist);
}
.template-option.is-selected::after {
  content: "✓";
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  width: 28px;
  height: 28px;
  background: var(--green);
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--fw-bold);
  z-index: 2;
}

.template-option__preview {
  height: 140px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: var(--space-3);
}
.template-option__preview-name {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 2px var(--space-2);
  border-radius: var(--radius-xs);
  background: rgba(255,255,255,0.9);
  color: var(--ink);
}
.template-option__preview--editorial { background: linear-gradient(135deg, var(--green-mist) 0%, var(--paper-warm) 100%); }
.template-option__preview--mural { background: linear-gradient(135deg, var(--orange) 0%, var(--green) 100%); }
.template-option__preview--industrial {
  background: var(--ink);
  background-image: repeating-linear-gradient(45deg, transparent 0 5px, rgba(255,255,255,0.04) 5px 6px);
}
.template-option__preview--industrial .template-option__preview-name { background: var(--orange); color: var(--white); }

.template-option__body { padding: var(--space-3) var(--space-4) var(--space-4); }
.template-option__title {
  font-family: var(--font-serif);
  font-size: var(--fs-md);
  letter-spacing: -0.015em;
  color: var(--ink);
  margin-bottom: 2px;
}
.template-option__desc {
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  color: var(--ink-muted);
  line-height: 1.45;
}

/* Bloques editables */
.block-card {
  background: var(--paper-warm);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  border: 1px solid var(--rule);
  margin-bottom: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  transition: all var(--t-fast);
}
.block-card:hover { border-color: var(--ink); }

.block-card__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--rule);
}
.block-card__label {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--orange);
  font-weight: var(--fw-semi);
}
.block-card__label em {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--ink);
  font-size: var(--fs-lg);
  font-weight: var(--fw-light);
  letter-spacing: -0.005em;
  margin-right: var(--space-2);
}
.block-card__clear {
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  transition: all var(--t-fast);
}
.block-card__clear:hover { color: #b3261e; background: rgba(179, 38, 30, 0.05); }

/* Sticky footer con acciones */
.editor-actions {
  position: sticky;
  bottom: var(--space-4);
  z-index: 10;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-pill);
  padding: var(--space-3) var(--space-4);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  box-shadow: var(--shadow-lg);
  margin-top: var(--space-5);
}
.editor-actions__status {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--ink-muted);
  letter-spacing: 0.06em;
}
.editor-actions__status .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  margin-right: var(--space-2);
}
.editor-actions__group { display: flex; gap: var(--space-2); }
