/* ============================================================
   ADMIN PANEL · Gestión de la Galería de Eventos
   ============================================================ */

.admin-trigger-zone {
  position: fixed;
  bottom: 0; right: 0;
  width: 60px; height: 60px;
  z-index: 95;
  cursor: default;
}

.admin-shield {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 998;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.admin-shield.open { display: flex; }

.admin-login {
  background: #fff;
  width: 100%;
  max-width: 360px;
  padding: 36px 32px;
  border-radius: 16px;
  text-align: center;
}
.admin-login .ic {
  width: 56px; height: 56px;
  background: var(--r-red);
  border-radius: 50%;
  margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.admin-login h3 {
  font-family: var(--f-display);
  font-size: 20px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.admin-login p {
  color: var(--r-mute);
  font-size: 13px;
  margin-bottom: 22px;
}
.admin-login input {
  width: 100%;
  background: var(--r-cream);
  border: 1px solid var(--r-line);
  padding: 14px 16px;
  font: 500 15px var(--f-body);
  text-align: center;
  letter-spacing: 0.15em;
  outline: none;
  margin-bottom: 14px;
}
.admin-login input:focus { border-color: var(--r-red); background: #fff; }
.admin-login button {
  width: 100%;
  background: var(--r-ink);
  color: #fff;
  padding: 14px;
  font-family: var(--f-cond);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}
.admin-login button:hover { background: var(--r-red); }
.admin-login .err {
  color: var(--r-red);
  font-size: 12px;
  margin-top: 10px;
  display: none;
}
.admin-login.error .err { display: block; }
.admin-login .hint {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--r-line);
  font-size: 11px;
  color: var(--r-mute);
  text-align: left;
  line-height: 1.5;
}

.admin-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 100%;
  max-width: 480px;
  background: #fff;
  z-index: 999;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .3s ease;
  box-shadow: -20px 0 60px rgba(0,0,0,0.2);
}
.admin-panel.open { transform: none; }

.admin-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 24px;
  background: var(--r-ink);
  color: #fff;
  flex-shrink: 0;
}
.admin-head h2 {
  font-family: var(--f-display);
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex; align-items: center; gap: 10px;
}
.admin-head .dot {
  width: 8px; height: 8px;
  background: var(--r-red);
  border-radius: 50%;
}
.admin-head button {
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.1);
  color: #fff;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.admin-head button:hover { background: var(--r-red); }

.admin-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.admin-section-title {
  font-family: var(--f-cond);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 11px;
  color: var(--r-mute);
  font-weight: 700;
  margin-bottom: 12px;
  display: flex; justify-content: space-between; align-items: center;
}

.admin-add-btn {
  width: 100%;
  background: var(--r-red);
  color: #fff;
  padding: 14px;
  border-radius: 0;
  font-family: var(--f-cond);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  margin-bottom: 24px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .15s;
}
.admin-add-btn:hover { background: var(--r-ink); }

.admin-list {
  display: flex; flex-direction: column; gap: 8px;
  margin-bottom: 28px;
}
.admin-list:empty::before {
  content: "Aún no hay eventos. Pulsa “Agregar evento” para empezar.";
  display: block;
  text-align: center;
  padding: 40px 20px;
  border: 1px dashed var(--r-line);
  color: var(--r-mute);
  font-size: 13px;
  font-family: var(--f-cond);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.admin-item {
  display: flex;
  gap: 14px;
  padding: 10px;
  border: 1px solid var(--r-line);
  background: #fff;
  align-items: center;
}
.admin-item .thumb {
  width: 120px; height: 80px;
  object-fit: cover;
  background: var(--r-cream);
  flex-shrink: 0;
}
.admin-item .info { flex: 1; min-width: 0; }
.admin-item .ti {
  font-family: var(--f-display);
  font-size: 13px;
  text-transform: uppercase;
  line-height: 1.1;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.admin-item .cat {
  font-family: var(--f-cond);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 10px;
  color: var(--r-red);
  font-weight: 700;
}
.admin-item .actions { display: flex; gap: 4px; }
.admin-item .actions button {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--r-line);
  cursor: pointer;
  color: var(--r-ink);
  background: #fff;
  font-size: 13px;
}
.admin-item .actions button:hover { background: var(--r-cream); border-color: var(--r-ink); }
.admin-item .actions button.del:hover { background: var(--r-red); color: #fff; border-color: var(--r-red); }

.admin-form {
  background: var(--r-cream);
  padding: 20px;
  margin-bottom: 28px;
  display: none;
}
.admin-form.open { display: block; }
.admin-form .row { margin-bottom: 14px; }
.admin-form label {
  font-family: var(--f-cond);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 10px;
  font-weight: 700;
  color: var(--r-mute);
  display: block;
  margin-bottom: 6px;
}
.admin-form input[type="text"],
.admin-form select {
  width: 100%;
  background: #fff;
  border: 1px solid var(--r-line);
  padding: 10px 12px;
  font: 500 14px var(--f-body);
  outline: none;
}
.admin-form input:focus, .admin-form select:focus { border-color: var(--r-red); }

.admin-drop {
  border: 2px dashed var(--r-line);
  background: #fff;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  position: relative;
}
.admin-drop:hover, .admin-drop.dragover {
  border-color: var(--r-red);
  background: rgba(255,48,0,0.04);
}
.admin-drop input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.admin-drop .icn {
  width: 40px; height: 40px;
  margin: 0 auto 8px;
  color: var(--r-red);
}
.admin-drop p {
  font-family: var(--f-cond);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 11px;
  font-weight: 700;
  color: var(--r-mute);
  margin: 0;
}
.admin-drop .preview {
  max-width: 100%;
  max-height: 200px;
  margin: 0 auto 8px;
  display: block;
  object-fit: contain;
}
.admin-drop.has-image { background: #fff; padding: 12px; }
.admin-drop.has-image .placeholder { display: none; }
.admin-drop.cropping {
  padding: 0;
  border: 1px solid var(--r-line);
  background: #fff;
  cursor: default;
}
.admin-drop.cropping .placeholder { display: none; }
.admin-drop.cropping input[type="file"] { display: none; }

/* Image cropper */
.cropper-ui {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0;
}
.crop-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  background: #1a1a1a;
  overflow: hidden;
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.crop-frame:active { cursor: grabbing; }
.crop-frame img {
  position: absolute;
  top: 0; left: 0;
  max-width: none;
  pointer-events: none;
  will-change: transform;
}
.crop-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.4) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.4) 1px, transparent 1px);
  background-size: 33.333% 33.333%;
  background-position: 0 0;
  mix-blend-mode: difference;
}
.crop-frame::before {
  content: "Arrastra para reposicionar";
  position: absolute;
  top: 10px; left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.7);
  color: #fff;
  font-family: var(--f-cond);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 600;
  font-size: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  pointer-events: none;
  z-index: 2;
}

