/* style_ueberblick.css - App-spezifische Styles für Überblick */

/* --- Buttons (leichtes, modernes Aussehen) --- */
.btn {
  display: inline-block;
  padding: 0.45rem 0.8rem;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #f3f4f6;
  color: #111827;
  font-size: 0.95rem;
  cursor: pointer;
}
.btn:hover {
  filter: brightness(0.98);
}
.btn.primary {
  background: linear-gradient(180deg, #2563eb, #1e40af);
  color: #fff;
  border-color: rgba(0, 0, 0, 0.08);
}

/* --- Modal / Popup --- */
.termin-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
}
.termin-modal[aria-hidden="true"] {
  display: none;
}
.termin-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
}
.termin-modal-dialog {
  position: relative;
  width: 100%;
  max-width: 920px;
  margin: 1rem;
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(2, 6, 23, 0.35);
  padding: 1rem 1.25rem;
  z-index: 2;
}

/* Styles specific to the appointments list modal content */
#terminListPopupContent {
  padding: 6px 2px 12px 2px;
  min-width: 320px;
}

#terminListPopupContent .btn.small {
  padding: 0.32rem 0.6rem;
  font-size: 0.9rem;
  border-radius: 6px;
}

#terminListPopupContent .btn.danger {
  background: #fff6f6;
  border-color: rgba(255, 0, 0, 0.08);
  color: #b91c1c;
}

#terminListPopupContent > div > div {
  /* spacing for list rows */
  margin-bottom: 6px;
}

/* plus/circular action button (copied from dashboard styles so overview can reuse it) */
.btn-icon.modern {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent, #0b76ef);
  color: #fff;
  border: none;
  padding: 0;
  box-shadow: 0 6px 18px rgba(11, 118, 239, 0.12);
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
  cursor: pointer;
}
.btn-icon.modern svg {
  display: block;
  width: 18px;
  height: 18px;
}
.btn-icon.modern:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 6px 18px rgba(11, 118, 239, 0.22);
}
.btn-icon.modern:active {
  transform: translateY(0) scale(0.99);
}
.btn-icon.modern:focus {
  outline: 2px solid rgba(11, 118, 239, 0.22);
  outline-offset: 2px;
}
.btn-icon.modern.subtle {
  background: #fff;
  color: var(--accent, #0b76ef);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.termin-form fieldset {
  border: none;
  padding: 0;
  margin: 0;
}
.termin-form legend {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.termin-form label {
  display: block;
  margin-top: 0.6rem;
  font-size: 0.9rem;
  color: #374151;
}
.termin-form input[type="text"],
.termin-form input[type="datetime-local"],
.termin-form select,
.termin-form textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  margin-top: 0.25rem;
  background: #fff;
  font-size: 0.95rem;
}

.termin-dates {
  display: flex;
  gap: 0.75rem;
}
.termin-dates > div {
  flex: 1;
}

.termin-form-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  margin-top: 0.9rem;
}

/* smaller select to show multiple options nicely */
.termin-form select[multiple] {
  min-height: 110px;
}

.termin-type {
  margin-top: 0.6rem;
  display: flex;
  gap: 0.6rem;
  align-items: center;
}
.suggestions {
  position: relative;
  margin-top: 4px;
}
.suggestions .suggestion-list {
  position: absolute;
  z-index: 1200;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(2, 6, 23, 0.12);
  max-height: 220px;
  overflow: auto;
  width: 100%;
}
.suggestions .suggestion-item {
  padding: 6px 10px;
  cursor: pointer;
  font-size: 0.95rem;
}
.suggestions .suggestion-item:hover {
  background: #f3f4f6;
}
.suggestions .suggestion-item.active {
  background: #eef2ff;
  outline: 1px solid rgba(99, 102, 241, 0.12);
}

/* Responsive tweaks */
@media (max-width: 560px) {
  .termin-modal-dialog {
    padding: 0.75rem;
  }
  .termin-dates {
    flex-direction: column;
  }
}

