/* ==========================================================================
   PANEL DE ADMINISTRACIÓN SENCILLO · ELENA MATEOS (/admin)
   ========================================================================== */

.admin-body {
  background: #f4f6f9;
  min-height: 100vh;
}
.admin-body [hidden] {
  display: none !important;
}

.admin-topbar {
  background: var(--navy);
  color: var(--white);
  border-bottom: 1px solid rgba(255, 255, 255, .1);
}
.admin-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 16px;
}
.admin-badge {
  font-family: var(--sans);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  background: rgba(255, 255, 255, .14);
  color: var(--gold);
  padding: 3px 9px;
  border-radius: 999px;
  margin-left: 8px;
  vertical-align: middle;
}
.admin-topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}
.admin-top-link {
  color: rgba(255, 255, 255, .86);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 600;
}
.admin-top-link:hover { color: var(--white); text-decoration: underline; }
.admin-logout-btn {
  background: rgba(255, 255, 255, .12);
  color: var(--white);
  border: 0;
  padding: 7px 14px;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: .86rem;
  font-weight: 600;
  cursor: pointer;
}
.admin-logout-btn:hover { background: rgba(255, 255, 255, .22); }

/* Login */
.admin-login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 20px 80px;
}
.admin-login-card {
  width: 100%;
  max-width: 440px;
  background: var(--white);
  border-radius: 24px;
  padding: 40px 36px;
  box-shadow: 0 20px 50px rgba(11, 42, 74, .11);
}
.admin-login-card h1 {
  font-size: 2rem;
  margin-bottom: .3em;
}
.admin-login-sub {
  color: var(--muted);
  font-size: .96rem;
  margin-bottom: 24px;
}
.field-label {
  display: block;
  font-weight: 700;
  font-size: .92rem;
  color: var(--navy);
  margin: 16px 0 6px;
}
.label-opt {
  font-weight: 400;
  color: var(--muted);
  font-size: .85rem;
}
.field-input {
  width: 100%;
  padding: 12px 15px;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  font-family: var(--sans);
  font-size: 1rem;
  color: var(--ink);
  background: var(--white);
  transition: border-color .18s, box-shadow .18s;
}
.field-input:focus {
  outline: none;
  border-color: var(--ocean);
  box-shadow: 0 0 0 3px rgba(14, 94, 138, .15);
}
.password-wrap {
  position: relative;
}
.password-wrap .field-input {
  padding-right: 84px;
}
.toggle-pass-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: var(--sky);
  color: var(--ocean);
  font-family: var(--sans);
  font-weight: 700;
  font-size: .8rem;
  padding: 6px 11px;
  border-radius: 8px;
  cursor: pointer;
}
.login-error {
  margin-top: 14px;
  padding: 11px 14px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  border-radius: 10px;
  font-size: .9rem;
  font-weight: 600;
}
.login-submit-btn {
  width: 100%;
  margin-top: 22px;
  cursor: pointer;
  font-size: 1rem;
}
.login-back-link {
  display: block;
  text-align: center;
  margin-top: 18px;
  color: var(--muted);
  font-size: .9rem;
  text-decoration: none;
}
.login-back-link:hover { color: var(--navy); }

/* Dashboard */
.admin-dashboard {
  max-width: 980px;
  padding-top: 40px;
  padding-bottom: 80px;
}
.dash-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}
.dash-header h1 {
  font-size: clamp(1.8rem, 3.5vw, 2.4rem);
  margin: 0 0 4px;
}
.dash-header p {
  margin: 0;
  color: var(--muted);
}
.dash-header .btn { cursor: pointer; }

