#admin-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 44px;
  background-color: #1a1a2e;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  z-index: 10000;
  box-sizing: border-box;
  font-family: system-ui, -apple-system, sans-serif;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
}

#admin-save-status {
  font-size: 0.9rem;
  opacity: 0;
  transition: opacity 0.3s;
}

#admin-save-status.saved {
  color: #4caf50;
  opacity: 1;
}

#admin-logout {
  background: transparent;
  color: white;
  border: 1px solid white;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
}

#admin-logout:hover {
  background: rgba(255, 255, 255, 0.1);
}

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

/* Ensure mobile sticky CTA doesn't overlap admin bar */
@media (max-width: 767px) {
  body.admin-mode {
    padding-bottom: 98px; /* 44px admin bar + 54px sticky CTA */
  }
  body.admin-mode .sticky-cta {
    bottom: 44px;
  }
}

body.admin-mode [data-editable] {
  outline: 2px dashed rgba(74, 111, 165, 0.5);
  cursor: text;
  transition: outline-color 0.2s;
  border-radius: 2px;
}

body.admin-mode [data-editable]:hover {
  outline-color: rgba(74, 111, 165, 1);
}

body.admin-mode [data-editable].admin-editing {
  outline: 2px solid #4a6fa5;
  background: rgba(74, 111, 165, 0.08);
}

body.admin-mode [data-editable-image] {
  outline: 2px dashed rgba(200, 155, 90, 0.5);
  cursor: copy;
  transition: all 0.2s;
}

body.admin-mode [data-editable-image]:hover {
  outline-color: rgba(200, 155, 90, 1);
  background: rgba(200, 155, 90, 0.05);
}

body.admin-mode .admin-image-dragover {
  outline: 3px solid #c89b5a !important;
  background: rgba(200, 155, 90, 0.2) !important;
  transform: scale(1.01);
}

body.admin-mode .dragging {
  opacity: 0.5;
  transform: scale(0.95);
}

body.admin-mode .media-item[draggable="true"] {
  cursor: grab;
}

body.admin-mode .media-item.dragging {
  cursor: grabbing;
}

/* Image Controls Overlay */
.admin-image-controls {
  position: absolute;
  top: 5px;
  right: 5px;
  display: flex;
  gap: 5px;
  z-index: 1000; /* Increased to be above newly added content */
  opacity: 0.8;
  transition: opacity 0.2s;
}

/* Fallback for empty/broken image containers */
[data-editable-image] {
  background: linear-gradient(135deg, #2c3e50, #000000);
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

[data-editable-image] img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

[data-editable-image] img[src=""],
[data-editable-image] img:not([src]) {
  display: none;
}

/* Hide placeholder icon if there's a valid image */
[data-editable-image] img[src]:not([src=""]) ~ .placeholder-icon {
  display: none;
}

.admin-image-dropzone:hover .admin-image-controls {
  opacity: 1;
}

.admin-image-btn,
.admin-gallery-delete-btn {
  width: 32px;
  height: 32px;
  background: #1a1a2e;
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  transition: all 0.2s;
}

.admin-image-btn:hover,
.admin-gallery-delete-btn:hover {
  transform: scale(1.1);
}

.admin-image-upload-btn {
  background: #4a6fa5;
}

.admin-image-upload-btn:hover {
  background: #3a5a8a;
}

.admin-image-reposition-btn {
  background: #27ae60;
}

.admin-image-reposition-btn:hover {
  background: #219150;
}

.admin-image-reposition-btn.active {
  background: #f1c40f;
  color: #1a1a2e;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #f1c40f;
}

.admin-image-remove-btn,
.admin-gallery-delete-btn {
  background: #c0392b;
}

.admin-image-remove-btn:hover,
.admin-gallery-delete-btn:hover {
  background: #e74c3c;
}

/* Panning Mode */
body.admin-mode .panning-active {
  outline: 3px solid #f1c40f !important;
  cursor: grab !important;
  z-index: 1001;
}

body.admin-mode .panning-active img {
  pointer-events: none; /* Let the container handle mouse events */
}

body.admin-mode .panning-dragging {
  cursor: grabbing !important;
}

.admin-image-controls {
  display: none;
}

body.admin-mode .admin-image-controls {
  display: flex;
}

/* Gallery Upload Button */
#admin-gallery-upload-btn {
  display: none;
}

body.admin-mode #admin-gallery-upload-btn {
  display: inline-block;
}

/* Modal */
#admin-modal,
#admin-event-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10001;
}

.hidden {
  display: none !important;
}

.admin-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
}

.admin-modal-dialog {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border-radius: 12px;
  padding: 32px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  color: #333;
}

#admin-modal-dialog {
  width: 320px;
}

.admin-modal-dialog h3 {
  margin: 0 0 20px 0;
  font-size: 1.25rem;
}

#admin-password-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
  margin-bottom: 12px;
  box-sizing: border-box;
}

#admin-login-btn {
  width: 100%;
  background: #4a6fa5;
  color: white;
  padding: 10px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 1rem;
}

#admin-login-btn:hover {
  background: #3a5a8a;
}

#admin-login-error {
  color: #c0392b;
  font-size: 0.85rem;
  margin-top: 8px;
  min-height: 1.2em;
}

/* Event Management */
.admin-event-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  display: none;
  gap: 8px;
  z-index: 10;
}

body.admin-mode .admin-event-controls {
  display: flex;
}

.admin-event-btn {
  background: rgba(0,0,0,0.7);
  color: white;
  border: none;
  border-radius: 4px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all 0.2s;
}

.admin-event-btn:hover {
  background: #4a6fa5;
  transform: scale(1.1);
}

.admin-event-btn.delete-event:hover {
  background: #c0392b;
}

.add-event-card {
  display: none !important;
  border: 2px dashed #4a6fa5;
  background: rgba(74, 111, 165, 0.05);
  min-height: 280px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  align-items: center;
  justify-content: center;
}

body.admin-mode .add-event-card {
  display: flex !important;
}

body.admin-mode .no-events-msg {
  display: none !important;
}

.add-event-card:hover {
  background: rgba(74, 111, 165, 0.1);
  border-color: #3a5a8a;
}

.add-event-inner {
  text-align: center;
  color: #4a6fa5;
}

.add-event-icon {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 8px;
}

/* Event Modal Form */
#admin-event-modal-dialog {
  width: 500px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
}

.admin-form-group {
  margin-bottom: 16px;
}

.admin-form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: #666;
}

.admin-form-control {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  box-sizing: border-box;
  font-family: inherit;
}

.admin-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.admin-modal-footer {
  margin-top: 24px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.admin-btn-cancel {
  background: #eee;
  color: #333;
  padding: 10px 20px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
}

.admin-btn-save {
  background: #4a6fa5;
  color: white;
  padding: 10px 20px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
}

.admin-btn-save:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.admin-event-img-preview {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 6px;
  margin-top: 8px;
  background: #f5f5f5;
  border: 1px solid #eee;
}
