/* ── Layout ───────────────────────────────────────────────────────────────── */
.art-layout {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 20px;
  align-items: start;
  padding: 20px;
  min-height: calc(100vh - 100px);
}

/* ── Editor ───────────────────────────────────────────────────────────────── */
.art-editor .md-editor {
  height: calc(100vh - 140px);
  min-height: 520px;
}

/* ── Rail ─────────────────────────────────────────────────────────────────── */
.art-rail {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  scrollbar-width: thin;
  background: var(--color-base-100, #fff);
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
}
.dark .art-rail { background: #1f2937; border-color: #374151; }

/* Grupos */
.art-rail__group { display: flex; flex-direction: column; gap: 5px; }

.art-rail__label {
  font-size: 0.69rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #6b7280;
}
.dark .art-rail__label { color: #9ca3af; }
.art-rail__required { color: #ef4444; }
.art-rail__error { font-size: 0.72rem; color: #ef4444; margin: 0; }

/* Inputs / selects */
.art-rail select {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.84rem;
  background: #fff;
  color: #111827;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}


.art-rail select:focus {
  border-color: #0099BB;
  box-shadow: 0 0 0 3px rgba(0,153,187,.12);
}
.dark .art-rail select { background: #111827; border-color: #374151; color: #f3f4f6; }

/* Toggles */
.art-rail__toggles { display: flex; flex-direction: column; gap: 8px; }
.art-rail__toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 500;
  color: #374151;
  user-select: none;
}
.dark .art-rail__toggle { color: #d1d5db; }
.art-rail__toggle input[type="checkbox"] {
  width: 36px; height: 20px;
  appearance: none;
  background: #d1d5db;
  border-radius: 20px;
  position: relative;
  cursor: pointer;
  transition: background .2s;
  flex-shrink: 0;
}
.art-rail__toggle input[type="checkbox"]::after {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  background: #fff;
  border-radius: 50%;
  top: 3px; left: 3px;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.art-rail__toggle input[type="checkbox"]:checked { background: #0099BB; }
.art-rail__toggle input[type="checkbox"]:checked::after      { transform: translateX(16px); }

/* Acciones */
.art-rail__actions { display: flex; flex-direction: column; gap: 7px; }
.art-rail__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 10px 0;
  border-radius: 7px;
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  border: none;
  transition: opacity .15s, background .15s;
  text-decoration: none;
  line-height: 1;
}
.art-rail__btn--primary { background: #0099BB; color: #fff; }
.art-rail__btn--primary:hover   { opacity: .88; }
.art-rail__btn--primary:disabled { opacity: .6; cursor: not-allowed; }
.art-rail__btn--ghost {
  background: transparent;
  color: #6b7280;
  border: 1px solid #e5e7eb;
}
.art-rail__btn--ghost:hover { background: #f9fafb; color: #374151; }
.dark .art-rail__btn--ghost { border-color: #374151; color: #9ca3af; }
.dark .art-rail__btn--ghost:hover { background: #374151; color: #d1d5db; }

/* Info extraída del MD */
.art-rail__parsed {
  padding: 10px;
  background: #f9fafb;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dark .art-rail__parsed { background: #111827; }
.art-rail__parsed-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: #374151;
  margin: 0;
  line-height: 1.4;
}
.dark .art-rail__parsed-title { color: #d1d5db; }
.art-rail__parsed-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.art-rail__tag {
  font-size: 0.65rem;
  padding: 2px 7px;
  background: #0099BB;
  color: #fff;
  border-radius: 20px;
  font-weight: 600;
}
.art-rail__parsed-date {
  font-size: 0.69rem;
  color: #9ca3af;
}

/* Meta */
.art-rail__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.69rem;
  color: #9ca3af;
  padding-top: 8px;
  border-top: 1px solid #f3f4f6;
}
.dark .art-rail__meta { border-color: #374151; }

/* Errores globales */
.art-errors {
  margin: 12px 20px 0;
  padding: 10px 14px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 7px;
  color: #7f1d1d;
  font-size: 0.84rem;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .art-layout { grid-template-columns: 1fr; padding: 14px; }
  .art-rail   { position: static; max-height: none; }
  .art-editor .md-editor { height: 500px; }
}
/* ── Image Picker (ip) ─────────────────────────────────────────────────────── */

[data-ip] {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 2px dashed #DDE2DC;
  transition: border-color 0.18s, box-shadow 0.18s;
  background: #F3F4F1;
  cursor: pointer;
}
.dark [data-ip] { border-color: #2C3040; background: #1C1F27; }

[data-ip].ip--over {
  border-color: #0099BB;
  box-shadow: 0 0 0 3px rgba(0,153,187,.12);
  background: #f0fafc;
}
.dark [data-ip].ip--over { background: #0a1e24; }

/* shape: rect (default) — 16:9 aprox */
[data-ip][data-shape="rect"] {
  width: 100%;
  min-height: 180px;
}

/* shape: circle — avatar */
[data-ip][data-shape="circle"] {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Estado cargado ── */
.ip__loaded {
  position: relative;
  width: 100%;
  height: 100%;
}

[data-ip][data-shape="rect"] .ip__loaded { min-height: 180px; }
[data-ip][data-shape="circle"] .ip__loaded { height: 180px; }

.ip__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Overlay al hover */
.ip__overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 14, 25, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  opacity: 0;
  transition: opacity 0.18s;
}
[data-ip]:hover .ip__overlay { opacity: 1; }

.ip__change-btn,
.ip__clear-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 0.78rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s;
}
.ip__change-btn {
  background: #0099BB;
  color: #fff;
}
.ip__clear-btn {
  background: rgba(255,255,255,.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,.3);
}
.ip__change-btn:hover,
.ip__clear-btn:hover { opacity: 0.85; }

/* ── Estado vacío ── */
.ip__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px 20px;
  text-align: center;
  min-height: 180px;
}

[data-ip][data-shape="circle"] .ip__empty { min-height: 0; height: 100%; padding: 16px; }

.ip__empty-icon { color: #C9D1C9; }

.ip__empty-text {
  font-size: 0.84rem;
  color: #5A6478;
  margin: 0;
}
.dark .ip__empty-text { color: #8A92A8; }

.ip__pick-btn {
  padding: 8px 18px;
  border-radius: 7px;
  background: #0099BB;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s;
}
.ip__pick-btn:hover { opacity: 0.88; }

.ip__empty-hint {
  font-size: 0.69rem;
  color: #8F9BAD;
}

.ip__input-wrap { display: none; }