.dash-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.dash-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}
.dash-status-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.dash-search-wrap {
  flex: 1 1 240px;
  max-width: 340px;
}
.dash-search-input {
  padding: 9px 14px;
  border-radius: 999px;
  font-size: .92rem;
}
.dash-item {
  display: grid;
  grid-template-columns: 112px 1fr auto;
  gap: 20px;
  align-items: center;
  background: var(--white);
  border-radius: 18px;
  padding: 16px 20px;
  box-shadow: 0 4px 16px rgba(11, 42, 74, .06);
  border: 1px solid #e5ebf1;
  transition: border-color .18s, box-shadow .18s, transform .18s;
}
.dash-item:hover {
  border-color: #cbd8e6;
  box-shadow: 0 8px 22px rgba(11, 42, 74, .09);
}
.dash-thumb-btn,
.dash-title-btn {
  cursor: pointer;
}
.dash-title-btn:hover {
  color: var(--ocean);
  text-decoration: underline;
}
.dash-thumb {
  width: 112px;
  height: 76px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--sand);
}
.dash-info h3 {
  font-family: var(--sans);
  font-size: 1.08rem;
  font-weight: 700;
  margin: 4px 0 6px;
  color: var(--navy);
}
.dash-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  font-size: .8rem;
  color: var(--muted);
}
.status-pill {
  font-weight: 700;
  font-size: .75rem;
  padding: 2px 9px;
  border-radius: 999px;
}
.status-pill.published {
  background: #dcfce7;
  color: #166534;
}
.status-pill.draft {
  background: #fef3c7;
  color: #92400e;
}
.lang-chip {
  font-weight: 700;
  font-size: .72rem;
  padding: 1px 6px;
  border-radius: 5px;
  background: #eef2f6;
  color: var(--navy);
}
.dash-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-mini-btn {
  appearance: none;
  border: 1px solid #cfd8e3;
  background: var(--white);
  color: var(--navy);
  font-family: var(--sans);
  font-size: .86rem;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 10px;
  text-decoration: none;
  cursor: pointer;
  transition: all .15s;
}
.admin-mini-btn:hover {
  border-color: var(--navy);
  background: #f8fafc;
}
.admin-mini-btn.primary {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--white);
}
.admin-mini-btn.primary:hover { background: var(--ocean); border-color: var(--ocean); }
.admin-mini-btn.danger {
  color: #b91c1c;
  border-color: #fecaca;
}
.admin-mini-btn.danger:hover {
  background: #fef2f2;
  border-color: #ef4444;
}

/* Tarjeta copia de seguridad */
.backup-card {
  margin-top: 38px;
  background: var(--white);
  border: 1px dashed #cbd5e1;
  border-radius: 18px;
  padding: 22px 26px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.backup-card h3 {
  font-size: 1.05rem;
  margin: 0 0 4px;
}
.backup-card p {
  margin: 0;
  color: var(--muted);
  font-size: .9rem;
  max-width: 44em;
}
.backup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.backup-actions .btn, .backup-import-label { cursor: pointer; }

/* ==========================================================================
   EDITOR VISUAL POR BLOQUES
   ========================================================================== */

.editor-sticky-bar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(255, 255, 255, .97);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #dde4ee;
  box-shadow: 0 6px 20px rgba(11, 42, 74, .05);
}
.editor-sticky-inner {
  max-width: 920px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  padding-bottom: 10px;
}
.editor-quick-insert {
  background: var(--sand);
  border-top: 1px solid #ece2d3;
  padding: 8px 0;
}
.editor-quick-insert-inner {
  max-width: 920px;
  display: flex;
  align-items: center;
  gap: 7px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.editor-quick-insert-inner::-webkit-scrollbar { display: none; }
.quick-insert-label {
  flex: 0 0 auto;
  font-size: .8rem;
  font-weight: 800;
  color: var(--navy);
  margin-right: 2px;
}
.quick-ins-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid rgba(11, 42, 74, .16);
  background: var(--white);
  color: var(--navy);
  font-family: var(--sans);
  font-size: .83rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
}
.quick-ins-btn span {
  color: var(--coral);
  font-weight: 800;
}
.quick-ins-btn:hover {
  border-color: var(--coral);
  background: #fff8f5;
  transform: translateY(-1px);
}

