/**
 * Modals, Formulare, Tabellen
 */
/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal {
  background: var(--surface-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow:
    0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  animation: modalIn 0.18s ease-out;
  border: 1px solid var(--border-color);
}

.modal-wide {
  max-width: 800px;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-header {
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface-color);
}

.modal-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-body {
  padding: 1.4rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--surface-color);
  color: var(--text-main);
}

.modal-footer {
  padding: 1rem 1.4rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  background: var(--surface-color);
  color: var(--text-main);
}

/* Formulare, die Body & Footer umschliessen (z.B. Pendenz-Modal):
   damit der Footer (Speichern-Button) nie abgeschnitten wird, wird
   das Formular selbst zur Flex-Spalte mit scrollbarer Body-Bereich. */
.modal form {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.modal form .modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-control,
select.form-control,
textarea.form-control {
  background: var(--surface-color);
  color: var(--text-main);
  border-color: var(--border-color);
}

.form-control {
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.15);
}

textarea.form-control {
  min-height: 90px;
  resize: vertical;
}

/* Löschen-Button neben Frist bzw. Terminierung im Pendenz-Dialog */
.field-with-clear {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.field-with-clear .form-control {
  flex: 1;
}

.field-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.btn-clear-field {
  padding: 0.45rem 0.7rem;
  font-size: 0.8rem;
  white-space: nowrap;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th,
td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

th {
  background: var(--column-bg);
  font-weight: 600;
  color: var(--text-main);
}

.hidden {
  display: none !important;
}