.crop-aspects {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 0 12px;
}
.crop-aspect {
  background: var(--r-cream);
  border: 1px solid var(--r-line);
  padding: 8px 6px;
  font-family: var(--f-cond);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 10px;
  font-weight: 700;
  color: var(--r-ink);
  cursor: pointer;
  transition: all .15s;
}
.crop-aspect:hover { border-color: var(--r-ink); }
.crop-aspect.active {
  background: var(--r-ink);
  color: #fff;
  border-color: var(--r-ink);
}

.crop-zoom {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
}
.crop-zoom .cz-lbl {
  font-family: var(--f-cond);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 10px;
  font-weight: 700;
  color: var(--r-mute);
  flex-shrink: 0;
}
.crop-zoom input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--r-line);
  border-radius: 999px;
  outline: none;
  padding: 0;
}
.crop-zoom input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  background: var(--r-red);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.crop-zoom input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px;
  background: var(--r-red);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.crop-actions {
  display: flex;
  gap: 6px;
  padding: 0 12px 12px;
}
.crop-actions button {
  flex: 1;
  padding: 11px;
  font-family: var(--f-cond);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  font-size: 11px;
  cursor: pointer;
  border: 0;
}
.crop-cancel {
  background: transparent;
  border: 1px solid var(--r-line) !important;
  color: var(--r-ink);
}
.crop-cancel:hover { background: var(--r-cream); }
.crop-confirm {
  background: var(--r-red);
  color: #fff;
}
.crop-confirm:hover { background: var(--r-ink); }