/* Separador "+ Insertar aquí" entre dos bloques cualesquiera */
.insert-slot {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: -4px 0;
}
.insert-slot::before {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  top: 15px;
  border-top: 1px dashed #d8e1ec;
  pointer-events: none;
}
.insert-here-trigger {
  position: relative;
  z-index: 1;
  border: 1px dashed #bcc9d8;
  background: var(--white);
  color: var(--ocean);
  font-family: var(--sans);
  font-size: .8rem;
  font-weight: 700;
  padding: 4px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s;
}
.insert-here-trigger:hover {
  border-style: solid;
  border-color: var(--coral);
  color: var(--coral-dark);
  background: #fff8f5;
}
.insert-here-menu {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  background: var(--sand);
  border: 1.5px solid #e4d4be;
  border-radius: 14px;
  padding: 10px 12px;
  width: 100%;
  box-shadow: 0 8px 20px rgba(11, 42, 74, .07);
}
.insert-here-cancel {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: .82rem;
  padding: 4px 8px;
  cursor: pointer;
}
.insert-here-cancel:hover { color: var(--navy); }
.block-item.active-block {
  border-color: var(--ocean);
  box-shadow: 0 0 0 3px rgba(14, 94, 138, .09);
  background: var(--white);
}
.editor-sticky-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.editor-back-btn {
  border: 0;
  background: none;
  color: var(--ocean);
  font-family: var(--sans);
  font-weight: 700;
  font-size: .95rem;
  cursor: pointer;
  padding: 6px 4px;
}
.editor-back-btn:hover { color: var(--navy); text-decoration: underline; }
.editor-save-indicator {
  font-size: .8rem;
  font-weight: 600;
  color: var(--muted);
}
.editor-save-indicator.is-dirty {
  color: #b45309;
}
.editor-save-indicator.is-saving {
  color: var(--ocean);
}
.editor-save-indicator.is-saved {
  color: #15803d;
}
.editor-autosave-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: .81rem;
  font-weight: 500;
  color: var(--muted);
  background: #f1f5f9;
  padding: 4px 11px;
  border-radius: 999px;
  margin-right: 4px;
  white-space: nowrap;
  transition: all .2s ease;
}
.autosave-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  transition: background .2s ease, transform .2s ease;
}
.autosave-dot.saving {
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, .2);
  animation: autosavePulse 1.2s infinite ease-in-out;
}
.autosave-dot.saved {
  background: #10b981;
}
@keyframes autosavePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .5; transform: scale(1.25); }
}
.editor-sticky-btns {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.editor-sticky-btns .btn { cursor: pointer; }

.admin-icon-btn {
  appearance: none;
  border: 1.5px solid #cbd5e1;
  background: #f8fafc;
  color: var(--navy);
  font-family: var(--sans);
  font-weight: 700;
  font-size: .84rem;
  padding: .48em .9em;
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s;
}
.admin-icon-btn:hover {
  border-color: var(--ocean);
  background: var(--sky);
  color: var(--ocean);
}
.admin-live-link {
  display: inline-flex;
  align-items: center;
  font-size: .86rem;
  font-weight: 700;
  color: var(--ocean);
  text-decoration: none;
  padding: .48em .85em;
  border-radius: 999px;
  background: var(--sky);
  transition: background .15s, color .15s;
}
.admin-live-link:hover {
  background: #d5eaf6;
  color: var(--navy);
}

.admin-btn-secondary {
  appearance: none;
  border: 1.5px solid #cbd5e1;
  background: var(--white);
  color: var(--navy);
  font-family: var(--sans);
  font-weight: 600;
  font-size: .9rem;
  padding: .55em 1.1em;
  border-radius: 999px;
  cursor: pointer;
}
.admin-btn-secondary:hover {
  border-color: var(--navy);
  background: #f8fafc;
}

.editor-container {
  max-width: 880px;
  padding-top: 28px;
  padding-bottom: 90px;
}

/* Banner de recuperación de copia automática local */
.autosave-banner {
  background: #fffbeb;
  border: 1.5px solid #fcd34d;
  border-radius: 18px;
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  box-shadow: 0 8px 22px rgba(180, 83, 9, .08);
}
.autosave-banner-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.autosave-banner-text strong {
  color: #78350f;
  font-size: .95rem;
}
.autosave-banner-text span {
  color: #92400e;
  font-size: .84rem;
}
.autosave-banner-actions {
  display: flex;
  gap: 8px;
}

.editor-card {
  background: var(--white);
  border-radius: 22px;
  padding: 32px 34px;
  box-shadow: 0 8px 28px rgba(11, 42, 74, .06);
  border: 1px solid #e5ebf1;
  margin-bottom: 24px;
}
.step-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.step-header-row .step-tag {
  margin-bottom: 0;
}
.reading-stats-pill {
  font-size: .8rem;
  font-weight: 700;
  color: var(--muted);
  background: #f1f5f9;
  padding: 4px 11px;
  border-radius: 999px;
}
.step-tag {
  display: inline-block;
  font-size: .76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ocean);
  background: var(--sky);
  padding: 4px 11px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.editor-card h2 {
  font-size: 1.5rem;
  margin-bottom: 6px;
}
.editor-hint {
  color: var(--muted);
  font-size: .93rem;
  margin-bottom: 18px;
}

/* Subida de foto de portada */
.cover-uploader {
  border: 2px dashed #b9c8d8;
  border-radius: 18px;
  background: #f8fafc;
  overflow: hidden;
  transition: border-color .2s, background .2s;
}
.cover-uploader.dragover {
  border-color: var(--coral);
  background: #fff7f4;
}
.cover-empty {
  padding: 38px 24px;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.upload-icon {
  font-size: 2.2rem;
  line-height: 1;
  margin-bottom: 4px;
}
.cover-empty strong {
  color: var(--navy);
  font-size: 1.02rem;
}
.cover-empty span {
  color: var(--muted);
  font-size: .88rem;
}
.cover-preview {
  position: relative;
}
.cover-preview img {
  width: 100%;
  max-height: 360px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.cover-preview-actions {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: var(--white);
  border-top: 1px solid #e5ebf1;
}

.meta-row {
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 22px;
  margin-top: 20px;
  align-items: start;
}
.cat-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Pestañas de idioma */
.lang-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid #e5ebf1;
}
.lang-tab {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1.5px solid #d5dee8;
  background: #f8fafc;
  color: var(--navy);
  font-family: var(--sans);
  font-weight: 700;
  font-size: .92rem;
  padding: 9px 16px;
  border-radius: 12px;
  cursor: pointer;
  transition: all .15s;
}
.lang-tab small {
  font-weight: 400;
  color: var(--muted);
}
.lang-tab.active {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--white);
}
.lang-tab.active small { color: rgba(255, 255, 255, .75); }
.lang-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, .2);
}

.lang-helper-banner {
  background: var(--sand);
  border: 1px solid #eadcc8;
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.lang-helper-banner p {
  margin: 0;
  font-size: .9rem;
  color: var(--ink);
  max-width: 40em;
}

.title-input {
  font-family: var(--serif);
  font-size: 1.45rem;
  padding: 14px 16px;
  color: var(--navy);
}
.excerpt-input {
  resize: vertical;
  line-height: 1.5;
}

/* Lista de bloques */
.blocks-header {
  margin-top: 24px;
  margin-bottom: 14px;
}
.blocks-header-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.blocks-header .field-label { margin: 0; }
.blocks-tips-badge {
  font-size: .78rem;
  color: var(--ocean);
  background: var(--sky);
  padding: 4px 10px;
  border-radius: 999px;
}
.blocks-sub { font-size: .86rem; color: var(--muted); }

.blocks-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 54px;
  border-radius: 16px;
  transition: background .15s;
}
.blocks-list.file-drag-zone-empty {
  background: #fff7f4;
  outline: 2px dashed var(--coral);
  outline-offset: 6px;
}

.block-item {
  position: relative;
  border: 1.5px solid #dce4ee;
  border-radius: 16px;
  background: #fbfcfe;
  padding: 15px 18px 18px;
  transition: border-color .16s, box-shadow .16s, opacity .16s, transform .16s, background .16s;
}
.block-item:hover {
  border-color: #c2d1e0;
}
.block-item:focus-within {
  border-color: var(--ocean);
  background: var(--white);
}

/* Estados Drag & Drop de bloques */
.block-item.is-dragging {
  opacity: .38;
  transform: scale(.985);
  border-style: dashed;
  border-color: var(--ocean);
  background: var(--sky);
}
.block-item.drop-before::before,
.block-item.drop-after::after {
  content: "Soltar bloque aquí";
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--coral);
  border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(242, 105, 75, .2);
  font-size: .72rem;
  font-weight: 800;
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 25;
  pointer-events: none;
}
.block-item.drop-before::before,
.block-item.drop-after::after {
  padding: 9px 14px;
  width: fit-content;
  margin: 0 auto;
  height: auto;
  box-shadow: 0 4px 14px rgba(242, 105, 75, .38), 0 0 0 2px var(--white);
}
.block-item.drop-before {
  border-top: 3px solid var(--coral);
}
.block-item.drop-before::before {
  top: -15px;
}
.block-item.drop-after {
  border-bottom: 3px solid var(--coral);
}
.block-item.drop-after::after {
  bottom: -15px;
}

