/* ─── CMS Admin UI (matches site palette) ─── */

body.cms-admin-active {
  padding-bottom: calc(4.5rem + env(safe-area-inset-bottom));
}

body.cms-edit-mode {
  padding-bottom: calc(5.25rem + env(safe-area-inset-bottom));
}

/* Footer login link */
.cms-footer-admin {
  color: gray !important;
  text-decoration: none !important;
}

.cms-footer-admin:hover {
  text-decoration: underline !important;
}

/* Bottom toolbar */
.cms-admin-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 0.65rem 1rem calc(0.65rem + env(safe-area-inset-bottom));
  background: rgba(255, 252, 247, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--clr-border, rgba(210, 180, 140, 0.45));
  box-shadow: 0 -6px 28px rgba(58, 53, 48, 0.1);
}

.cms-admin-bar__inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.cms-admin-bar__brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.cms-admin-bar__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--clr-primary, #fdb813), var(--clr-secondary, #e87121));
  color: #fff;
  font-size: 0.95rem;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(232, 113, 33, 0.25);
}

.cms-admin-bar__label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--clr-text, #3a3530);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cms-admin-bar__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Buttons (toolbar + modals) */
.cms-btn {
  font-family: var(--font-body, 'Outfit', sans-serif);
  border: none;
  border-radius: 999px;
  padding: 0.55rem 1.15rem;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease,
    opacity 0.2s ease;
  white-space: nowrap;
  line-height: 1.2;
}

.cms-btn-primary {
  background: linear-gradient(135deg, var(--clr-primary, #fdb813), var(--clr-secondary, #e87121));
  color: #fff;
  box-shadow: 0 4px 14px rgba(232, 113, 33, 0.28);
}

.cms-btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(232, 113, 33, 0.35);
}

.cms-btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
  background: #c4b8a8;
}

.cms-btn-secondary {
  background: var(--clr-card-bg, #fffcf7);
  color: var(--clr-secondary, #e87121);
  border: 1.5px solid rgba(232, 113, 33, 0.35);
}

.cms-btn-secondary:hover:not(:disabled) {
  background: rgba(253, 184, 19, 0.12);
  transform: translateY(-1px);
}

body.cms-edit-mode #cms-edit-toggle.cms-btn-secondary {
  background: rgba(232, 113, 33, 0.12);
  border-color: var(--clr-secondary, #e87121);
}

.cms-btn-ghost {
  background: transparent;
  color: var(--clr-text-muted, #5c534c);
  padding: 0.55rem 0.75rem;
}

.cms-btn-ghost:hover:not(:disabled) {
  color: var(--clr-secondary, #e87121);
  background: rgba(232, 113, 33, 0.06);
}

.cms-admin-bar .cms-btn-ghost {
  font-size: 0.85rem;
}

@media (max-width: 520px) {
  .cms-admin-bar__inner {
    flex-direction: column;
    align-items: stretch;
  }

  .cms-admin-bar__actions {
    justify-content: center;
  }

  .cms-admin-bar__brand {
    justify-content: center;
  }
}

/* Inline editing */
body.cms-edit-mode .cms-editable {
  cursor: text;
  outline: 2px dashed transparent;
  outline-offset: 5px;
  border-radius: 8px;
  transition: outline-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

body.cms-edit-mode .cms-editable:hover,
body.cms-edit-mode .cms-editable:focus {
  outline-color: rgba(232, 113, 33, 0.5);
  background: rgba(253, 184, 19, 0.1);
  box-shadow: 0 0 0 4px rgba(253, 184, 19, 0.08);
}

body.cms-edit-mode .cms-editable.cms-focused {
  outline-color: var(--clr-secondary, #e87121);
  outline-style: solid;
  background: rgba(255, 252, 247, 0.95);
}

.cms-workshop-manage {
  cursor: pointer !important;
  position: relative;
  border-radius: 20px;
  transition: box-shadow 0.35s ease;
}

body.cms-edit-mode .cms-workshop-manage {
  box-shadow: inset 0 0 0 2px rgba(232, 113, 33, 0.2);
}

body.cms-edit-mode .cms-workshop-manage:hover {
  box-shadow: inset 0 0 0 2px rgba(232, 113, 33, 0.45),
    0 8px 32px rgba(232, 113, 33, 0.12);
}

.cms-workshop-manage::after {
  content: 'Workshops verwalten';
  position: absolute;
  top: 0.5rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--clr-text, #3a3530);
  color: #fdf9f1;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 5;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

body.cms-edit-mode .cms-workshop-manage:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

body.cms-edit-mode .cms-services-manage {
  cursor: pointer !important;
  position: relative;
  border-radius: var(--radius-md, 18px);
  transition: box-shadow 0.35s ease;
}

body.cms-edit-mode .cms-services-manage {
  box-shadow: inset 0 0 0 2px rgba(232, 113, 33, 0.2);
}

body.cms-edit-mode .cms-services-manage:hover {
  box-shadow: inset 0 0 0 2px rgba(232, 113, 33, 0.45),
    0 8px 32px rgba(232, 113, 33, 0.12);
}

body.cms-edit-mode .cms-services-manage::after {
  content: 'Angebote verwalten';
  position: absolute;
  top: 0.5rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--clr-text, #3a3530);
  color: #fdf9f1;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 5;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

body.cms-edit-mode .cms-services-manage:hover::after {
  opacity: 1;
}

#cms-undo-btn,
#cms-redo-btn {
  min-width: 2.5rem;
  padding: 0.55rem 0.75rem;
  font-size: 1rem;
  line-height: 1;
}

.cms-field-note {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  color: var(--clr-text-muted, #5c534c);
  line-height: 1.4;
}

.cms-input-date {
  cursor: pointer;
}

.cms-input-date::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.7;
}

/* Toast */
.cms-toast {
  position: fixed;
  top: calc(5rem + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  z-index: 1100;
  padding: 0.85rem 1.35rem;
  border-radius: 14px;
  font-weight: 600;
  font-size: 0.92rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  box-shadow: 0 12px 32px rgba(58, 53, 48, 0.15);
  max-width: min(90vw, 360px);
  text-align: center;
}

.cms-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.cms-toast--success {
  background: #fff;
  color: #2d6a3e;
  border: 1px solid #b8dfc4;
}

.cms-toast--error {
  background: #fff;
  color: #8b2e2e;
  border: 1px solid #f0c4c4;
}

/* Modals */
.cms-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(58, 53, 48, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.cms-modal-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.cms-modal {
  background: var(--clr-card-bg, #fffcf7);
  border-radius: 22px;
  width: 100%;
  max-width: 400px;
  padding: 0;
  box-shadow: 0 24px 64px rgba(58, 53, 48, 0.18);
  border: 1px solid var(--clr-border, rgba(210, 180, 140, 0.45));
  transform: translateY(16px) scale(0.98);
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

.cms-modal-overlay.is-open .cms-modal {
  transform: translateY(0) scale(1);
}

.cms-modal--wide {
  max-width: 520px;
  max-height: min(90vh, 640px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cms-modal--wide > div:not(.is-hidden) {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.cms-modal--wide > div.cms-modal__body-only {
  display: block;
}

.cms-modal__body {
  padding: 1.75rem 1.75rem 1.5rem;
}

.cms-modal--wide .cms-modal__body {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 0;
  -webkit-overflow-scrolling: touch;
}

.cms-modal__header {
  padding: 1.5rem 1.75rem 0;
  text-align: center;
}

.cms-modal__header::after {
  content: '';
  display: block;
  width: 48px;
  height: 3px;
  background: linear-gradient(90deg, var(--clr-primary, #fdb813), var(--clr-secondary, #e87121));
  border-radius: 2px;
  margin: 0.85rem auto 0;
}

.cms-modal h2 {
  margin: 0;
  color: var(--clr-text, #3a3530);
  font-size: 1.45rem;
  font-family: var(--font-head, 'Outfit', sans-serif);
  font-weight: 700;
}

.cms-modal p.cms-modal-hint {
  margin: 0.75rem 0 0;
  color: var(--clr-text-muted, #5c534c);
  font-size: 0.92rem;
  line-height: 1.55;
  text-align: center;
}

.cms-modal .cms-modal__body > .cms-modal-hint:first-child,
.cms-modal form .cms-modal-hint {
  text-align: left;
  margin-bottom: 1.25rem;
}

.cms-field {
  margin-bottom: 1.1rem;
  text-align: left;
}

.cms-field label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
  font-size: 0.88rem;
  color: var(--clr-text, #3a3530);
}

.cms-field input,
.cms-field textarea {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 1px solid rgba(58, 53, 48, 0.12);
  border-radius: 12px;
  font-family: inherit;
  font-size: 1rem;
  background: #fff;
  color: var(--clr-text, #3a3530);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cms-field input:focus,
.cms-field textarea:focus {
  outline: none;
  border-color: var(--clr-secondary, #e87121);
  box-shadow: 0 0 0 3px rgba(232, 113, 33, 0.12);
}

.cms-field textarea {
  min-height: 88px;
  resize: vertical;
  line-height: 1.5;
}

.cms-field-error {
  margin: 0.75rem 0 0;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  background: #fef5f5;
  color: #8b2e2e;
  font-size: 0.88rem;
  border: 1px solid #f0d0d0;
}

.cms-field-error:empty {
  display: none;
}

.cms-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.35rem;
  padding: 1.25rem 0 0;
  border-top: 1px solid var(--clr-border, rgba(210, 180, 140, 0.35));
}

.cms-modal--wide .cms-modal__header {
  flex-shrink: 0;
}

.cms-modal--wide .cms-modal-actions {
  padding: 1.25rem 1.75rem 1.5rem;
  margin-top: 0;
  margin-bottom: 0;
  border-top: 1px solid var(--clr-border, rgba(210, 180, 140, 0.35));
  flex-shrink: 0;
  box-shadow: 0 -4px 12px rgba(58, 53, 48, 0.04);
  position: relative;
  z-index: 1;
}

.cms-modal .cms-modal-actions .cms-btn-primary {
  flex: 1;
  min-width: 120px;
}

/* Workshop manager list */
#cms-workshop-list {
  margin: 1rem 0 0.5rem;
}

.cms-workshop-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--clr-border, rgba(210, 180, 140, 0.45));
  border-radius: 14px;
  margin-bottom: 0.6rem;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.cms-workshop-list-item:hover {
  border-color: rgba(232, 113, 33, 0.35);
  box-shadow: 0 6px 20px rgba(58, 53, 48, 0.06);
  transform: translateY(-1px);
}

.cms-workshop-list-item strong {
  color: var(--clr-secondary, #e87121);
  font-size: 0.95rem;
}

.cms-workshop-list-item div:first-child {
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--clr-text-muted, #5c534c);
  min-width: 0;
}

.cms-workshop-list-item .cms-btn {
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.cms-workshop-list-item .cms-btn-ghost {
  padding: 0.4rem 0.5rem;
}

.is-hidden {
  display: none !important;
}

[data-cms-type='multiline'] {
  white-space: pre-line;
}