/* ============ MULTI-PHOTO MANAGER ============ */
.photos-manager {
  background: var(--r-cream);
  border: 1px solid var(--r-line);
  padding: 12px;
}
.photos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}
.photos-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 24px 16px;
  border: 1px dashed var(--r-line);
  background: #fff;
  font-family: var(--f-cond);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  font-weight: 600;
  color: var(--r-mute);
}
.photo-thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid var(--r-line);
  background: #1a1a1a;
}
.photo-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.photo-thumb .cover-badge {
  position: absolute;
  top: 4px; left: 4px;
  background: var(--r-red);
  color: #fff;
  padding: 2px 6px;
  font-family: var(--f-cond);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 9px;
  font-weight: 700;
  z-index: 2;
}
.photo-thumb .photo-actions {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  display: flex;
  background: rgba(0,0,0,0.7);
  opacity: 0;
  transition: opacity .15s;
}
.photo-thumb:hover .photo-actions,
.photo-thumb:focus-within .photo-actions { opacity: 1; }
.photo-thumb .photo-actions button {
  flex: 1;
  background: transparent;
  border: 0;
  color: #fff;
  padding: 6px 0;
  font-size: 14px;
  cursor: pointer;
  font-weight: 700;
}
.photo-thumb .photo-actions button:disabled { opacity: 0.3; cursor: default; }
.photo-thumb .photo-actions button.del:hover { background: var(--r-red); }
.photo-thumb .photo-actions button:hover:not(.del) { background: rgba(255,255,255,0.15); }

.photo-add-btn {
  width: 100%;
  background: var(--r-ink);
  color: #fff;
  padding: 10px;
  border: 0;
  font-family: var(--f-cond);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .15s;
}
.photo-add-btn:hover { background: var(--r-red); }

/* Thumb in events list with count */
.admin-item .thumb-wrap {
  position: relative;
  width: 120px; height: 80px;
  flex-shrink: 0;
}
.admin-item .thumb-wrap .thumb { width: 100%; height: 100%; }
.admin-item .thumb-count {
  position: absolute;
  top: -6px; right: -6px;
  background: var(--r-red);
  color: #fff;
  font-family: var(--f-cond);
  font-weight: 700;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 2px solid #fff;
}

/* ============ LIGHTBOX ============ */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 9999;
  display: none;
  flex-direction: column;
  padding: 20px;
}
.lightbox.open { display: flex; }
.lb-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 0;
}
.lb-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  animation: lbFade .25s ease;
}
@keyframes lbFade { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }

.lb-close, .lb-prev, .lb-next {
  position: absolute;
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: 0;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  font-size: 24px;
  font-family: var(--f-display);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s, transform .15s;
  z-index: 2;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.lb-close:hover, .lb-prev:hover, .lb-next:hover {
  background: var(--r-red);
  transform: scale(1.05);
}
.lb-close { top: 20px; right: 20px; font-size: 28px; }
.lb-prev { left: 20px; top: 50%; transform: translateY(-50%); font-size: 38px; line-height: 0.5; padding-bottom: 6px; }
.lb-next { right: 20px; top: 50%; transform: translateY(-50%); font-size: 38px; line-height: 0.5; padding-bottom: 6px; }
.lb-prev:hover { transform: translateY(-50%) scale(1.05); }
.lb-next:hover { transform: translateY(-50%) scale(1.05); }

.lb-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 16px 20px 0;
  gap: 20px;
  color: #fff;
  flex-shrink: 0;
}
.lb-info { display: flex; flex-direction: column; gap: 6px; }
.lb-badge {
  font-family: var(--f-cond);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 11px;
  font-weight: 700;
  color: var(--r-red);
}
.lb-badge:empty { display: none; }
.lb-title {
  font-family: var(--f-display);
  font-size: clamp(18px, 2.2vw, 24px);
  text-transform: uppercase;
  letter-spacing: -0.005em;
  line-height: 1.1;
}
.lb-counter {
  font-family: var(--f-cond);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.6);
  flex-shrink: 0;
}

@media (max-width: 700px) {
  .lb-close { top: 10px; right: 10px; width: 40px; height: 40px; font-size: 22px; }
  .lb-prev { left: 8px; width: 38px; height: 38px; font-size: 30px; }
  .lb-next { right: 8px; width: 38px; height: 38px; font-size: 30px; }
  .lb-footer { padding: 12px 8px 0; flex-direction: column; align-items: flex-start; gap: 8px; }
  .lb-title { font-size: 16px; }
}

