/* ═══════════════════════════════════════════════════════════════
   ADMIN LIVE OVERLAY — Styles
   Only active when admin is logged in
   ═══════════════════════════════════════════════════════════════ */

/* ── Admin mode body padding for toolbar ── */
body.admin-mode {
  padding-bottom: 70px;
}

/* ── Floating Toolbar ── */
.admin-toolbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: linear-gradient(135deg, #1a1a1a 0%, #2c2c2c 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 10010;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
  padding: 0 20px;
  font-family: var(--font-body, 'Inter', sans-serif);
}

.admin-toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  position: absolute;
  left: 20px;
}

.admin-toolbar-center {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  position: absolute;
  right: 20px;
}

.admin-toolbar-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #C9A84C;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-toolbar-badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2ecc71;
  flex-shrink: 0;
}

.admin-toolbar-badge .dot.unsaved {
  background: #e67e22;
  animation: pulse-dot 1.5s ease infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Toolbar buttons */
.admin-tb-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  border-radius: 3px;
}

.admin-tb-btn--save {
  background: #C9A84C;
  color: #fff;
}
.admin-tb-btn--save:hover {
  background: #b8963f;
}
.admin-tb-btn--save:disabled {
  background: #555;
  color: #888;
  cursor: default;
}

.admin-tb-btn--help {
  background: rgba(255,255,255,0.1);
  color: #fff;
}
.admin-tb-btn--help:hover {
  background: rgba(255,255,255,0.2);
}

.admin-tb-btn--exit {
  background: transparent;
  color: rgba(255,255,255,0.5);
  border: 1px solid rgba(255,255,255,0.2);
}
.admin-tb-btn--exit:hover {
  color: #fff;
  border-color: rgba(255,255,255,0.4);
}

/* ── Editable field hover effects ── */
[data-admin-key].admin-editable {
  cursor: pointer !important;
  transition: outline 0.2s, box-shadow 0.2s, background-color 0.2s;
  outline: 2px solid transparent;
  outline-offset: 4px;
  position: relative;
  display: inline-block;
}

/* Block-level elements should stay block */
h1[data-admin-key].admin-editable,
h2[data-admin-key].admin-editable,
h3[data-admin-key].admin-editable,
h4[data-admin-key].admin-editable,
p[data-admin-key].admin-editable,
div[data-admin-key].admin-editable,
section[data-admin-key].admin-editable {
  display: block;
}

/* Images should stay their display type */
img[data-admin-key].admin-editable {
  display: inline;
}

[data-admin-key].admin-editable:hover {
  outline: 2px dashed #C9A84C !important;
  box-shadow: 0 0 0 6px rgba(201,168,76,0.15) !important;
  background-color: rgba(201,168,76,0.06);
}

/* Pencil badge on hover */
[data-admin-key].admin-editable:hover > .admin-edit-badge {
  opacity: 1;
  transform: scale(1);
}

.admin-edit-badge {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 26px;
  height: 26px;
  background: #C9A84C;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.2s;
  z-index: 10005;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.admin-edit-badge svg {
  width: 13px;
  height: 13px;
  stroke: #fff;
  fill: none;
  stroke-width: 2;
}

/* Ensure parent cards don't clip the edit badge */
body.admin-mode .card,
body.admin-mode .card-image,
body.admin-mode .card-body,
body.admin-mode .time-card,
body.admin-mode .event-item,
body.admin-mode .event-details,
body.admin-mode .about-text,
body.admin-mode .about-image,
body.admin-mode .contact-info-block,
body.admin-mode .contact-form,
body.admin-mode .content-block,
body.admin-mode .welcome-info,
body.admin-mode .welcome-times {
  overflow: visible !important;
}

/* ── Popover Editor ── */
.admin-popover {
  position: fixed;
  z-index: 10020;
  background: #fff;
  border: 2px solid #C9A84C;
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
  width: 380px;
  max-width: 92vw;
  font-family: var(--font-body, 'Inter', sans-serif);
  animation: popover-in 0.2s ease;
}

@keyframes popover-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.admin-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid #f0ece4;
}

.admin-popover-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #2c2c2c;
  letter-spacing: 0.03em;
}

.admin-popover-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: #999;
  font-size: 1.2rem;
  border-radius: 50%;
  transition: all 0.15s;
}
.admin-popover-close:hover {
  background: #f5f5f5;
  color: #333;
}

.admin-popover-body {
  padding: 14px 16px;
}

.admin-popover-help {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: #fdf9ee;
  border: 1px solid #e8d48b;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 0.78rem;
  line-height: 1.5;
  color: #5a4c2e;
}

.admin-popover-help-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  background: #C9A84C;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  margin-top: 1px;
}

.admin-popover input[type="text"],
.admin-popover input[type="url"],
.admin-popover textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #ddd;
  border-radius: 5px;
  font-size: 0.88rem;
  font-family: inherit;
  color: #2c2c2c;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.admin-popover input[type="text"]:focus,
.admin-popover input[type="url"]:focus,
.admin-popover textarea:focus {
  outline: none;
  border-color: #C9A84C;
  box-shadow: 0 0 0 3px rgba(201,168,76,0.15);
}

