/* ── Admin / Edit Mode Styles ── */
/* Only active when body.edit-mode is set */

/* Admin toolbar */
.admin-toolbar {
  display: none;
  position: fixed;
  top: var(--nav-height);
  left: 0;
  right: 0;
  z-index: 99;
  background: #1a1a1a;
  color: #fff;
  padding: var(--space-sm) var(--space-lg);
  font-size: var(--text-sm);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
body.edit-mode .admin-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.toolbar-label {
  font-weight: 600;
  color: var(--tuerkis);
  margin-right: auto;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.toolbar-label::before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--tuerkis);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

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

.toolbar-btn {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: background var(--transition);
  font-family: var(--font-body);
}
.toolbar-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}
.toolbar-btn.btn-logout {
  background: var(--rot);
  border-color: var(--rot);
}
.toolbar-btn.btn-logout:hover {
  background: var(--rot-dark);
}

/* Shift content down when toolbar is visible */
body.edit-mode main {
  padding-top: 40px;
}

/* ── Inline editing ── */

body.edit-mode [data-edit] {
  position: relative;
  transition: outline var(--transition), background var(--transition);
  cursor: text;
}
body.edit-mode [data-edit]:hover {
  outline: 2px dashed var(--tuerkis);
  outline-offset: 4px;
}
body.edit-mode [data-edit]:focus {
  outline: 2px solid var(--tuerkis);
  outline-offset: 4px;
  background: rgba(74, 173, 168, 0.05);
}

/* Save feedback flash */
[data-edit].save-success {
  animation: flashGreen 0.6s ease;
}
[data-edit].save-error {
  animation: flashRed 0.6s ease;
}

@keyframes flashGreen {
  0% { background: rgba(46, 125, 50, 0.2); }
  100% { background: transparent; }
}
@keyframes flashRed {
  0% { background: rgba(198, 40, 40, 0.2); }
  100% { background: transparent; }
}

/* Image edit overlay */
body.edit-mode [data-edit-type="image"] {
  position: relative;
  cursor: pointer;
}
body.edit-mode [data-edit-type="image"]::after {
  content: 'Bild aendern';
  position: absolute;
  bottom: var(--space-sm);
  right: var(--space-sm);
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-family: var(--font-body);
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}
body.edit-mode [data-edit-type="image"]:hover::after {
  opacity: 1;
}

/* Editable list items in Ausstattung */
body.edit-mode .ausstattung-karte .edit-remove-btn {
  display: inline-flex;
}
body.edit-mode .ausstattung-karte .edit-add-btn {
  display: flex;
}
.edit-remove-btn {
  display: none;
  width: 18px;
  height: 18px;
  background: var(--error);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 12px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  margin-left: auto;
}
.edit-add-btn {
  display: none;
  width: 100%;
  padding: var(--space-xs);
  background: transparent;
  border: 2px dashed var(--tuerkis);
  border-radius: var(--radius);
  color: var(--tuerkis);
  font-size: var(--text-sm);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  margin-top: var(--space-sm);
  transition: background var(--transition);
}
.edit-add-btn:hover {
  background: rgba(74, 173, 168, 0.1);
}

/* ── Formatting toolbar (appears on text selection) ── */

.format-bar {
  display: none;
  position: fixed;
  z-index: 1000;
  background: #1a1a1a;
  border-radius: var(--radius);
  padding: var(--space-xs);
  box-shadow: var(--shadow-lg);
  gap: 2px;
}
.format-bar.visible {
  display: flex;
}
.format-bar button {
  width: 30px;
  height: 30px;
  background: none;
  border: none;
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  transition: background var(--transition);
}
.format-bar button:hover {
  background: rgba(255, 255, 255, 0.15);
}
.format-bar button.active {
  background: var(--tuerkis);
}

/* ── Login popup ── */

