/* ====================================================================
   Admin canvas · Kung Fu Neuquén
   ==================================================================== */

/* ── Barra flotante ───────────────────────────────────────────────── */

#adminBar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 48px;
  background: rgba(10,10,10,.96);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 9990;
  color: #fff;
  font-family: 'Inter', system-ui, sans-serif;
  box-shadow: 0 2px 16px rgba(0,0,0,.5);
  gap: 12px;
}

.adm-bar__badge {
  font-size: 11px;
  letter-spacing: .14em;
  font-weight: 700;
  color: #d4af37;
}

.adm-bar__right { display: flex; gap: 8px; align-items: center; }

.adm-bar__btn {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  border: 1.5px solid rgba(255,255,255,.3);
  background: transparent;
  color: #fff;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  font-family: inherit;
}
.adm-bar__btn:hover { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.6); }
.adm-bar__btn--primary { background: #c9302c; border-color: #c9302c; }
.adm-bar__btn--primary:hover { background: #a52623; border-color: #a52623; }
.adm-bar__btn--ghost { border-color: rgba(255,255,255,.2); }
.adm-bar__btn--ghost:hover { background: rgba(255,255,255,.1); }
.adm-bar__btn:disabled { opacity: .5; pointer-events: none; }

/* ── Overlays sobre slots de imagen ────────────────────────────────── */

.adm-img-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10,10,10,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .2s;
  cursor: pointer;
  z-index: 20;
}
.adm-img-overlay span {
  background: rgba(10,10,10,.85);
  color: #fff;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Inter', system-ui, sans-serif;
  border: 1px solid rgba(255,255,255,.3);
  pointer-events: none;
}
body.adm-active :hover > .adm-img-overlay { opacity: 1; }

/* ── Picker popup ──────────────────────────────────────────────────── */

#admPicker {
  position: absolute;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,.28);
  padding: 14px;
  z-index: 9999;
  min-width: 210px;
  font-family: 'Inter', system-ui, sans-serif;
  border: 1px solid #e6dfcb;
}
.adm-picker__title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #c9302c;
  margin-bottom: 10px;
}
.adm-picker__btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e6dfcb;
  border-radius: 8px;
  background: #fbf8f1;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #0a0a0a;
  text-align: left;
  margin-bottom: 6px;
  transition: all .15s;
  font-family: inherit;
}
.adm-picker__btn:last-child { margin-bottom: 0; }
.adm-picker__btn:hover { background: #0a0a0a; color: #fff; border-color: #0a0a0a; }
.adm-picker__btn--danger { color: #c9302c; }
.adm-picker__btn--danger:hover { background: #c9302c; color: #fff; border-color: #c9302c; }

/* ── Botón borrar en galería (página) ──────────────────────────────── */

.gallery__item { position: relative; overflow: hidden; }
.gal-del-btn {
  position: absolute;
  top: 8px; right: 8px;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(201,48,44,.9);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity .2s;
  z-index: 30;
}
.gallery__item:hover .gal-del-btn { opacity: 1; }

.gal-page-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: #6b6b66;
  font-size: 14px;
  font-family: 'Inter', system-ui, sans-serif;
  border: 2px dashed #e6dfcb;
  border-radius: 12px;
}

/* ── Modal galería ─────────────────────────────────────────────────── */

#galModal {
  position: fixed;
  inset: 0;
  z-index: 9995;
  display: none;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', system-ui, sans-serif;
}
#galModal.is-open { display: flex; }

.gal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10,10,10,.82);
  backdrop-filter: blur(6px);
}
.gal-sheet {
  position: relative;
  width: min(920px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  background: #fbf8f1;
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: galPop .3s cubic-bezier(.2,.8,.2,1);
}
@keyframes galPop { from { opacity:0; transform:translateY(12px) scale(.97) } to { opacity:1; transform:none } }

.gal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid #e6dfcb;
  flex-shrink: 0;
}
.gal-head h2 {
  margin: 0;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 26px;
  letter-spacing: .03em;
}
.gal-close {
  width: 34px; height: 34px;
  border: none; border-radius: 50%;
  background: #0a0a0a; color: #fff;
  font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform .2s;
}
.gal-close:hover { transform: rotate(90deg); }