.admin-popover textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.6;
}

/* Image preview in popover */
.admin-popover-img-preview {
  margin-top: 10px;
  border-radius: 4px;
  overflow: hidden;
  background: #f5f5f5;
  text-align: center;
}

.admin-popover-img-preview img {
  max-width: 100%;
  max-height: 120px;
  object-fit: contain;
}

.admin-popover-img-preview .no-image {
  padding: 20px;
  color: #999;
  font-size: 0.8rem;
}

.admin-popover-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 10px 16px 14px;
  border-top: 1px solid #f0ece4;
}

.admin-pop-btn {
  padding: 8px 20px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.admin-pop-btn--apply {
  background: #C9A84C;
  color: #fff;
}
.admin-pop-btn--apply:hover {
  background: #b8963f;
}

.admin-pop-btn--cancel {
  background: #f0f0f0;
  color: #666;
}
.admin-pop-btn--cancel:hover {
  background: #e0e0e0;
}

/* ── Section Toggle (Eye Icon) ── */
.admin-section-toggle {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10005;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.95);
  border: 1.5px solid #C9A84C;
  border-radius: 20px;
  padding: 6px 14px 6px 10px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  font-family: var(--font-body, 'Inter', sans-serif);
}

.admin-section-toggle:hover {
  background: #C9A84C;
  color: #fff;
}
.admin-section-toggle:hover svg {
  stroke: #fff;
}
.admin-section-toggle:hover .admin-toggle-label {
  color: #fff;
}

.admin-toggle-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #2c2c2c;
  transition: color 0.2s;
}

.admin-section-toggle svg {
  width: 16px;
  height: 16px;
  stroke: #2c2c2c;
  fill: none;
  stroke-width: 2;
  transition: stroke 0.2s;
}

/* Section when toggled hidden by admin */
[data-admin-section].admin-section-hidden {
  opacity: 0.25;
  position: relative;
}

[data-admin-section].admin-section-hidden .admin-section-toggle {
  background: #e74c3c;
  border-color: #e74c3c;
}
[data-admin-section].admin-section-hidden .admin-section-toggle svg {
  stroke: #fff;
}
[data-admin-section].admin-section-hidden .admin-section-toggle .admin-toggle-label {
  color: #fff;
}

.admin-hidden-banner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.75);
  color: #fff;
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 10004;
  pointer-events: none;
  white-space: nowrap;
  letter-spacing: 0.03em;
}

/* Make sections position relative for toggle button */
[data-admin-section] {
  position: relative;
}

/* ── Help Modal ── */
.admin-help-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 10030;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: help-fade 0.2s ease;
}

@keyframes help-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.admin-help-modal {
  background: #fff;
  border-radius: 12px;
  width: 520px;
  max-width: 92vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  font-family: var(--font-body, 'Inter', sans-serif);
}

.admin-help-modal-header {
  padding: 24px 28px 16px;
  border-bottom: 1px solid #f0ece4;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-help-modal-header h2 {
  font-size: 1.2rem;
  color: #2c2c2c;
  margin: 0;
  font-family: var(--font-display, 'Playfair Display', serif);
}

.admin-help-modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: #999;
  font-size: 1.4rem;
  border-radius: 50%;
}
.admin-help-modal-close:hover {
  background: #f5f5f5;
  color: #333;
}

.admin-help-modal-body {
  padding: 24px 28px 28px;
}

.admin-help-step {
  display: flex;
  gap: 14px;
  margin-bottom: 22px;
  align-items: flex-start;
}

.admin-help-step:last-child {
  margin-bottom: 0;
}

.admin-help-num {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  background: #C9A84C;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
}

.admin-help-text {
  flex: 1;
}

.admin-help-text h4 {
  font-size: 0.95rem;
  color: #2c2c2c;
  margin: 0 0 4px;
}

.admin-help-text p {
  font-size: 0.85rem;
  color: #666;
  line-height: 1.6;
  margin: 0;
}

/* ── Save Confirmation Toast ── */
.admin-save-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #2ecc71;
  color: #fff;
  padding: 14px 24px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  z-index: 10040;
  box-shadow: 0 6px 20px rgba(46,204,113,0.3);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toast-in 0.3s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Popover backdrop (click outside to close) ── */
.admin-popover-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10015;
  background: rgba(0,0,0,0.1);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .admin-toolbar {
    height: auto;
    padding: 10px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .admin-toolbar-left,
  .admin-toolbar-right {
    position: static;
  }

  .admin-toolbar-left {
    width: 100%;
    justify-content: center;
  }

  .admin-toolbar-center {
    flex-wrap: wrap;
    justify-content: center;
  }

  .admin-toolbar-right {
    width: 100%;
    justify-content: center;
  }

  body.admin-mode {
    padding-bottom: 120px;
  }

  .admin-popover {
    width: 92vw;
    left: 4vw !important;
  }

  .admin-section-toggle {
    padding: 5px 10px 5px 8px;
  }

  .admin-toggle-label {
    display: none;
  }
}