/* small helper for action area above table */
.ueberblick-actions {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

/* Progress panel styles */
.ueberblick-progress {
  display: block;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  border: 1px solid #e6edf3;
  padding: 10px;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(2, 6, 23, 0.06);
  margin-bottom: 12px;
}
.ueberblick-progress .progress-step {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 6px 4px;
  border-radius: 6px;
}
.ueberblick-progress .progress-step + .progress-step {
  margin-top: 6px;
}
.ueberblick-progress .step-icon {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #fff;
  background: #cbd5e1; /* neutral */
}
.ueberblick-progress .progress-step.running .step-icon {
  background: #f59e0b; /* amber */
  animation: pulse 1.6s infinite;
}
.ueberblick-progress .progress-step.done .step-icon {
  background: #10b981; /* green */
}
.ueberblick-progress .progress-step.error .step-icon {
  background: #ef4444; /* red */
}

/* Animated ring loader for running state */
.ueberblick-progress .progress-step .step-icon {
  position: relative;
  width: 18px;
  height: 18px;
  min-width: 18px;
}
.ueberblick-progress .progress-step .step-icon::before,
.ueberblick-progress .progress-step .step-icon::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.ueberblick-progress .progress-step .step-icon::before {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(99, 102, 241, 0.12);
  box-sizing: border-box;
  opacity: 0.9;
}
.ueberblick-progress .progress-step .step-icon::after {
  width: 26px;
  height: 26px;
  border: 3px solid transparent;
  border-top-color: rgba(99, 102, 241, 0.18);
  opacity: 0.85;
}
.ueberblick-progress .progress-step.running .step-icon::after {
  animation: spin 1.2s linear infinite;
}
@keyframes spin {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}
.ueberblick-progress .step-body .step-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: #0f172a;
}
.ueberblick-progress .step-body .step-detail {
  font-size: 0.85rem;
  color: #475569;
}
@keyframes pulse {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.6;
    transform: scale(1.08);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Calendar cell tweaks: allow multiple lines/titles stacked */
.calendar-day {
  /* keep calendar cells a fixed height and prevent row expansion */
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  vertical-align: middle !important;
  padding: 4px 6px !important;
  height: 26px !important;
  max-height: 26px !important;
  line-height: 18px !important;
}
.calendar-day > div:not(.cal-cell-wrap) {
  display: inline;
  margin: 0;
  padding: 0;
}

/* Mini-Stack-Indikator für Vorhaben-Zeilen bei mehreren Einträgen */
.cal-cell-wrap {
  display: flex !important;
  align-items: center;
  gap: 6px;
  width: 100%;
}
.cal-stack-indicator {
  display: flex !important;
  flex-direction: column;
  justify-content: space-between;
  gap: 2px;
  width: 6px;
  min-width: 6px;
  height: 18px;
  flex-shrink: 0;
}
.cal-stack-seg {
  flex: 1 1 0;
  background: #2563eb;
  border-radius: 2px;
  opacity: 0.9;
}
.cal-stack-seg:nth-child(2n) {
  opacity: 0.7;
}
.cal-stack-seg:nth-child(n + 5) {
  opacity: 0.5;
}
.cal-stack-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Layout: make overview use same flexible scrollable table area as `dienste` */
#ueberblick {
  display: flex;
  flex-direction: column;
  /* size relative to parent `#content` which already has height:100% */
  height: 100%;
  min-height: 0;
}

#ueberblick .table-container {
  flex: 1 1 auto;
  min-height: 1px;
  /* Place vertical scrolling on the outer container so the scrollbar
     runs alongside the column headers. Allow horizontal scrolling here. */

  overflow: auto;
}

/* Make Handsontable's master element use column flex layout so the
   header clone and the scrolling body behave as stacked flex children.
   The outer `.table-container` will provide the vertical scrollbar. */
#ueberblick .table-container .ht_master {
  display: flex;
  flex-direction: column;
  height: 100%;
}
#ueberblick .table-container .ht_clone_top {
  flex: 0 0 auto;
}

#ueberblickContent {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

/* Ensure stable row heights for Handsontable - apply to all clones */
#ueberblick .table-container .handsontable .htCore td,
#ueberblick .table-container .handsontable .htCore th {
  box-sizing: border-box;
  height: 30px !important;
}
