/* ============================================================
   Interfaz de administración — Estilos propios
   Completamente independiente del CSS de la web pública
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --admin-font: 'Inter', system-ui, -apple-system, sans-serif;

  /* Superficie */
  --admin-color-bg:        #f1f5f9;
  --admin-color-surface:   #ffffff;
  --admin-color-border:    #e2e8f0;
  --admin-color-border-strong: #cbd5e1;

  /* Texto */
  --admin-color-text:      #1e293b;
  --admin-color-muted:     #64748b;
  --admin-color-subtle:    #94a3b8;

  /* Primario */
  --admin-color-primary:        #2563eb;
  --admin-color-primary-hover:  #1d4ed8;
  --admin-color-primary-light:  #eff6ff;
  --admin-color-primary-subtle: #dbeafe;

  /* Semánticos */
  --admin-color-success:        #16a34a;
  --admin-color-success-bg:     #f0fdf4;
  --admin-color-success-border: #bbf7d0;
  --admin-color-danger:         #dc2626;
  --admin-color-danger-bg:      #fef2f2;
  --admin-color-danger-border:  #fecaca;
  --admin-color-warning:        #d97706;
  --admin-color-warning-bg:     #fffbeb;
  --admin-color-warning-border: #fde68a;

  /* Badges */
  --admin-color-draft-bg:      #f1f5f9;
  --admin-color-draft-text:    #475569;
  --admin-color-published-bg:  #f0fdf4;
  --admin-color-published-text:#15803d;

  /* Forma */
  --admin-radius:   8px;
  --admin-radius-sm: 5px;
  --admin-radius-lg: 12px;
  --admin-shadow:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --admin-shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);

  /* Modal/Dialog */
  --admin-modal-backdrop: rgba(15, 23, 42, 0.5);
  --admin-modal-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

body {
  font-family: var(--admin-font);
  background: var(--admin-color-bg);
  color: var(--admin-color-text);
  line-height: 1.5;
  min-height: 100vh;
  font-size: .9375rem;
  -webkit-font-smoothing: antialiased;
}

/* ---- Header ---- */

.admin-header {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  padding: 1.25rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.15), 0 1px 0 rgba(255,255,255,.06);
}

.admin-header h1 {
  font-size: 1.125rem;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: -.01em;
  display: flex;
  align-items: center;
  gap: .5rem;
}

#header-status {
  margin-left: auto;
  font-size: .8125rem;
  color: #cbd5e1;
  font-weight: 500;
}

/* ---- Layout ---- */

.admin-main {
  max-width: 1040px;
  margin: 2rem auto;
  padding: 0 1.25rem;
}

/* ---- Cards ---- */

.admin-card {
  background: var(--admin-color-surface);
  border: 1px solid var(--admin-color-border);
  border-radius: var(--admin-radius-lg);
  box-shadow: var(--admin-shadow);
  padding: 2rem;
  margin-bottom: 2rem;
}

/* ---- Progress bar ---- */

.wizard-progress {
  display: flex;
  gap: .375rem;
  margin-bottom: 2rem;
}

.wizard-progress__step {
  flex: 1;
  text-align: center;
  font-size: .75rem;
  font-weight: 500;
  color: var(--admin-color-subtle);
  padding: .5rem .25rem;
  border-bottom: 3px solid var(--admin-color-border);
  transition: color .2s, border-color .2s;
}

.wizard-progress__step--active {
  color: var(--admin-color-primary);
  border-bottom-color: var(--admin-color-primary);
  font-weight: 700;
}

.wizard-progress__step--done {
  color: var(--admin-color-success);
  border-bottom-color: var(--admin-color-success);
}

/* ---- Wizard steps ---- */

.wizard-step { display: none; }
.wizard-step--active { display: block; }

.wizard-step__title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  padding-bottom: .875rem;
  border-bottom: 1px solid var(--admin-color-border);
  color: var(--admin-color-text);
  letter-spacing: -.015em;
}

/* ---- Forms ---- */

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--admin-color-text);
  margin-bottom: .375rem;
  letter-spacing: .005em;
}

.form-group label .required {
  color: var(--admin-color-danger);
  margin-left: .2rem;
}