/* Soltar archivos desde el ordenador entre bloques o sobre un bloque */
.block-item.file-drop-before {
  border-top: 3px dashed var(--coral);
}
.block-item.file-drop-before::before {
  content: "📷 Suelta aquí para insertar foto(s)";
  position: absolute;
  top: -15px;
  left: 0;
  right: 0;
  width: fit-content;
  margin: 0 auto;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--coral);
  color: var(--white);
  font-size: .74rem;
  font-weight: 800;
  z-index: 25;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(242, 105, 75, .32);
}
.block-item.file-drop-after {
  border-bottom: 3px dashed var(--coral);
}
.block-item.file-drop-after::after {
  content: "📷 Suelta aquí para insertar foto(s)";
  position: absolute;
  bottom: -15px;
  left: 0;
  right: 0;
  width: fit-content;
  margin: 0 auto;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--coral);
  color: var(--white);
  font-size: .74rem;
  font-weight: 800;
  z-index: 25;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(242, 105, 75, .32);
}
.block-item.file-dragover {
  border-color: var(--coral) !important;
  background: #fff8f5 !important;
  box-shadow: 0 0 0 3px rgba(242, 105, 75, .18) !important;
}

@keyframes blockMovedPulse {
  0% { background: #fff7ed; box-shadow: 0 0 0 4px rgba(246, 184, 74, .42); }
  100% { background: var(--white); box-shadow: 0 0 0 3px rgba(14, 94, 138, .09); }
}
.block-item.just-moved {
  animation: blockMovedPulse .85s ease-out;
}

.block-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.block-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}
.block-drag-handle {
  appearance: none;
  border: 1px solid #d8e2ee;
  background: var(--white);
  color: #64748b;
  font-size: 1rem;
  line-height: 1;
  padding: 5px 8px;
  border-radius: 8px;
  cursor: grab;
  user-select: none;
  transition: all .15s;
}
.block-drag-handle:hover {
  color: var(--navy);
  border-color: var(--ocean);
  background: var(--sky);
}
.block-drag-handle:active {
  cursor: grabbing;
}

/* Botón selector de tipo de bloque (transformar bloque en 1 clic) */
.block-type-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid transparent;
  background: transparent;
  padding: 4px 8px;
  border-radius: 8px;
  font-family: var(--sans);
  font-size: .79rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ocean);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.block-type-btn:hover {
  background: var(--sky);
  border-color: #c2dff0;
}
.block-type-caret {
  font-size: .7rem;
  opacity: .75;
}
.block-transform-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 34px;
  z-index: 40;
  min-width: 210px;
  background: var(--white);
  border: 1.5px solid #cfdbe8;
  border-radius: 14px;
  padding: 6px;
  box-shadow: 0 14px 32px rgba(11, 42, 74, .14);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.block-transform-title {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  padding: 5px 10px 3px;
}
.block-transform-opt {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--navy);
  font-family: var(--sans);
  font-size: .86rem;
  font-weight: 600;
  text-align: left;
  padding: 7px 10px;
  border-radius: 9px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}
.block-transform-opt span {
  color: var(--coral);
  font-weight: 800;
  width: 18px;
  text-align: center;
}
.block-transform-opt:hover {
  background: var(--sand);
}

.block-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}
.block-ctrl-btn {
  border: 1px solid #d5dee8;
  background: var(--white);
  color: var(--navy);
  font-family: var(--sans);
  font-size: .8rem;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 8px;
  cursor: pointer;
  transition: all .14s;
}
.block-ctrl-btn:hover { background: #f1f5f9; border-color: #b4c3d4; }
.block-ctrl-btn.del {
  color: #b91c1c;
  border-color: #fecaca;
}
.block-ctrl-btn.del:hover { background: #fef2f2; border-color: #f87171; }

/* Mini barra de texto enriquecido en párrafos y listas */
.rte-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.rte-btn {
  border: 1px solid #cbd5e1;
  background: var(--white);
  color: var(--navy);
  font-family: var(--sans);
  font-size: .82rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: all .14s;
}
.rte-btn:hover { background: var(--sky); border-color: var(--ocean); }
.rte-btn.is-active {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--white);
}
.rte-hint {
  margin-left: auto;
  font-size: .75rem;
  color: #94a3b8;
}

/* Barra inline para añadir/editar enlaces sin window.prompt */
.rte-link-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  padding: 9px 11px;
  margin-bottom: 9px;
  background: var(--sky);
  border: 1px solid #bcd9ec;
  border-radius: 11px;
}
.rte-link-bar input {
  flex: 1 1 210px;
  padding: 7px 11px;
  border: 1.5px solid #b5cde0;
  border-radius: 8px;
  font-family: var(--sans);
  font-size: .88rem;
  background: var(--white);
  color: var(--ink);
}
.rte-link-bar input:focus {
  outline: none;
  border-color: var(--ocean);
}

