/* CMS module styles — loaded for view-sitio-web */
#view-sitio-web .cms-landing { padding: 24px; max-width: 1100px; margin: 0 auto; }
#view-sitio-web .cms-landing h1 { margin: 0 0 4px; font-size: 28px; }
#view-sitio-web .cms-subtitle { color: #666; margin: 0 0 24px; }
#view-sitio-web .cms-entities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
#view-sitio-web .cms-entity-card {
  display: flex; flex-direction: column; align-items: flex-start;
  padding: 18px; border: 1px solid #e5e7eb; border-radius: 12px;
  background: #fff; cursor: pointer; text-align: left;
  transition: border-color .12s, transform .08s;
  font-family: inherit;
}
#view-sitio-web .cms-entity-card:hover { border-color: #1E40AF; transform: translateY(-1px); }
#view-sitio-web .cms-entity-icon { font-size: 28px; margin-bottom: 6px; }
#view-sitio-web .cms-entity-label { font-weight: 600; font-size: 16px; margin-bottom: 4px; color: #0F172A; }
#view-sitio-web .cms-entity-hint { font-size: 13px; color: #6b7280; }

#view-sitio-web .cms-list-screen { padding: 24px; max-width: 1100px; margin: 0 auto; }
#view-sitio-web .cms-list-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
#view-sitio-web .cms-back-btn { background: none; border: 1px solid #e5e7eb; border-radius: 8px; padding: 6px 12px; cursor: pointer; }
#view-sitio-web .cms-list { list-style: none; padding: 0; margin: 0; }
#view-sitio-web .cms-list-item {
  padding: 10px 14px; border: 1px solid #e5e7eb; border-radius: 8px;
  margin-bottom: 8px; background: #fff;
}
#view-sitio-web .cms-id { color: #9ca3af; font-family: monospace; font-size: 12px; margin-left: 8px; }
#view-sitio-web .cms-empty { color: #6b7280; font-style: italic; }

/* Detail form */
#view-sitio-web .cms-detail-screen { padding: 24px; max-width: 760px; margin: 0 auto; }
#view-sitio-web .cms-detail-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
#view-sitio-web .cms-detail-form { display: flex; flex-direction: column; gap: 14px; }
#view-sitio-web .cms-field { display: flex; flex-direction: column; gap: 4px; }
#view-sitio-web .cms-field-active {
  border-radius: 8px;
  outline: 3px solid rgba(245, 158, 11, 0.35);
  background: #fffbeb;
  transition: outline-color .18s, background .18s;
}
#view-sitio-web .cms-field label { font-weight: 600; font-size: 13px; color: #0F172A; display: flex; align-items: center; gap: 8px; }
#view-sitio-web .cms-field input[type="text"],
#view-sitio-web .cms-field input[type="number"],
#view-sitio-web .cms-field textarea,
#view-sitio-web .cms-field select {
  font: inherit; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff;
}
#view-sitio-web .cms-field textarea { resize: vertical; min-height: 60px; }
#view-sitio-web .cms-field input:disabled,
#view-sitio-web .cms-field textarea:disabled,
#view-sitio-web .cms-field select:disabled { background: #f3f4f6; color: #6b7280; cursor: not-allowed; }
#view-sitio-web .cms-hint { color: #6b7280; font-size: 12px; }
#view-sitio-web .cms-lock { background: #fef3c7; color: #92400e; padding: 2px 6px; border-radius: 999px; font-size: 11px; font-weight: 600; }
#view-sitio-web .cms-form-actions { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
#view-sitio-web .cms-save-btn { background: #1E40AF; color: white; border: 0; padding: 9px 16px; border-radius: 8px; font: inherit; cursor: pointer; }
#view-sitio-web .cms-save-btn:hover { background: #1e3a8a; }
#view-sitio-web .cms-cancel-btn { background: #fff; border: 1px solid #d1d5db; padding: 9px 16px; border-radius: 8px; font: inherit; cursor: pointer; }
#view-sitio-web .cms-save-status { font-size: 13px; }
#view-sitio-web .cms-save-status.saving { color: #6b7280; }
#view-sitio-web .cms-save-status.ok { color: #059669; }
#view-sitio-web .cms-save-status.err { color: #dc2626; }
#view-sitio-web .cms-list-filter { width: 100%; padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 8px; margin-bottom: 12px; }
#view-sitio-web .cms-list-item { cursor: pointer; }
#view-sitio-web .cms-list-item:hover { border-color: #1E40AF; }
#view-sitio-web .cms-new-btn { margin-left: auto; background: #1E40AF; color: white; border: 0; padding: 6px 12px; border-radius: 8px; font: inherit; cursor: pointer; }
#view-sitio-web .cms-multi-select {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 6px 14px; padding: 10px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff;
}
#view-sitio-web .cms-multi-opt { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
#view-sitio-web .cms-multi-opt input { margin: 0; }

