/* apl3: Titel oben (weiße Karte), Buttons unten direkt auf dimmtem Hintergrund */

.rounding-mode-title {
  position: fixed;
  left: 50%;
  top: calc(var(--topbar-height, 64px) + 2rem);
  transform: translateX(-50%);
  z-index: 10000;
  margin: 0;
  padding: 16px 32px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  font-size: 18px;
  font-weight: 600;
  color: #212529;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  max-width: min(92vw, 640px);
}

.rounding-mode-title[hidden],
.rounding-mode-actions[hidden] {
  display: none !important;
}

.rounding-mode-actions {
  position: fixed;
  left: 50%;
  bottom: 80px;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  gap: 16px;
  align-items: center;
  pointer-events: auto;
}

.rounding-mode-btn {
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.rounding-mode-btn--cancel {
  padding: 14px 32px;
  background: #6c757d;
  color: #ffffff;
  font-size: 16px;
}

.rounding-mode-btn--cancel:hover {
  background: #5a6268;
}

.rounding-mode-btn--confirm {
  padding: 16px 48px;
  background: #e5322d;
  color: #ffffff;
  font-size: 18px;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(229, 50, 45, 0.4);
}

.rounding-mode-btn--confirm:hover {
  background: #c92a25;
  box-shadow: 0 6px 16px rgba(229, 50, 45, 0.5);
}

/* Eckradius-Modal — apl3 rounding-radius-modal */
#rounding-modal.rounding-radius-modal {
  z-index: 20000;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

#rounding-modal .rounding-radius-modal__panel {
  width: min(100%, 400px);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

#rounding-modal .rounding-radius-modal__header {
  padding: 20px 24px;
}

#rounding-modal .rounding-radius-modal__header h3 {
  font-size: 18px;
  font-weight: 700;
  color: #212529;
}

#rounding-modal .rounding-radius-modal__close {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: #6c757d;
  transition: background 0.2s ease, color 0.2s ease;
}

#rounding-modal .rounding-radius-modal__close:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #212529;
}

#rounding-modal .rounding-modal-body {
  padding: 24px;
  gap: 12px;
}

#rounding-modal .rounding-modal-intro {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: #6c757d;
}

#rounding-modal .rounding-modal-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #212529;
  margin: 4px 0 0;
}

#rounding-modal .rounding-input-with-unit {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 4px 4px;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  background: #ffffff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#rounding-modal .rounding-input-with-unit:focus-within {
  border-color: #e5322d;
  box-shadow: 0 0 0 3px rgba(229, 50, 45, 0.12);
}

#rounding-modal .rounding-input-with-unit input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 12px 10px;
  font-size: 16px;
  font-weight: 500;
  color: #212529;
}

#rounding-modal .rounding-input-with-unit input:focus {
  outline: none;
}

#rounding-modal .rounding-input-with-unit input::placeholder {
  color: #adb5bd;
  font-weight: 400;
}

#rounding-modal .rounding-input-with-unit .unit {
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 500;
  color: #6c757d;
  min-width: 28px;
}

#rounding-modal .rounding-modal-footer {
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  background: #fafbfc;
  flex-wrap: wrap;
}

#rounding-modal .rounding-modal-back-link {
  border: none;
  background: transparent;
  padding: 0;
  font-size: 14px;
  font-weight: 500;
  color: #6c757d;
  cursor: pointer;
  transition: color 0.2s ease;
}

#rounding-modal .rounding-modal-back-link:hover {
  color: #e5322d;
}

#rounding-modal .rounding-modal-footer-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-left: auto;
}

#rounding-modal .rounding-modal-btn {
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  white-space: nowrap;
}

#rounding-modal .rounding-modal-btn--cancel {
  background: #ffffff;
  color: #6c757d;
  border-color: #e9ecef;
}

#rounding-modal .rounding-modal-btn--cancel:hover {
  background: #f8f9fa;
  color: #212529;
  border-color: #dee2e6;
}

#rounding-modal .rounding-modal-btn--remove {
  background: #ffffff;
  color: #c92a25;
  border-color: #f1aeb5;
}

#rounding-modal .rounding-modal-btn--remove:hover {
  background: #fff5f5;
  color: #a0221e;
  border-color: #e9a1a8;
}

#rounding-modal .rounding-modal-btn--save {
  background: linear-gradient(135deg, #e5322d 0%, #c92a25 100%);
  color: #ffffff;
  border: none;
  min-width: 110px;
}

#rounding-modal .rounding-modal-btn--save:hover {
  background: linear-gradient(135deg, #c92a25 0%, #a0221e 100%);
  box-shadow: 0 4px 12px rgba(229, 50, 45, 0.3);
}

#rounding-modal .apl4-modal__error {
  margin: 0;
}

@media (max-width: 480px) {
  #rounding-modal .rounding-modal-footer {
    flex-direction: column;
    align-items: stretch;
  }

  #rounding-modal .rounding-modal-footer-actions {
    width: 100%;
    margin-left: 0;
  }

  #rounding-modal .rounding-modal-btn {
    flex: 1;
  }
}