.rte-editor {
  min-height: 78px;
  padding: 12px 14px;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  background: var(--white);
  font-size: 1.02rem;
  line-height: 1.68;
  color: var(--ink);
}
.rte-editor a,
.list-rte-input a {
  color: var(--ocean);
  text-decoration: underline;
  font-weight: 600;
}
.rte-editor:focus {
  outline: none;
  border-color: var(--ocean);
  box-shadow: 0 0 0 3px rgba(14, 94, 138, .12);
}
.rte-editor:empty::before {
  content: attr(data-placeholder);
  color: #94a3b8;
}

/* Menú rápido al escribir "/" en un párrafo vacío */
.slash-menu {
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--sand);
  border: 1.5px solid #e4d4be;
  border-radius: 13px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  box-shadow: 0 8px 20px rgba(11, 42, 74, .08);
}
.slash-menu-label {
  font-size: .78rem;
  font-weight: 800;
  color: var(--navy);
  margin-right: 4px;
}
.slash-opt-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid rgba(11, 42, 74, .16);
  background: var(--white);
  color: var(--navy);
  font-family: var(--sans);
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
}
.slash-opt-btn span {
  color: var(--coral);
  font-weight: 800;
}
.slash-opt-btn:hover,
.slash-opt-btn.is-selected {
  border-color: var(--coral);
  background: #fff5f1;
  color: var(--coral-dark);
}

/* Subida de foto dentro de bloque */
.block-photo-drop {
  border: 2px dashed #cbd5e1;
  border-radius: 14px;
  padding: 26px 18px;
  text-align: center;
  background: var(--white);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.block-photo-drop:hover,
.block-photo-drop.dragover {
  border-color: var(--coral);
  background: #fff8f5;
}
.block-photo-preview img {
  max-height: 320px;
  border-radius: 12px;
  margin-bottom: 10px;
  object-fit: cover;
}
.block-photo-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.admin-mini-btn.is-cover {
  background: #ecfdf5;
  border-color: #86efac;
  color: #166534;
}
.caption-input {
  margin-top: 8px;
  font-size: .92rem;
}

.upload-status-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  margin-bottom: 10px;
  border-radius: 11px;
  background: var(--sky);
  color: var(--ocean);
  font-size: .88rem;
  font-weight: 700;
}
@keyframes spinPulse {
  to { transform: rotate(360deg); }
}
.upload-spinner {
  width: 16px;
  height: 16px;
  border: 2.5px solid rgba(14, 94, 138, .25);
  border-top-color: var(--ocean);
  border-radius: 50%;
  animation: spinPulse .75s linear infinite;
}

/* Galería en editor (con Drag & Drop de fotos) */
.editor-gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}
.editor-gal-card {
  position: relative;
  background: var(--white);
  border: 1.5px solid #dce4ee;
  border-radius: 12px;
  padding: 10px;
  transition: transform .15s, box-shadow .15s, border-color .15s, opacity .15s;
}
.editor-gal-card:hover {
  border-color: #b8c9dc;
}
.editor-gal-card.is-dragging {
  opacity: .38;
  transform: scale(.96);
}
.editor-gal-card.gal-drop-target {
  border-color: var(--coral);
  box-shadow: 0 0 0 3px rgba(242, 105, 75, .25);
  transform: translateY(-2px);
}
.gal-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 7px;
}
.gal-drag-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .76rem;
  font-weight: 800;
  color: var(--navy);
  background: #f1f5f9;
  padding: 3px 8px;
  border-radius: 999px;
  cursor: grab;
  user-select: none;
}
.gal-drag-badge:active { cursor: grabbing; }
.editor-gal-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: grab;
}
.editor-gal-card input {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-family: var(--sans);
  font-size: .85rem;
  margin-bottom: 6px;
}
.gal-card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