.login-popup {
  display: none;
  position: fixed;
  bottom: 7rem;
  right: 2rem;
  background: var(--weiss);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  width: 280px;
}
.login-popup.open {
  display: block;
}
.login-popup h3 {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--rot);
  margin-bottom: var(--space-md);
}
.login-popup input {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1px solid var(--grau);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: var(--text-base);
  margin-bottom: var(--space-md);
}
.login-popup input:focus {
  outline: none;
  border-color: var(--tuerkis);
}
.login-popup button {
  width: 100%;
  padding: 0.7rem;
  background: var(--rot);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition);
}
.login-popup button:hover {
  background: var(--rot-dark);
}
.login-error {
  color: var(--error);
  font-size: var(--text-sm);
  display: none;
  margin-bottom: var(--space-sm);
}

/* ── Modal overlay ── */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 200;
  align-items: flex-start;
  justify-content: center;
  padding: var(--space-md);
  overflow-y: auto;
}
.modal-overlay.open {
  display: flex;
}

.modal-panel {
  background: var(--weiss);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 640px;
  margin: var(--space-2xl) auto;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-header {
  background: var(--rot);
  color: #fff;
  padding: var(--space-md) var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
}
.modal-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity var(--transition);
}
.modal-close:hover { opacity: 1; }

.modal-body {
  padding: var(--space-lg);
  max-height: 70vh;
  overflow-y: auto;
}

.modal-section-title {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--rot);
  margin-bottom: var(--space-sm);
  padding-bottom: var(--space-xs);
  border-bottom: 2px solid var(--grau);
}

.modal-form-row {
  margin-bottom: var(--space-sm);
}
.modal-form-row label {
  display: block;
  font-size: var(--text-sm);
  color: var(--text-hell);
  margin-bottom: var(--space-xs);
}
.modal-form-row input,
.modal-form-row textarea,
.modal-form-row select {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--grau);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: var(--text-sm);
}
.modal-form-row input:focus,
.modal-form-row textarea:focus,
.modal-form-row select:focus {
  outline: none;
  border-color: var(--tuerkis);
}

.modal-btn {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-family: var(--font-body);
  cursor: pointer;
  transition: background var(--transition);
  border: none;
}
.modal-btn-primary {
  background: var(--rot);
  color: #fff;
}
.modal-btn-primary:hover { background: var(--rot-dark); }

.modal-btn-danger {
  background: none;
  border: none;
  color: var(--error);
  cursor: pointer;
  font-size: var(--text-sm);
  padding: var(--space-xs);
}
.modal-btn-danger:hover { text-decoration: underline; }

/* Booking list in calendar editor */
.booking-list {
  list-style: none;
}
.booking-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--grau);
  font-size: var(--text-sm);
}
.booking-item:last-child { border-bottom: none; }
.booking-dates {
  font-weight: 500;
}
.booking-notiz {
  color: var(--text-hell);
  font-size: var(--text-sm);
}

/* Gallery editor drag items */
.gallery-edit-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  border: 1px solid var(--grau);
  border-radius: var(--radius);
  margin-bottom: var(--space-sm);
  background: var(--weiss);
  cursor: grab;
}
.gallery-edit-item:active { cursor: grabbing; }
.gallery-edit-item.dragging {
  opacity: 0.5;
  border-color: var(--tuerkis);
}
.gallery-edit-thumb {
  width: 60px;
  height: 45px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}
.gallery-edit-info {
  flex: 1;
  min-width: 0;
}
.gallery-edit-name {
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Upload drop zone */
.upload-zone {
  border: 2px dashed var(--grau-dark);
  border-radius: var(--radius);
  padding: var(--space-2xl);
  text-align: center;
  color: var(--text-hell);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  margin-top: var(--space-md);
}
.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--tuerkis);
  background: rgba(74, 173, 168, 0.05);
}

/* Price editor rows */
.price-edit-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1.5fr auto;
  gap: var(--space-sm);
  align-items: end;
  margin-bottom: var(--space-sm);
}
.price-edit-row input {
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--grau);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-family: var(--font-body);
}
.price-edit-row input:focus {
  outline: none;
  border-color: var(--tuerkis);
}