.form-control {
  display: block;
  width: 100%;
  padding: .5rem .75rem;
  font-size: .9375rem;
  font-family: inherit;
  color: var(--admin-color-text);
  background: var(--admin-color-surface);
  border: 1px solid var(--admin-color-border);
  border-radius: var(--admin-radius-sm);
  transition: border-color .15s, box-shadow .15s;
  line-height: 1.5;
}

.form-control:focus {
  outline: none;
  border-color: var(--admin-color-primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.form-control--error { border-color: var(--admin-color-danger); }

.form-control:read-only {
  background: var(--admin-color-bg);
  color: var(--admin-color-muted);
  cursor: default;
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
}

.form-hint {
  font-size: .775rem;
  font-weight: normal;
  color: var(--admin-color-muted);
  margin-top: .3rem;
}

.form-error {
  font-size: .775rem;
  color: var(--admin-color-danger);
  margin-top: .3rem;
  display: none;
}

.form-error--visible { display: block; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.char-count {
  font-size: .7rem;
  color: var(--admin-color-subtle);
  text-align: right;
  margin-top: .2rem;
  font-variant-numeric: tabular-nums;
}

.char-count--near { color: var(--admin-color-warning); }
.char-count--over { color: var(--admin-color-danger);  }

/* ---- Slug preview ---- */

.slug-preview {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .8125rem;
  color: var(--admin-color-muted);
  background: var(--admin-color-bg);
  border: 1px solid var(--admin-color-border);
  border-radius: var(--admin-radius-sm);
  padding: .4rem .75rem;
  margin-top: .5rem;
}

.slug-preview__label { font-weight: 600; font-size: .75rem; letter-spacing: .04em; text-transform: uppercase; }
.slug-preview__value { font-family: ui-monospace, 'Cascadia Code', monospace; font-size: .825rem; color: var(--admin-color-text); }

.slug-preview--error { border-color: var(--admin-color-danger); background: var(--admin-color-danger-bg); }
.slug-preview--error .slug-preview__value { color: var(--admin-color-danger); }

.slug-preview--success { border-color: var(--admin-color-success); background: var(--admin-color-success-bg); }
.slug-preview--success .slug-preview__value { color: var(--admin-color-success); }

.slug-preview--checking { border-color: var(--admin-color-warning); background: var(--admin-color-warning-bg); }
.slug-preview--checking .slug-preview__value { color: var(--admin-color-warning); opacity: 0.7; }

/* ---- Feedback en tiempo real (Feature 019 - US5) ---- */

.form-feedback {
  font-size: 0.8125rem;
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--admin-radius-sm);
  display: none;
}

.form-feedback.form-feedback--success {
  display: block;
  color: var(--admin-color-success);
  background: var(--admin-color-success-bg);
  border-left: 3px solid var(--admin-color-success);
}

.form-feedback.form-feedback--error {
  display: block;
  color: var(--admin-color-danger);
  background: var(--admin-color-danger-bg);
  border-left: 3px solid var(--admin-color-danger);
}

.form-feedback.form-feedback--neutral {
  display: block;
  color: var(--admin-color-muted);
  background: transparent;
}

/* ---- Barra de progreso de carga (Feature 019 - US6) ---- */

.upload-progress {
  border: 1px solid var(--admin-color-border);
  border-radius: var(--admin-radius);
  padding: 1.25rem;
  margin: 1rem 0;
  background: var(--admin-color-bg);
}

.upload-progress.hidden {
  display: none;
}

.upload-progress__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.upload-progress__title {
  font-weight: 600;
  color: var(--admin-color-text);
  font-size: 0.9375rem;
}

.progress-bar-container {
  position: relative;
  margin-bottom: 0.75rem;
}

.progress-bar {
  height: 8px;
  background: var(--admin-color-border);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--admin-color-success), #10b981);
  width: 0%;
  transition: width 0.3s ease;
}

.progress-bar__percentage {
  position: absolute;
  top: -1.5rem;
  right: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--admin-color-text);
}

.upload-progress__info {
  font-size: 0.8125rem;
  color: var(--admin-color-muted);
}

/* ========== Feature 019 - US7: Gallery Grid Preview ========== */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1.5rem;
  padding: 1rem;
  background: var(--admin-color-bg-light);
  border-radius: var(--admin-radius);
  border: 1px solid var(--admin-color-border);
}

.gallery-grid-item {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.75rem;
  background: white;
  border: 1px solid var(--admin-color-border);
  border-radius: var(--admin-radius);
  transition: all 0.2s ease;
  cursor: move;
}