/* Lista de puntos en editor (con Drag & Drop de puntos) */
.list-items-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}
.list-item-row {
  display: flex;
  align-items: center;
  gap: 7px;
  border-radius: 10px;
  transition: transform .12s, box-shadow .12s, opacity .12s;
}
.list-item-row.is-dragging {
  opacity: .4;
}
.list-item-row.li-drop-target {
  box-shadow: 0 -3px 0 0 var(--coral);
}
.li-drag-handle {
  appearance: none;
  border: 0;
  background: transparent;
  color: #94a3b8;
  font-size: .95rem;
  padding: 4px 4px;
  cursor: grab;
  user-select: none;
  border-radius: 6px;
}
.li-drag-handle:hover {
  color: var(--navy);
  background: #eef2f7;
}
.li-drag-handle:active { cursor: grabbing; }
.list-rte-input {
  flex: 1;
  min-height: 44px;
  line-height: 1.5;
}
.list-rte-input:empty::before {
  content: attr(data-placeholder);
  color: #94a3b8;
}
.list-item-bullet {
  color: var(--ocean);
  font-weight: 800;
}

/* Botonera para añadir bloques (también acepta soltar fotos) */
.add-block-panel {
  margin-top: 24px;
  padding: 20px;
  background: var(--sand);
  border-radius: 18px;
  border: 1.5px solid #eadcc8;
  transition: border-color .18s, background .18s, box-shadow .18s;
}
.add-block-panel.dragover {
  border-style: dashed;
  border-color: var(--coral);
  background: #fff7f3;
  box-shadow: 0 0 0 3px rgba(242, 105, 75, .15);
}
.add-block-title {
  font-weight: 700;
  color: var(--navy);
  font-size: .95rem;
  margin: 0 0 12px;
}
.add-block-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.add-block-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1.5px solid rgba(11, 42, 74, .12);
  background: var(--white);
  color: var(--navy);
  font-family: var(--sans);
  text-align: left;
  cursor: pointer;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.add-block-btn:hover {
  border-color: var(--coral);
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(11, 42, 74, .08);
}
.ab-icon {
  font-size: 1.25rem;
  line-height: 1.2;
  color: var(--coral);
  font-weight: 800;
}
.add-block-btn strong { font-size: .95rem; }
.add-block-btn small { font-size: .78rem; color: var(--muted); }

/* Modal Vista Previa Contextual (Desktop & Mobile) */
.preview-modal {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: #1a232f;
  display: flex;
  flex-direction: column;
}
.preview-modal[hidden] { display: none !important; }
.preview-modal-bar {
  background: var(--navy);
  color: var(--white);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .2);
  flex-shrink: 0;
}
.preview-modal-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.preview-lang-tag {
  display: inline-block;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  background: rgba(255, 255, 255, .15);
  color: var(--gold);
  padding: 2px 8px;
  border-radius: 999px;
}
.preview-device-switch {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, .1);
  padding: 3px;
  border-radius: 999px;
  gap: 2px;
}
.preview-device-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, .8);
  font-family: var(--sans);
  font-size: .84rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all .2s ease;
}
.preview-device-btn:hover {
  color: var(--white);
  background: rgba(255, 255, 255, .1);
}
.preview-device-btn.active {
  background: var(--white);
  color: var(--navy);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}
.preview-modal-actions .btn {
  cursor: pointer;
}
.preview-modal-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  background: #1e293b;
  display: flex;
  flex-direction: column;
}
.preview-stage {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  transition: background .25s ease, padding .25s ease;
}
.preview-stage.mode-desktop {
  background: var(--white);
  padding: 0;
}
.preview-stage.mode-desktop .preview-device-frame {
  width: 100%;
  max-width: 100%;
  background: var(--white);
}
.preview-stage.mode-desktop .preview-phone-notch {
  display: none;
}
.preview-stage.mode-mobile {
  background: #0f172a;
  padding: 36px 16px 54px;
}
.preview-stage.mode-mobile .preview-device-frame {
  width: 390px;
  max-width: 100%;
  min-height: 740px;
  background: var(--white);
  border-radius: 46px;
  box-shadow: 0 25px 65px rgba(0, 0, 0, .6), 0 0 0 12px #334155;
  overflow: hidden;
  position: relative;
  padding: 8px 0 24px;
}
.preview-stage.mode-mobile .preview-phone-notch {
  display: block;
  width: 110px;
  height: 22px;
  background: #334155;
  border-radius: 0 0 14px 14px;
  margin: 0 auto 10px;
}
.preview-stage.mode-mobile .article-header {
  padding-inline: 16px;
  margin-bottom: 22px;
}
.preview-stage.mode-mobile .article-header h1 {
  font-size: 1.85rem;
  line-height: 1.22;
}
.preview-stage.mode-mobile .article-content {
  padding-inline: 16px;
  font-size: 1.02rem;
  line-height: 1.7;
}
.preview-stage.mode-mobile .article-cover {
  margin-inline: 16px;
  border-radius: 14px;
}
.preview-stage.mode-mobile .author-card {
  margin-inline: 16px;
  padding: 22px 18px;
  gap: 14px;
}