/* SEO Keyword Highlighter overlay (Task 14) */
#view-sitio-web .cms-input-wrap { position: relative; }
#view-sitio-web .cms-seo-overlay {
  position: absolute; left: 0; top: 0; right: 0; bottom: 0;
  padding: 8px 10px;
  font: inherit; color: transparent;
  white-space: pre-wrap; word-break: break-word; overflow: hidden;
  pointer-events: none; border: 1px solid transparent;
}
#view-sitio-web .cms-input-wrap .cms-seo-overlay { z-index: 1; }
#view-sitio-web .cms-input-wrap input[type="text"],
#view-sitio-web .cms-input-wrap textarea {
  position: relative; z-index: 2; background: transparent;
}
#view-sitio-web .cms-seo-mark {
  background: transparent;
  border-bottom: 2px solid #f59e0b;
  color: transparent;
  pointer-events: auto;
  cursor: help;
  border-radius: 0;
}

/* Image picker field (Task 16) */
#view-sitio-web .cms-image-picker {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff;
}
#view-sitio-web .cms-image-preview {
  width: 110px; height: 110px; border-radius: 6px; overflow: hidden;
  background: #f3f4f6; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
#view-sitio-web .cms-image-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
#view-sitio-web .cms-image-empty, #view-sitio-web .cms-image-loading { color: #9ca3af; font-size: 12px; }
#view-sitio-web .cms-image-pick-btn,
#view-sitio-web .cms-image-focal-btn,
#view-sitio-web .cms-image-clear-btn {
  background: #fff; border: 1px solid #d1d5db; padding: 6px 12px; border-radius: 8px; cursor: pointer; font: inherit;
}
#view-sitio-web .cms-image-pick-btn:hover { background: #f9fafb; }
#view-sitio-web .cms-image-focal-btn { background: #fef3c7; border-color: #f59e0b; }
#view-sitio-web .cms-image-focal-btn:disabled,
#view-sitio-web .cms-image-clear-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Modal shell */
.cms-modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.cms-modal {
  background: #fff; border-radius: 12px; max-width: 1100px; width: 100%; max-height: 90vh;
  display: flex; flex-direction: column; overflow: hidden; font-family: 'Nunito Sans', system-ui, sans-serif;
}
.cms-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid #e5e7eb;
}
.cms-modal-header h3 { margin: 0; font-size: 16px; }
.cms-modal-close {
  background: none; border: 0; font-size: 24px; cursor: pointer; color: #6b7280; line-height: 1;
}