.gal-tabs {
  display: flex;
  border-bottom: 1px solid #e6dfcb;
  padding: 0 24px;
  flex-shrink: 0;
  gap: 0;
}
.gal-tab {
  padding: 11px 16px;
  border: none;
  background: none;
  font-size: 13px;
  font-weight: 500;
  color: #6b6b66;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all .15s;
  font-family: inherit;
}
.gal-tab:hover { color: #0a0a0a; }
.gal-tab.is-active { color: #c9302c; border-bottom-color: #c9302c; }

.gal-body { flex: 1; overflow-y: auto; padding: 22px 24px; }
.gal-pane { display: none; }
.gal-pane.is-active { display: block; }

/* Tab: Fotos actuales */
.gal-cur-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}
.gal-cur-item {
  position: relative;
  aspect-ratio: 4/3;
  border-radius: 8px;
  overflow: hidden;
  background: #0a0a0a;
}
.gal-cur-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gal-cur-del {
  position: absolute;
  top: 5px; right: 5px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: rgba(201,48,44,.9);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity .15s;
}
.gal-cur-item:hover .gal-cur-del { opacity: 1; }
.gal-cur-empty {
  text-align: center;
  color: #6b6b66;
  padding: 48px 20px;
  font-size: 14px;
}

/* Tab: Agregar */
.gal-drop {
  border: 2px dashed #d4af37;
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: rgba(212,175,55,.04);
}
.gal-drop:hover, .gal-drop.is-over { background: rgba(212,175,55,.13); border-color: #c9302c; }
.gal-drop__icon { font-size: 38px; margin-bottom: 10px; }
.gal-drop__text { font-size: 14px; color: #6b6b66; }

.gal-sep { text-align: center; color: #b0a98e; font-size: 12px; margin: 18px 0; }

.gal-url-row { display: flex; gap: 8px; }
.gal-url-row input, .gal-scrape-row input {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid #e6dfcb;
  border-radius: 8px;
  font-size: 13px;
  color: #0a0a0a;
  background: #fff;
  font-family: inherit;
}
.gal-url-row input:focus, .gal-scrape-row input:focus { outline: none; border-color: #c9302c; }
.gal-add-status { margin-top: 12px; font-size: 13px; color: #1a7f37; min-height: 20px; }

/* Tab: Scraping */
.gal-scrape-row { display: flex; gap: 8px; margin-bottom: 10px; }
.gal-scrape-hint { font-size: 12px; color: #6b6b66; margin-bottom: 16px; line-height: 1.5; }
.gal-scrape-info { font-size: 13px; color: #6b6b66; margin-bottom: 12px; }
.gal-scrape-loading, .gal-scrape-empty { text-align: center; color: #6b6b66; padding: 32px; font-size: 14px; }

.gal-scrape-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
  max-height: 340px;
  overflow-y: auto;
  padding-right: 4px;
}
.gal-scrape-item {
  position: relative;
  display: block;
  aspect-ratio: 4/3;
  border-radius: 6px;
  overflow: hidden;
  background: #111;
  cursor: pointer;
}
.gal-scrape-item input { position: absolute; opacity: 0; width: 0; height: 0; }
.gal-scrape-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity .2s; }
.gal-scrape-check {
  position: absolute;
  top: 5px; right: 5px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(26,127,55,.95);
  color: #fff;
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity .15s;
  pointer-events: none;
}
.gal-scrape-item:has(input:checked) { outline: 3px solid #1a7f37; outline-offset: -2px; }
.gal-scrape-item:has(input:checked) .gal-scrape-check { opacity: 1; }
.gal-scrape-item:has(input:checked) img { opacity: .85; }

.gal-scrape-foot {
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #e6dfcb;
}
#galScrapeFoot { display: none; }
#galScrapeCount { font-size: 13px; color: #6b6b66; }

/* ── Edición de texto inline ────────────────────────────────────────── */

body.adm-text-mode [data-edit-key] { cursor: text; }
.adm-editable {
  outline: 2px dashed #c9302c;
  outline-offset: 4px;
  background: rgba(212,175,55,.08);
  border-radius: 3px;
  transition: all .15s;
}
.adm-editable:focus { outline-style: solid; background: rgba(212,175,55,.18); }
.adm-editable--saving { outline-color: #d4af37 !important; }
.adm-editable--ok { outline-color: #1a7f37 !important; background: rgba(26,127,55,.12) !important; }
.adm-editable--err { outline-color: #c9302c !important; background: rgba(201,48,44,.18) !important; }

/* ── Edición de links (redes sociales) ─────────────────────────────── */

body.adm-active .adm-link-editable {
  position: relative;
  cursor: pointer;
}
body.adm-active .adm-link-editable::after {
  content: '🔗';
  position: absolute;
  top: -10px;
  right: -10px;
  font-size: 12px;
  background: #d4af37;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
  line-height: 1;
}
body.adm-active .adm-link-editable:hover::after { opacity: 1; }
body.adm-active .adm-link-editable:hover {
  outline: 2px solid #d4af37;
  outline-offset: 3px;
  border-radius: 4px;
}

/* ── Responsive ─────────────────────────────────────────────────────── */

@media (max-width: 600px) {
  .adm-bar__badge { display: none; }
  #adminBar { padding: 0 10px; }
  .adm-bar__btn { padding: 5px 10px; font-size: 11px; }
  .gal-sheet { width: calc(100vw - 16px); max-height: calc(100vh - 16px); border-radius: 12px; }
  .gal-head, .gal-tabs, .gal-body { padding-left: 14px; padding-right: 14px; }
  .gal-head h2 { font-size: 20px; }
  .gal-scrape-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
}