/* Modal de confirmación (Borrado seguro) */
.admin-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 220;
  background: rgba(11, 27, 43, .65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: modalFadeIn .2s ease;
}
.admin-modal-backdrop[hidden] {
  display: none !important;
}
@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.admin-modal-card {
  background: var(--white);
  border-radius: 22px;
  padding: 34px 28px 28px;
  max-width: 460px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 60px rgba(11, 42, 74, .34);
  animation: modalScaleUp .22s cubic-bezier(.16, 1, .3, 1);
}
@keyframes modalScaleUp {
  from { opacity: 0; transform: scale(.93); }
  to { opacity: 1; transform: scale(1); }
}
.admin-modal-icon.danger {
  width: 58px;
  height: 58px;
  background: #fee2e2;
  color: #dc2626;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
}
.admin-modal-card h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.5rem;
  color: var(--navy);
  margin: 0 0 10px;
}
.admin-modal-card p {
  color: var(--muted);
  font-size: .95rem;
  line-height: 1.55;
  margin: 0 0 26px;
}
.admin-modal-card p strong {
  color: var(--navy);
}
.admin-modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.btn-modal-danger {
  background: #dc2626 !important;
  color: var(--white) !important;
  border: 1px solid #b91c1c !important;
  cursor: pointer;
}
.btn-modal-danger:hover {
  background: #b91c1c !important;
}

/* Toast con botón de acción opcional (ej. Deshacer) */
.admin-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 250;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(92vw, 560px);
  background: var(--navy);
  color: var(--white);
  font-weight: 600;
  font-size: .93rem;
  padding: 11px 18px 11px 20px;
  border-radius: 999px;
  box-shadow: 0 14px 34px rgba(11, 42, 74, .35);
}
.admin-toast.error { background: #b91c1c; }
.admin-toast-btn {
  appearance: none;
  border: 0;
  background: var(--gold);
  color: var(--navy);
  font-family: var(--sans);
  font-weight: 800;
  font-size: .82rem;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .14s, background .14s;
}
.admin-toast-btn:hover {
  background: #fcd34d;
  transform: scale(1.03);
}

/* Responsive móvil para que Elena pueda publicar incluso desde el teléfono */
@media (max-width: 760px) {
  .admin-login-card { padding: 28px 22px; }
  .dash-item { grid-template-columns: 1fr; gap: 12px; }
  .dash-thumb { width: 100%; height: 150px; }
  .dash-search-wrap { max-width: 100%; }
  .editor-card { padding: 22px 18px; }
  .meta-row { grid-template-columns: 1fr; }
  .add-block-grid { grid-template-columns: repeat(2, 1fr); }
  .editor-gallery-grid { grid-template-columns: 1fr; }
  .rte-hint { display: none; }
  .blocks-tips-badge { display: none; }
  .editor-autosave-status { font-size: .75rem; padding: 2px 7px; margin-right: 0; }
  .preview-modal-bar { padding: 10px 14px; flex-wrap: wrap; }
  .preview-modal-left { width: 100%; order: 1; }
  .preview-device-switch { order: 2; }
  .preview-modal-actions { order: 3; }
}

/* Barra fija compacta en móvil: deja sitio para escribir con el teclado abierto */
@media (max-width: 760px) {
  .editor-sticky-inner { gap: 6px; padding-top: 6px; padding-bottom: 6px; }
  .editor-sticky-left { width: 100%; gap: 8px; flex-wrap: nowrap; }
  .editor-back-btn { font-size: .88rem; white-space: nowrap; }
  .editor-save-indicator,
  .editor-autosave-status,
  .quick-insert-label { display: none !important; }
  .editor-sticky-btns { width: 100%; flex-wrap: nowrap; gap: 6px; }
  .editor-sticky-btns .admin-btn-secondary,
  .editor-sticky-btns .btn { flex: 1 1 0; min-width: 0; padding: 9px 6px; font-size: .8rem; white-space: nowrap; text-align: center; }
  .editor-sticky-btns .admin-icon-btn,
  .editor-sticky-btns .admin-live-link { display: none; }
  .editor-quick-insert { padding: 5px 0; }
  .quick-ins-btn { padding: 7px 11px; font-size: .82rem; }
}
