/* ════════════════════════════════════════════════════════════════
   Relax Store · Editor stylesheet
   ──────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: #f4f6f3;
  color: #1a2e1c;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

:root {
  --green-dark:  #1a4a1f;
  --green-mid:   #2e7d32;
  --green-light: #4caf50;
  --green-pale:  #e8f5e9;
  --green-xpale: #f1f8f1;
  --gold:        #c8860a;
  --text-dark:   #1a2e1c;
  --text-mid:    #4a5e4c;
  --text-light:  #7a8f7c;
  --border:      #dce8dc;
  --danger:      #d84545;
  --shadow-sm:   0 2px 8px rgba(30,80,30,.08);
  --shadow-md:   0 6px 20px rgba(30,80,30,.12);
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}
button { cursor: pointer; }

/* ─── LOGIN ─────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
  background:
    radial-gradient(circle at 20% 30%, rgba(76,175,80,.08), transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(200,134,10,.06), transparent 50%),
    #f4f6f3;
}
.login-card {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(26,74,31,.14);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
}
.login-brand { text-align: center; margin-bottom: 2rem; }
.login-logo  { font-size: 3rem; margin-bottom: .5rem; }
.login-brand h1 {
  font-size: 1.35rem; font-weight: 800;
  color: var(--green-dark);
}
.login-brand p {
  font-size: .85rem; color: var(--text-light);
  margin-top: .25rem;
}
.login-card form { display: flex; flex-direction: column; gap: .75rem; }
.login-card label {
  font-size: .78rem; font-weight: 700;
  color: var(--text-mid); letter-spacing: .04em;
  text-transform: uppercase;
  margin-top: .5rem;
}
.login-card input {
  background: #fafcfa;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: .75rem 1rem;
  transition: border-color .2s, background .2s;
}
.login-card input:focus {
  outline: none;
  border-color: var(--green-mid);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(46,125,50,.1);
}
.login-hint {
  font-size: .75rem; color: var(--text-light);
  text-align: center;
  margin-top: 1.25rem;
}
.login-hint code {
  background: #f0f4f0;
  padding: .1rem .35rem;
  border-radius: 4px;
  font-size: .85em;
}
.alert {
  padding: .75rem 1rem;
  border-radius: 10px;
  font-size: .87rem;
  margin-bottom: 1rem;
}
.alert-err {
  background: #ffebee;
  border-left: 4px solid var(--danger);
  color: #b71c1c;
}

/* ─── EDITOR ────────────────────────────────────────────────── */
#editor-app { padding-bottom: 6rem; }

.editor-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  position: sticky; top: 0; z-index: 90;
  flex-wrap: wrap;
}
.editor-header-left { display: flex; align-items: center; gap: .75rem; }
.editor-logo { font-size: 1.8rem; }
.editor-header-left strong {
  font-size: 1rem; color: var(--green-dark);
  display: block;
}
.editor-subtitle {
  display: block;
  font-size: .75rem; color: var(--text-light);
}
.editor-header-right { display: flex; gap: .5rem; }

/* Botones reutilizables */
.btn-primary, .btn-ghost {
  font-weight: 700;
  font-size: .85rem;
  padding: .55rem 1.1rem;
  border-radius: 50px;
  border: 1.5px solid transparent;
  text-decoration: none;
  display: inline-flex; align-items: center; gap: .35rem;
  transition: all .2s;
  white-space: nowrap;
}
.btn-primary {
  background: var(--green-dark);
  color: #fff;
  box-shadow: 0 2px 10px rgba(26,74,31,.25);
}
.btn-primary:hover {
  background: var(--green-mid);
  transform: translateY(-1px);
}
.btn-primary:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}
.btn-ghost {
  background: transparent;
  color: var(--text-mid);
  border-color: var(--border);
}
.btn-ghost:hover {
  background: var(--green-xpale);
  color: var(--green-dark);
  border-color: var(--green-mid);
}
.btn-logout:hover {
  background: #ffebee;
  color: #b71c1c;
  border-color: #f48fb1;
}
.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1.5px solid #f4cdcd;
  font-weight: 700;
  font-size: .8rem;
  padding: .4rem .85rem;
  border-radius: 8px;
}
.btn-danger:hover {
  background: #ffebee;
  border-color: var(--danger);
}

/* Tabs */
.editor-tabs {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 1rem;
  display: flex;
  gap: .25rem;
  overflow-x: auto;
  position: sticky; top: 73px; z-index: 89;
  -webkit-overflow-scrolling: touch;
}
.editor-tabs .tab {
  background: transparent;
  border: none;
  padding: 1rem 1.25rem;
  font-weight: 700;
  font-size: .85rem;
  color: var(--text-light);
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  transition: color .2s, border-color .2s;
}
.editor-tabs .tab:hover {
  color: var(--green-dark);
}
.editor-tabs .tab.active {
  color: var(--green-dark);
  border-bottom-color: var(--green-mid);
}