.gallery-grid-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-color: var(--admin-color-primary);
}

.gallery-grid-item.gallery-grid-item--dragging {
  opacity: 0.5;
  background: var(--admin-color-bg-light);
}

.gallery-grid-item.gallery-grid-item--drag-over {
  border: 2px dashed var(--admin-color-primary);
  background: var(--admin-color-bg-light);
}

.gallery-grid-item__image-wrapper {
  position: relative;
  width: 100%;
  height: 200px;
  border-radius: calc(var(--admin-radius) - 2px);
  overflow: hidden;
  background: var(--admin-color-bg-light);
}

.gallery-grid-item__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-grid-item__order {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: var(--admin-color-primary);
  color: white;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.gallery-grid-item__drag-handle {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 1rem;
  line-height: 1;
  cursor: grab;
  user-select: none;
}

.gallery-grid-item__drag-handle:active {
  cursor: grabbing;
}

.gallery-grid-item__info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8125rem;
}

.gallery-grid-item__filename {
  font-weight: 600;
  color: var(--admin-color-text);
  margin: 0;
  word-break: break-all;
  font-size: 0.75rem;
}

.gallery-grid-item__caption-label {
  color: var(--admin-color-muted);
  margin: 0;
  font-size: 0.7rem;
  font-weight: 500;
}

.gallery-grid-item__caption-wrapper {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  min-height: 1.5rem;
}

.gallery-grid-item__caption {
  flex: 1;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  color: var(--admin-color-text);
  cursor: pointer;
  word-break: break-word;
  min-height: 1.25rem;
  line-height: 1.25;
}

.gallery-grid-item__caption[data-editable="true"] {
  background: var(--admin-color-bg-light);
  border: 1px solid var(--admin-color-border);
}

.gallery-grid-item__caption[data-editable="true"]:hover {
  background: #f3f4f6;
  border-color: var(--admin-color-primary);
}

.gallery-grid-item__caption--editing {
  outline: 2px solid var(--admin-color-primary);
  outline-offset: -1px;
}

.gallery-grid-item__delete {
  padding: 0.5rem;
  font-size: 0.875rem;
  width: 100%;
}

#progress-status {
  display: block;
  margin-bottom: 0.5rem;
}

/* ---- Stage items ---- */

.stage-item {
  border: 1px solid var(--admin-color-border);
  border-radius: var(--admin-radius);
  padding: 1.25rem;
  margin-bottom: .75rem;
  background: var(--admin-color-bg);
}

.stage-item__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  font-weight: 600;
  font-size: .875rem;
  color: var(--admin-color-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.btn-remove-stage {
  background: none;
  border: 1px solid var(--admin-color-border);
  border-radius: var(--admin-radius-sm);
  padding: .2rem .5rem;
  font-size: .75rem;
  color: var(--admin-color-danger);
  cursor: pointer;
  transition: background .15s;
}

.btn-remove-stage:hover { background: var(--admin-color-danger-bg); border-color: var(--admin-color-danger-border); }

/* ---- Buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .5rem 1.125rem;
  font-size: .875rem;
  font-family: inherit;
  font-weight: 600;
  border-radius: var(--admin-radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s, box-shadow .15s, transform .08s;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: .01em;
}

.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: var(--admin-color-primary);
  color: #fff;
  border-color: var(--admin-color-primary);
  box-shadow: 0 2px 4px rgba(37,99,235,.3);
  font-weight: 700;
}

.btn-primary:hover:not(:disabled) {
  background: var(--admin-color-primary-hover);
  border-color: var(--admin-color-primary-hover);
  box-shadow: 0 4px 8px rgba(37,99,235,.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--admin-color-surface);
  color: var(--admin-color-text);
  border-color: var(--admin-color-border);
  box-shadow: var(--admin-shadow);
}

.btn-secondary:hover:not(:disabled) { background: var(--admin-color-bg); border-color: var(--admin-color-border-strong); }

.btn-success {
  background: var(--admin-color-success);
  color: #fff;
  border-color: var(--admin-color-success);
  box-shadow: 0 1px 2px rgba(22,163,74,.25);
}

.btn-success:hover:not(:disabled) { background: #15803d; box-shadow: 0 2px 4px rgba(22,163,74,.3); }

.btn-danger {
  background: var(--admin-color-danger);
  color: #fff;
  border-color: var(--admin-color-danger);
  box-shadow: 0 1px 2px rgba(220,38,38,.2);
}

.btn-danger:hover:not(:disabled) { background: #b91c1c; box-shadow: 0 2px 4px rgba(220,38,38,.3); }

.btn-warning {
  background: #d97706;
  color: #fff;
  border-color: #d97706;
  box-shadow: 0 1px 2px rgba(217,119,6,.2);
}

.btn-warning:hover:not(:disabled) { background: #b45309; box-shadow: 0 2px 4px rgba(217,119,6,.3); }

.btn-gallery {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  color: #fff;
  border-color: #7c3aed;
  box-shadow: 0 4px 12px rgba(139,92,246,.3);
  font-weight: 600;
}

.btn-gallery:hover:not(:disabled) {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  border-color: #6d28d9;
  box-shadow: 0 6px 16px rgba(139,92,246,.4);
  transform: translateY(-2px);
}

.btn-edit {
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  color: #fff;
  border-color: #0891b2;
  box-shadow: 0 4px 12px rgba(6,182,212,.3);
  font-weight: 600;
}

.btn-edit:hover:not(:disabled) {
  background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%);
  border-color: #0e7490;
  box-shadow: 0 6px 16px rgba(6,182,212,.4);
  transform: translateY(-2px);
}

.gallery-divider {
  margin: 2rem 0;
  border: none;
  border-top: 1px solid var(--admin-color-border);
}

/* ---- Cover image upload ---- */
.cover-preview { margin-bottom: .5rem; }
.cover-preview img { max-width: 100%; max-height: 180px; border-radius: var(--admin-radius); border: 1px solid var(--admin-color-border); object-fit: cover; display: block; }
.cover-upload { display: flex; align-items: center; gap: .75rem; }

.btn-ghost {
  background: transparent;
  color: var(--admin-color-danger);
  border-color: var(--admin-color-danger-border);
}

.btn-ghost:hover:not(:disabled) { background: var(--admin-color-danger-bg); }

.btn-sm { padding: .3rem .7rem; font-size: .8125rem; border-radius: var(--admin-radius-sm); }

.btn-actions {
  display: flex;
  gap: .75rem;
  justify-content: space-between;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--admin-color-border);
}

/* ---- Badges ---- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .2rem .65rem;
  font-size: .7rem;
  font-weight: 700;
  border-radius: 99px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.badge--draft {
  background: #f8f9fa;
  color: #64748b;
  border: 1px solid #cbd5e1;
  font-weight: 600;
  padding: .375rem .625rem;
}

.badge--published {
  background: var(--admin-color-published-bg);
  color: var(--admin-color-published-text);
  border: 2px solid var(--admin-color-success);
  font-weight: 700;
  padding: .375rem .625rem;
}

/* ---- Trip list table ---- */

.trip-table {
  width: 100%;
  border-collapse: collapse;
}