/* Image picker grid */
.cms-image-modal { max-width: 1100px; }
.cms-image-modal .cms-image-scope {
  margin: 12px 20px 0; color: #6b7280; font-size: 13px;
}
.cms-image-modal .cms-image-filter {
  margin: 12px 20px; padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 8px;
}
.cms-image-modal .cms-image-grid {
  padding: 16px 20px; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px; overflow-y: auto;
}
.cms-image-modal .cms-image-tile {
  display: flex; flex-direction: column; gap: 4px; padding: 4px; background: #fff;
  border: 1px solid #e5e7eb; border-radius: 8px; cursor: pointer;
}
.cms-image-modal .cms-image-tile:hover { border-color: #1E40AF; }
.cms-image-modal .cms-image-tile img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 4px; }
.cms-image-modal .cms-image-tile-label {
  font-size: 11px; color: #6b7280; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Focal point editor */
.cms-focal-modal { max-width: 760px; }
.cms-focal-modal .cms-focal-body { padding: 16px; }
.cms-focal-canvas { position: relative; max-height: 380px; overflow: hidden; border-radius: 8px; cursor: crosshair; }
.cms-focal-img { display: block; max-width: 100%; max-height: 380px; }
.cms-focal-marker {
  position: absolute; width: 22px; height: 22px;
  background: #f59e0b; border: 3px solid #fff; border-radius: 50%;
  transform: translate(-50%, -50%); pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.cms-focal-controls { padding: 12px 0 0; }
.cms-focal-hint { color: #6b7280; font-size: 13px; margin: 0 0 6px; }
.cms-focal-coords { font-size: 13px; margin: 6px 0; }
.cms-focal-save {
  background: #1E40AF; color: white; border: 0; padding: 9px 16px; border-radius: 8px; font: inherit; cursor: pointer;
}
.cms-focal-save:hover { background: #1e3a8a; }

/* Split-screen detail form */
#view-sitio-web .cms-split {
  display: grid; grid-template-columns: minmax(380px, 1fr) minmax(420px, 1.3fr);
  gap: 16px; max-width: none; padding: 0;
  height: calc(100vh - 60px);
}
#view-sitio-web .cms-pane-left {
  overflow-y: auto; padding: 18px 20px; border-right: 1px solid #e5e7eb; background: #fff;
}
#view-sitio-web .cms-pane-right {
  display: flex; flex-direction: column; background: #f9fafb;
}
#view-sitio-web .cms-preview-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; background: #fef3c7; border-bottom: 1px solid #f59e0b; font-size: 13px;
}
#view-sitio-web .cms-preview-reload {
  background: none; border: 1px solid #f59e0b; color: #92400e;
  width: 28px; height: 28px; border-radius: 6px; cursor: pointer; line-height: 1;
}
#view-sitio-web .cms-preview-iframe { flex: 1; width: 100%; border: 0; background: #fff; }
#view-sitio-web .cms-preview-empty {
  flex: 1; display: flex; align-items: center; justify-content: center;
  color: #6b7280; font-size: 14px; padding: 24px; text-align: center;
}

/* Compact form on left pane */
#view-sitio-web .cms-pane-left .cms-detail-form { gap: 10px; }
#view-sitio-web .cms-pane-left .cms-field { font-size: 13px; }
#view-sitio-web .cms-pane-left .cms-detail-screen { padding: 0; max-width: none; }

/* Save status — auto-save indicator */
#view-sitio-web .cms-save-status.saved { color: #059669; font-size: 12px; }

/* Mobile: stack panes vertically */
@media (max-width: 900px) {
  #view-sitio-web .cms-split { grid-template-columns: 1fr; height: auto; }
  #view-sitio-web .cms-pane-left { border-right: 0; border-bottom: 1px solid #e5e7eb; }
  #view-sitio-web .cms-preview-iframe { min-height: 480px; }
}

/* Image picker tabs (Task 9 — Fase 2A) */
.cms-image-tabs {
  display: flex; gap: 4px; padding: 12px 16px 0;
  border-bottom: 1px solid #e5e7eb;
}
.cms-tab {
  padding: 8px 16px; border: 0; border-bottom: 2px solid transparent;
  background: none; cursor: pointer; font: inherit; color: #6b7280;
  border-radius: 0;
}
.cms-tab.is-active { color: #1E40AF; border-bottom-color: #1E40AF; }
.cms-tab-pane { display: none; }
.cms-tab-pane.is-active { display: block; }

/* Upload dropzone */
.cms-upload-dropzone {
  margin: 16px; padding: 32px;
  border: 2px dashed #d1d5db; border-radius: 12px; text-align: center;
  background: #fafbfc; transition: all .15s ease;
}
.cms-upload-dropzone.is-dragover {
  border-color: #1E40AF; background: #eff6ff;
}
.cms-upload-dropzone p { margin: 0 0 8px; color: #4b5563; }
.cms-upload-hint { font-size: 12px; color: #9ca3af; margin-top: 12px; }
.cms-upload-browse {
  background: #1E40AF; color: white; border: 0; padding: 8px 16px;
  border-radius: 8px; font: inherit; cursor: pointer;
}
.cms-upload-browse:hover { background: #1e3a8a; }
.cms-upload-queue { padding: 0 16px 16px; max-height: 320px; overflow-y: auto; }

/* Task 10 — upload queue rows + progress bar */
.cms-upload-row {
  display: flex; align-items: center; gap: 12px; padding: 10px;
  border: 1px solid #e5e7eb; border-radius: 8px; margin-bottom: 8px; background: #fff;
}
.cms-upload-row-rejected { background: #fee2e2; border-color: #fca5a5; }
.cms-upload-thumb {
  width: 56px; height: 56px; flex-shrink: 0;
  border-radius: 6px; overflow: hidden; background: #f3f4f6;
}
.cms-upload-meta { flex: 1; min-width: 0; }
.cms-upload-name {
  font-size: 13px; font-weight: 600; color: #0F172A;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cms-upload-size { font-size: 11px; color: #6b7280; }
.cms-upload-bar {
  height: 6px; background: #e5e7eb; border-radius: 3px; overflow: hidden;
  margin: 6px 0;
}
.cms-upload-bar-fill {
  height: 100%; background: #1E40AF; transition: width .12s ease;
}
.cms-upload-status { font-size: 12px; color: #6b7280; }
.cms-upload-status.err { color: #dc2626; }
.cms-upload-status.ok { color: #059669; }
.cms-upload-cancel {
  background: none; border: 0; font-size: 22px; cursor: pointer; color: #6b7280;
}

/* Image picker tile overlay (Task 15 — Fase 2A) */
.cms-image-tile { position: relative; transition: opacity .25s ease; }
.cms-image-tile-overlay {
  position: absolute; top: 0; right: 0; left: 0;
  display: none;
  align-items: flex-start; justify-content: flex-end; gap: 4px; padding: 6px;
  background: rgba(0, 0, 0, 0.4);
  border-top-left-radius: 8px; border-top-right-radius: 8px;
}
.cms-image-tile:hover .cms-image-tile-overlay { display: flex; }
.cms-tile-action {
  background: white; border: 0; padding: 4px 8px; border-radius: 6px;
  cursor: pointer; font-size: 14px; line-height: 1;
}
.cms-tile-delete:hover { background: #fee2e2; }
.cms-tile-info:hover { background: #dbeafe; }

/* Mostrar ocultas toggle (Task 16 — Fase 2A) */
.cms-show-hidden-toggle {
  margin-left: auto; margin-right: 12px; font-size: 13px; color: #6b7280;
  display: flex; align-items: center; gap: 6px; cursor: pointer;
}
.cms-show-hidden-toggle input { margin: 0; cursor: pointer; }
.cms-tile-recover { background: #d1fae5; }
.cms-tile-recover:hover { background: #a7f3d0; }

/* Status badge (Task 19 — Fase 2A) */
#view-sitio-web .cms-status-badge {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; padding: 4px 10px; border-radius: 999px;
  background: #f9fafb; border: 1px solid #e5e7eb;
  transition: all .2s ease;
}
#view-sitio-web .cms-status-badge[data-state="idle"] { display: none !important; }
#view-sitio-web .cms-status-badge[data-state="saved"] { background: #ecfdf5; border-color: #6ee7b7; }
#view-sitio-web .cms-status-badge[data-state="live"] { background: #ecfdf5; border-color: #34d399; font-weight: 600; }
#view-sitio-web .cms-status-badge[data-state="publishing"] { background: #eff6ff; border-color: #93c5fd; }
#view-sitio-web .cms-status-badge[data-state="error"] { background: #fee2e2; border-color: #fca5a5; }
#view-sitio-web .cms-status-time { color: inherit; opacity: 0.7; font-size: 11px; }

/* Discard draft button (Task 20 — Fase 2A) */
#view-sitio-web .cms-discard-btn {
  background: #fef3c7; border: 1px solid #f59e0b; color: #92400e;
  padding: 9px 16px; border-radius: 8px; font: inherit; cursor: pointer;
}
#view-sitio-web .cms-discard-btn:hover { background: #fde68a; }

/* Publish summary modal (Task 21 — Fase 2A) */
.cms-publish-modal { max-width: 640px; }
.cms-publish-body { padding: 16px 24px; max-height: 60vh; overflow-y: auto; }
.cms-publish-body p { margin: 0 0 12px; }
.cms-publish-diff { padding-left: 20px; margin: 8px 0 16px; font-size: 13px; line-height: 1.5; }
.cms-publish-diff li { margin-bottom: 6px; }
.cms-publish-warn {
  background: #fef3c7; border-left: 3px solid #f59e0b;
  padding: 12px 14px; margin: 12px 0; border-radius: 4px; font-size: 13px;
}
.cms-publish-note { font-size: 12px; color: #6b7280; }
.cms-modal-footer {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 14px 24px; border-top: 1px solid #e5e7eb;
}
.cms-btn-primary {
  background: #1E40AF; color: white; border: 0;
  padding: 9px 20px; border-radius: 8px; font: inherit; cursor: pointer;
}
.cms-btn-primary:hover { background: #1e3a8a; }
.cms-btn-secondary {
  background: #fff; border: 1px solid #d1d5db;
  padding: 9px 20px; border-radius: 8px; font: inherit; cursor: pointer;
}