.editor-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.75rem 1.25rem;
}
.tab-panel {
  display: none;
  animation: fadeIn .25s ease;
}
.tab-panel.active { display: block; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* Field group */
.field-group {
  background: #fff;
  border-radius: 14px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.field-group h2 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--green-dark);
  margin-bottom: .35rem;
}
.field-group .help {
  font-size: .82rem;
  color: var(--text-light);
  margin-bottom: 1.25rem;
  line-height: 1.5;
}
.field { margin-bottom: 1rem; }
.field:last-child { margin-bottom: 0; }
.field label {
  display: block;
  font-size: .77rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--text-mid);
  margin-bottom: .35rem;
}
.field input[type="text"],
.field input[type="url"],
.field input[type="tel"],
.field input[type="email"],
.field input[type="date"],
.field select,
.field textarea {
  width: 100%;
  background: #fafcfa;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: .65rem .85rem;
  font-size: .9rem;
  color: var(--text-dark);
  transition: border-color .2s, background .2s;
}
.field textarea {
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--green-mid);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(46,125,50,.08);
}
.field-hint {
  font-size: .75rem;
  color: var(--text-light);
  margin-top: .35rem;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 600px) {
  .field-row { grid-template-columns: 1fr; }
}

/* Lists (viajes, tiendas, stats) */
.list-item {
  background: #fafcfa;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: .75rem;
  position: relative;
}
.list-item-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .75rem;
}
.list-item-num {
  background: var(--green-dark);
  color: #fff;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: .85rem;
}
.add-item-btn {
  background: transparent;
  border: 2px dashed var(--green-mid);
  color: var(--green-mid);
  border-radius: 12px;
  padding: .85rem 1rem;
  width: 100%;
  font-weight: 700;
  font-size: .87rem;
  margin-top: .5rem;
  transition: background .2s, border-style .2s;
}
.add-item-btn:hover {
  background: var(--green-xpale);
  border-style: solid;
}

/* Image slots */
.image-slot {
  background: #fff;
  border-radius: 14px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.image-slot h3 {
  font-size: 1rem;
  font-weight: 800;
  color: var(--green-dark);
  margin-bottom: .25rem;
}
.image-slot .help {
  font-size: .8rem;
  color: var(--text-light);
  margin-bottom: 1rem;
  line-height: 1.5;
}
.image-preview {
  display: flex; align-items: center; gap: 1rem;
  flex-wrap: wrap;
  background: var(--green-xpale);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: .75rem;
}
.image-preview img {
  max-width: 140px;
  max-height: 100px;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
  padding: .25rem;
  box-shadow: var(--shadow-sm);
}
.image-preview-empty {
  background: var(--green-xpale);
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 2rem 1rem;
  text-align: center;
  font-size: .85rem;
  color: var(--text-light);
  margin-bottom: .75rem;
}
.upload-row {
  display: flex; gap: .5rem;
  flex-wrap: wrap;
  align-items: center;
}
.upload-btn {
  background: var(--green-dark);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: .6rem 1.1rem;
  font-weight: 700;
  font-size: .85rem;
}
.upload-btn:hover { background: var(--green-mid); }
.upload-btn input { display: none; }

/* Galería */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: .75rem;
  margin-top: 1rem;
}
.gallery-tile {
  position: relative;
  aspect-ratio: 1;
  background: #fafcfa;
  border-radius: 10px;
  overflow: hidden;
  border: 1.5px solid var(--border);
}
.gallery-tile img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.gallery-tile button {
  position: absolute;
  top: 6px; right: 6px;
  background: rgba(216,69,69,.95);
  color: #fff;
  border: none;
  width: 28px; height: 28px;
  border-radius: 50%;
  font-size: 1rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity .2s;
}
.gallery-tile:hover button { opacity: 1; }

/* Save bar */
.save-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--green-dark);
  color: #fff;
  padding: .85rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  box-shadow: 0 -4px 20px rgba(0,0,0,.15);
  z-index: 100;
  transform: translateY(100%);
  transition: transform .25s ease;
}
.save-bar:not(.hidden) { transform: translateY(0); }
#save-status { font-weight: 700; font-size: .9rem; }
.save-bar-actions { display: flex; gap: .5rem; }
.save-bar .btn-ghost {
  color: #fff;
  border-color: rgba(255,255,255,.3);
}
.save-bar .btn-ghost:hover {
  background: rgba(255,255,255,.1);
  border-color: rgba(255,255,255,.6);
  color: #fff;
}
.save-bar .btn-primary {
  background: var(--gold);
  color: #fff;
}
.save-bar .btn-primary:hover {
  background: #b07509;
}

.hidden { display: none !important; }

/* Toast */
.toast {
  position: fixed;
  bottom: 80px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--green-dark);
  color: #fff;
  padding: .75rem 1.25rem;
  border-radius: 50px;
  font-size: .9rem;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 101;
  max-width: 90vw;
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.error { background: var(--danger); }

/* Responsive */
@media (max-width: 600px) {
  .editor-header { padding: .75rem 1rem; }
  .editor-header-left strong { font-size: .95rem; }
  .editor-tabs { top: 67px; }
  .editor-tabs .tab { padding: .85rem 1rem; font-size: .8rem; }
  .editor-main { padding: 1.25rem 1rem; }
  .field-group, .image-slot { padding: 1.25rem; }
}

/* Loading state */
.loading {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-light);
  font-size: .9rem;
}
.spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2.5px solid var(--green-pale);
  border-top-color: var(--green-mid);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin-right: .5rem;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }
