/* =========================================================
   Modal-Komponente
   Markup: src/_includes/components/modal.njk
   Logik:  src/assets/js/modal.js

   Default: Desktop-zentriertes Pop-up mit Fade+Scale
   Mobile (≤600px): Bottom-Sheet mit Slide-up
========================================================= */

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease-out;
}
.modal[hidden] { display: none; }
.modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  cursor: pointer;
}

.modal-card {
  position: relative;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 640px;
  width: calc(100% - 40px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transform: scale(0.96);
  opacity: 0;
  transition: transform 180ms cubic-bezier(.2,.8,.2,1), opacity 180ms ease-out;
}
.modal.is-open .modal-card {
  transform: scale(1);
  opacity: 1;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  line-height: 1.3;
}

.modal-close {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: #666;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .2s, color .2s;
  font-family: inherit;
}
.modal-close:hover {
  background: #f5f5f5;
  color: var(--red);
}
.modal-close:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.modal-content {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

/* Body-Scroll-Lock wenn Modal offen — verhindert Scrolling unter dem Modal.
   Das padding-right wird vom JS gesetzt (Scrollbar-Width) gegen Layout-Shift. */
body.is-modal-open {
  overflow: hidden;
}

/* ===== Mobile Bottom-Sheet (≤600px) =====
   Card slide-up vom unteren Rand. Plan-B falls Datepicker zu eng wird:
   inset: 0 + max-height: 100% (Fullscreen). */
@media (max-width: 600px) {
  .modal {
    align-items: flex-end;
    justify-content: stretch;
  }
  .modal-card {
    width: 100%;
    max-width: none;
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
  }
  .modal.is-open .modal-card {
    transform: translateY(0);
    opacity: 1;
  }
  .modal-header {
    padding: 16px 20px;
  }
  .modal-content {
    padding: 16px 20px 20px;
  }
}

/* Cal.com-Embed-Container — wird von calcom-loader.js mit dem Widget gefüllt.
   min-height verhindert Layout-Sprung während Cal.com-Script lazy-loaded. */
.cal-embed {
  min-height: 600px;
  width: 100%;
}