.trip-table th {
  text-align: left;
  padding: .5rem .875rem;
  font-size: .7rem;
  font-weight: 700;
  color: var(--admin-color-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  border-bottom: 2px solid var(--admin-color-border);
}

.trip-table td {
  text-align: left;
  padding: 1rem .875rem;
  font-size: .875rem;
  border-bottom: 1px solid var(--admin-color-border);
  vertical-align: middle;
}

.trip-table tr:last-child td { border-bottom: none; }

/* Filas alternadas para mejor legibilidad */
.trip-table tbody tr:nth-child(even) td { background: var(--admin-color-bg); }

.trip-table tbody tr:hover td { background: var(--admin-color-primary-light); transition: background .15s; }

/* Acciones alineadas a la derecha */
.trip-table td:last-child { text-align: right; }

.action-group {
  display: flex;
  gap: .375rem;
  row-gap: .375rem;
  justify-content: flex-end;
  flex-wrap: wrap;
  align-items: center;
}

.action-group .btn {
  font-size: .75rem;
  padding: .35rem .7rem;
  white-space: nowrap;
}

/* ---- File preview ---- */

.file-preview-list { list-style: none; }

.file-preview-item {
  border: 1px solid var(--admin-color-border);
  border-radius: var(--admin-radius);
  margin-bottom: .375rem;
  overflow: hidden;
}

.file-preview-item__header {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .55rem 1rem;
  background: var(--admin-color-bg);
  cursor: pointer;
  font-family: ui-monospace, monospace;
  font-size: .8rem;
  color: var(--admin-color-muted);
  transition: background .15s;
}

.file-preview-item__header:hover { background: var(--admin-color-border); }

.file-preview-item__content {
  display: none;
  padding: 1rem;
  background: #0f172a;
  color: #e2e8f0;
  font-family: ui-monospace, monospace;
  font-size: .8rem;
  white-space: pre;
  overflow-x: auto;
}

.file-preview-item--open .file-preview-item__content { display: block; }

/* ---- Alerts ---- */

.alert {
  padding: .875rem 1.125rem;
  border-radius: var(--admin-radius);
  margin-bottom: 1rem;
  border: 1px solid transparent;
  font-size: .875rem;
}

.alert--success { background: var(--admin-color-success-bg); color: #14532d; border-color: var(--admin-color-success-border); }
.alert--danger  { background: var(--admin-color-danger-bg);  color: #7f1d1d; border-color: var(--admin-color-danger-border); }
.alert--warning { background: var(--admin-color-warning-bg); color: #78350f; border-color: var(--admin-color-warning-border); }
.alert--info    { background: #eff6ff; color: #1e3a8a; border-color: #bfdbfe; }

.alert__title { font-weight: 700; margin-bottom: .4rem; }
.alert__files { list-style: none; margin-top: .5rem; font-family: ui-monospace, monospace; font-size: .8rem; }
.alert__files li::before { content: "✓ "; color: var(--admin-color-success); }

/* ---- Section toggles ---- */

.section-toggle {
  border: 1px solid var(--admin-color-border);
  border-radius: var(--admin-radius);
  margin-bottom: .5rem;
  overflow: hidden;
  transition: box-shadow .15s;
}

.section-toggle--open {
  box-shadow: 0 0 0 2px var(--admin-color-primary-subtle);
  border-color: var(--admin-color-primary);
}

.section-toggle__header {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1rem;
  background: var(--admin-color-bg);
  cursor: pointer;
  font-weight: 500;
  font-size: .875rem;
  user-select: none;
  transition: background .15s;
}

/* Ocultar el checkbox nativo — la apertura se gestiona por JS */
.section-toggle__header input[type="checkbox"] { display: none; }

/* Chevron con pseudo-elemento */
.section-toggle__header::after {
  content: '›';
  font-size: 1.1rem;
  line-height: 1;
  color: var(--admin-color-subtle);
  margin-left: auto;
  transition: transform .2s ease;
  flex-shrink: 0;
}

.section-toggle--open > .section-toggle__header {
  background: var(--admin-color-primary-light);
  color: var(--admin-color-primary);
}

.section-toggle--open > .section-toggle__header::after {
  transform: rotate(90deg);
  color: var(--admin-color-primary);
}

.section-toggle__header:hover { background: var(--admin-color-border); }
.section-toggle--open > .section-toggle__header:hover { background: var(--admin-color-primary-subtle); }

.section-toggle__body {
  display: none;
  padding: 1.25rem;
  border-top: 1px solid var(--admin-color-border);
}

.section-toggle--open .section-toggle__body { display: block; }

/* ---- Pantalla de edición — cabecera del viaje ---- */

.edit-header {
  display: flex;
  align-items: center;
  gap: .875rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--admin-color-border);
  flex-wrap: wrap;
}

.edit-header__title {
  font-size: 1.1rem;
  font-weight: 700;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: -.015em;
}

/* ---- Spinner ---- */

.spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Draft banner ---- */

.draft-banner {
  background: var(--admin-color-warning-bg);
  border: 1px solid var(--admin-color-warning-border);
  border-left: 3px solid var(--admin-color-warning);
  border-radius: var(--admin-radius);
  padding: .875rem 1.125rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: .875rem;
}

.draft-banner__actions { display: flex; gap: .5rem; flex-shrink: 0; }

/* ---- Entry cards ---- */

.entry-card {
  border: 1px solid var(--admin-color-border);
  border-radius: var(--admin-radius-sm);
  margin-bottom: .3rem;
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}

.entry-card__header {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .55rem .875rem;
  background: var(--admin-color-bg);
  cursor: pointer;
  user-select: none;
  transition: background .12s;
}

.entry-card__header:hover { background: var(--admin-color-border); }

.entry-card--open {
  border-color: var(--admin-color-primary);
  box-shadow: 0 0 0 1px var(--admin-color-primary-subtle);
}

.entry-card--open > .entry-card__header {
  background: var(--admin-color-primary-light);
}

.entry-card__num {
  font-size: .7rem;
  font-weight: 700;
  color: var(--admin-color-subtle);
  min-width: 1.5rem;
  text-align: center;
  background: var(--admin-color-border);
  border-radius: 99px;
  padding: .1rem .3rem;
}

.entry-card--open > .entry-card__header .entry-card__num {
  background: var(--admin-color-primary-subtle);
  color: var(--admin-color-primary);
}

.entry-card__summary {
  flex: 1;
  font-size: .875rem;
  font-weight: 500;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--admin-color-text);
}

.entry-card__chevron {
  font-size: .7rem;
  color: var(--admin-color-subtle);
  transition: transform .2s ease;
  flex-shrink: 0;
}

.entry-card--open > .entry-card__header .entry-card__chevron {
  transform: rotate(90deg);
  color: var(--admin-color-primary);
}

.entry-card__body {
  display: none;
  padding: .875rem 1rem;
  border-top: 1px solid var(--admin-color-border);
  background: var(--admin-color-surface);
}

.entry-card--open > .entry-card__body { display: block; }

.entry-card__delete {
  flex-shrink: 0;
  padding: .15rem .45rem !important;
  font-size: .72rem !important;
  border-radius: var(--admin-radius-sm) !important;
  line-height: 1.4;
}

/* ---- Section toolbar ---- */

.section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: .875rem;
  padding-top: .75rem;
  border-top: 1px solid var(--admin-color-border);
  gap: .5rem;
}

.section-empty {
  text-align: center;
  color: var(--admin-color-muted);
  font-size: .825rem;
  padding: 1rem .75rem;
  border: 1px dashed var(--admin-color-border);
  border-radius: var(--admin-radius-sm);
  margin-bottom: .25rem;
  background: var(--admin-color-bg);
}

/* ---- Pantalla de edición: banner publicar ---- */

#edit-publish-section {
  border-left: 3px solid var(--admin-color-warning);
}

/* ---- Utilidades ---- */

.hidden { display: none !important }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 2px solid var(--admin-color-border);
}