/* Photo count badge on gallery items */
.gal-item .ph-ic.photo-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(0,0,0,0.75);
  color: #fff;
  padding: 4px 8px;
  font-weight: 700;
}
.gal-item.from-admin { cursor: pointer; }
.gal-item.from-admin:hover .ph { transform: scale(1.03); transition: transform .4s ease; }
.gal-item.from-admin .ph { transition: transform .4s ease; }

/* ============ CONTACT CHANNELS FORM ============ */
.contact-channels { padding: 0; background: transparent; }
.contact-help {
  font-size: 11px;
  font-family: var(--f-cond);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--r-mute);
  font-weight: 600;
  margin: 0 0 14px;
  line-height: 1.5;
}
.ch-block {
  background: #fff;
  border: 1px solid var(--r-line);
  margin-bottom: 8px;
  transition: opacity .2s ease;
}
.ch-block.disabled { opacity: 0.55; }
.ch-block.disabled .ch-fields { display: none; }

.ch-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
}
.ch-ic {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}
.ch-name {
  flex: 1;
  font-family: var(--f-display);
  text-transform: uppercase;
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--r-ink);
}

/* Toggle switch */
.ch-toggle {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
  flex-shrink: 0;
  cursor: pointer;
}
.ch-toggle input {
  opacity: 0;
  width: 0; height: 0;
  position: absolute;
}
.ch-slider {
  position: absolute;
  inset: 0;
  background: var(--r-line);
  border-radius: 999px;
  transition: background .2s;
}
.ch-slider::before {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.ch-toggle input:checked + .ch-slider { background: var(--r-red); }
.ch-toggle input:checked + .ch-slider::before { transform: translateX(16px); }

.ch-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 14px 14px;
}
.ch-fields .ch-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ch-field label {
  font-family: var(--f-cond);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 9px;
  font-weight: 700;
  color: var(--r-mute);
}
.ch-field input {
  background: var(--r-cream);
  border: 1px solid var(--r-line);
  padding: 8px 10px;
  font: 500 13px var(--f-body);
  outline: none;
  width: 100%;
}
.ch-field input:focus { border-color: var(--r-red); background: #fff; }
.ch-field:only-child { grid-column: 1 / -1; }
@media (max-width: 480px) {
  .ch-fields { grid-template-columns: 1fr; }
}

.admin-form .actions {
  display: flex; gap: 10px; margin-top: 16px;
}
.admin-form .actions button {
  flex: 1;
  padding: 12px;
  font-family: var(--f-cond);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}
.admin-form .actions .save {
  background: var(--r-ink); color: #fff;
}
.admin-form .actions .save:hover { background: var(--r-red); }
.admin-form .actions .cancel {
  background: transparent; border: 1px solid var(--r-line); color: var(--r-ink);
}

.admin-publish {
  background: var(--r-ink);
  color: #fff;
  padding: 20px;
  border-radius: 8px;
}
.admin-publish h4 {
  font-family: var(--f-display);
  text-transform: uppercase;
  font-size: 14px;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}
.admin-publish p {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  line-height: 1.5;
  margin-bottom: 14px;
}
.admin-publish .pbtns {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.admin-publish .pbtns button {
  flex: 1;
  min-width: 130px;
  background: var(--r-red);
  color: #fff;
  padding: 10px;
  font-family: var(--f-cond);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  font-size: 11px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.admin-publish .pbtns button:hover { background: #fff; color: var(--r-red); }
.admin-publish .pbtns button.import { background: transparent; border: 1px solid rgba(255,255,255,0.3); }

.admin-toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--r-ink);
  color: #fff;
  padding: 14px 22px;
  z-index: 1000;
  font-family: var(--f-cond);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
  font-size: 12px;
  transition: transform .3s ease;
  border-left: 4px solid var(--r-red);
  box-shadow: 0 12px 30px rgba(0,0,0,0.25);
  max-width: 90vw;
}
.admin-toast.show { transform: translateX(-50%) translateY(0); }

/* When admin is open, lock body */
body.admin-open { overflow: hidden; }

/* Editing badge on public gallery items (only in admin mode) */
.gal-item.from-admin .ph {
  background-color: transparent;
  background-image: none;
}
/* When an admin item has an inline background-image (set via style attr),
   the inline rule wins and the cover photo shows. */

@media (max-width: 600px) {
  .admin-panel { max-width: 100%; }
}