.card-title {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--admin-color-text);
  letter-spacing: -.015em;
}

.trip-filter {
  display: flex;
  gap: .375rem;
  margin-bottom: 1rem;
}

.trip-filter__btn {
  padding: .25rem .75rem;
  border: 1px solid var(--admin-color-border);
  border-radius: 999px;
  background: var(--admin-color-bg);
  color: var(--admin-color-text-muted);
  font-size: .8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}

.trip-filter__btn:hover {
  border-color: var(--admin-color-primary);
  color: var(--admin-color-primary);
}

.trip-filter__btn--active {
  background: var(--admin-color-primary);
  border-color: var(--admin-color-primary);
  color: #fff;
}

.text-muted-sm {
  color: var(--admin-color-muted);
  font-size: .875rem;
}

.section-intro {
  color: var(--admin-color-muted);
  font-size: .9rem;
  margin-bottom: 1.25rem;
}

.step-preview-text {
  margin-bottom: 1rem;
  font-size: .9rem;
  color: var(--admin-color-muted);
}

.alert__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.alert__sub {
  font-size: .875rem;
  margin-top: .25rem;
}

.alert__detail {
  margin-top: .5rem;
  font-size: .9rem;
}

.alert__footer {
  display: flex;
  gap: .75rem;
  margin-top: 1rem;
}

.alert--mb   { margin-bottom: 1rem }
.alert--mb-lg { margin-bottom: 1.25rem }

.mb-2 { margin-bottom: .5rem }
.mb-4 { margin-bottom: 1rem }
.mt-2 { margin-top: .5rem }
.mt-3 { margin-top: .75rem }

.stage-note {
  font-size: .8rem;
  color: var(--admin-color-muted);
  margin-top: .25rem;
}

.btn-back { margin-bottom: 1rem }

/* El span de "verificando slug" */
#slug-checking { font-size: .75rem }

/* La celda de secciones en la tabla */
.td-sections { font-size: .8rem; color: var(--admin-color-muted) }

/* La celda de acciones en la tabla */
.td-actions { vertical-align: middle; }

/* El botón-enlace del título de viaje en la tabla */
.trip-link-btn {
  background: none;
  border: none;
  color: var(--admin-color-primary);
  cursor: pointer;
  font-weight: 500;
  font-size: .9rem;
  padding: 0;
  text-decoration: underline;
}

/* Estado vacío de la tabla */
#trip-table-empty {
  color: var(--admin-color-muted);
  font-size: .9rem;
  padding: .5rem 0;
}

/* Alertas globales de edición con margen */
#edit-global-success,
#edit-global-error    { margin-bottom: 1rem }
#edit-publish-section { margin-bottom: 1.25rem }

/* ---- Equipment items ---- */

.equipment-items {
  margin: 1rem 0;
}

.equipment-items label {
  display: block;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--admin-color-text);
  margin-bottom: .75rem;
  letter-spacing: .005em;
}

.equipment-item {
  border: 1px solid var(--admin-color-border);
  border-radius: var(--admin-radius-sm);
  padding: .75rem;
  margin-bottom: .5rem;
  background: var(--admin-color-bg);
}

.equipment-item__row {
  gap: .75rem;
}

.equipment-item__row .form-group {
  margin-bottom: 0;
}

.equipment-item__rec {
  display: flex;
  gap: .5rem;
  align-items: flex-end;
}

.equipment-item__rec select {
  flex: 1;
}

.equipment-item__delete {
  flex-shrink: 0;
  padding: .3rem .5rem !important;
  font-size: .75rem !important;
  margin-top: 1.25rem;
}

.equipment-items__add {
  display: block;
  width: 100%;
  margin-top: .5rem;
}

/* ---- Modal/Dialog ---- */

/* Native HTML5 <dialog> styling */
dialog.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: none;
  border-radius: var(--admin-radius-lg);
  box-shadow: var(--admin-modal-shadow);
  max-width: 600px;
  width: 90vw;
  max-height: 90vh;
  padding: 0;
  background: var(--admin-color-surface);
  margin: 0;
  overflow: hidden;
  visibility: hidden;
  opacity: 0;
}

dialog.modal::backdrop {
  background-color: var(--admin-modal-backdrop);
  opacity: 1;
}

dialog.modal[open] {
  display: flex !important;
  flex-direction: column;
  animation: modal-slide-in 0.2s ease-out;
  visibility: visible;
  opacity: 1;
  z-index: 1000;
}

@keyframes modal-slide-in {
  from {
    opacity: 0;
    transform: translate(-50%, -48%);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

/* Modal size variants */
dialog.modal--sm {
  max-width: 400px;
}

dialog.modal--md {
  max-width: 600px;
}

dialog.modal--lg {
  max-width: 800px;
}

.modal__header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--admin-color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-shrink: 0;
}

.modal__header h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--admin-color-text);
  margin: 0;
}

.modal__close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--admin-color-muted);
  padding: 0;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}

.modal__close:hover {
  color: var(--admin-color-text);
}

.modal__body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal__footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--admin-color-border);
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  flex-shrink: 0;
}

/* Modal form elements */
fieldset {
  border: none;
  padding: 0;
  margin: 0 0 1.5rem 0;
}

legend {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--admin-color-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
  padding: 0;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-row.form-row--full {
  grid-template-columns: 1fr;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--admin-color-text);
  margin-bottom: 0.375rem;
}

/* ---- Tabs ---- */

.section-tabs {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.section-tabs__nav {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--admin-color-border);
  background: var(--admin-color-surface);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.section-tabs__nav::-webkit-scrollbar {
  height: 4px;
}

.section-tabs__nav::-webkit-scrollbar-track {
  background: transparent;
}

.section-tabs__nav::-webkit-scrollbar-thumb {
  background: var(--admin-color-border-strong);
  border-radius: 2px;
}

.section-tabs__tab {
  background: none;
  border: none;
  padding: 1rem 1.25rem;
  cursor: pointer;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--admin-color-muted);
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-tabs__tab:hover {
  color: var(--admin-color-text);
  background: var(--admin-color-bg);
}

.section-tabs__tab.tab--active {
  color: var(--admin-color-primary);
  border-bottom-color: var(--admin-color-primary);
  background: var(--admin-color-primary-light);
}

.section-tabs__icon {
  font-size: 1rem;
}

.section-tabs__label {
  font-size: inherit;
}

.section-tabs__badge {
  display: inline-block;
  background: var(--admin-color-primary);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  min-width: 1.25rem;
  text-align: center;
  margin-left: 0.25rem;
}

.section-tabs__panels {
  display: flex;
  flex-direction: column;
}

.section-tabs__panel {
  display: none;
  padding: 1.5rem;
}

.section-tabs__panel--active {
  display: block;
}

/* ---- Save Indicator ---- */

.save-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--admin-radius);
  transition: opacity 0.2s, visibility 0.2s;
  white-space: nowrap;
}

.save-indicator--inline {
  position: relative;
}

.save-indicator--fixed {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  background: var(--admin-color-surface);
  box-shadow: var(--admin-modal-shadow);
}

.save-indicator[data-status="idle"] {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.save-indicator[data-status="saving"] {
  background: #f1f5f9;
  color: #64748b;
}

.save-indicator[data-status="saved"] {
  background: #dcfce7;
  color: #15803d;
}

.save-indicator[data-status="error"] {
  background: #fee2e2;
  color: #dc2626;
}

.save-indicator__icon {
  font-size: 1.125rem;
  font-weight: 700;
}

.save-indicator__text {
  font-weight: 500;
}

.save-indicator__timestamp {
  font-size: 0.75rem;
  opacity: 0.7;
  margin-left: 0.25rem;
}

/* ---- Stage Table ---- */

.stage-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--admin-color-surface);
  border: 1px solid var(--admin-color-border);
  border-radius: var(--admin-radius);
  overflow: hidden;
}

.stage-table thead {
  background: var(--admin-color-bg);
  border-bottom: 1px solid var(--admin-color-border);
}

.stage-table th {
  padding: 0.875rem 1rem;
  text-align: left;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--admin-color-text);
  text-transform: uppercase;
  letter-spacing: 0.005em;
}

.stage-table tbody {
  display: table-row-group;
}

.stage-table__row {
  border-bottom: 1px solid var(--admin-color-border);
  cursor: pointer;
  transition: background-color 0.15s;
}

.stage-table__row:hover {
  background: var(--admin-color-primary-light);
}

.stage-table__row:last-child {
  border-bottom: none;
}

.stage-table__row--dragging {
  opacity: 0.5;
  background: var(--admin-color-border);
}

.stage-table td {
  padding: 1rem;
  font-size: 0.9375rem;
  color: var(--admin-color-text);
  vertical-align: middle;
}

.stage-table__drag-handle {
  cursor: grab;
  color: var(--admin-color-muted);
  font-size: 1.125rem;
  padding: 0;
  background: none;
  border: none;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stage-table__drag-handle:active {
  cursor: grabbing;
}

.stage-table__drag-handle:hover {
  color: var(--admin-color-text);
}

.stage-table__empty {
  padding: 2rem;
  text-align: center;
  color: var(--admin-color-muted);
  font-size: 0.9375rem;
}

/* ---- Responsive ---- */

@media (max-width: 760px) {
  .trip-table th:nth-child(4),
  .trip-table td:nth-child(4) { display: none; }
}

@media (max-width: 640px) {
  .admin-main   { margin: 1rem auto; padding: 0 .875rem; }
  .admin-card   { padding: 1.25rem; }
  .form-row     { grid-template-columns: 1fr; }
  .btn-actions  { flex-direction: column; }
  .section-toolbar { flex-direction: column; align-items: stretch; }
  .equipment-item__rec { flex-direction: column; align-items: stretch; gap: .5rem; }
  .equipment-item__delete { margin-top: 0; width: 100%; }
  .trip-table th:nth-child(3),
  .trip-table td:nth-child(3),
  .trip-table th:nth-child(4),
  .trip-table td:nth-child(4) { display: none; }
  .action-group { justify-content: flex-start; }
  .form-feedback { font-size: 0.75rem; }
  .slug-preview { gap: 0.5rem; }

  /* Feature 019 - US7: Gallery grid mobile adjustments */
  .gallery-grid { grid-template-columns: 1fr; }
  .gallery-grid-item { flex-direction: column; gap: 0.5rem; }
  .gallery-grid-item__image-wrapper { width: 100%; height: 150px; }
  .gallery-grid-item__info { font-size: 0.75rem; }
  .gallery-grid-item__delete { width: 100%; }
}
