/* --- Modal Backdrop --- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(12px, 3vw, 20px);
  z-index: 10000;
}

/* --- Modal Box --- */
.modal-content {
  background: #fff;
  border-radius: 14px;
  width: min(100%, 600px);
  padding: clamp(16px, 4vw, 28px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  position: relative;
  animation: modalZoom 0.25s ease-out;
  font-family: "Lexend", system-ui, sans-serif;
  max-height: calc(100dvh - 40px);
  overflow: auto;
  overscroll-behavior: contain;
}

/* Keep the close button clear of the dialog title. */
.modal-content > .modal-title {
  padding-inline-end: 40px;
}

/* TinyMCE attaches its link dialog to the document body. */
body:has(.modal [data-controller="rich-text"]) > .tox-tinymce-aux {
  z-index: 10001;
}

/* --- Title --- */
.modal-title {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 16px;
  color: var(--color-primary);
}

/* --- Body --- */
.modal-body {
  font-size: 15px;
  color: #4b5563;
  line-height: 1.55;
}

/* --- Warning Icon --- */
.modal-icon {
  font-size: 32px;
  text-align: center;
  margin-bottom: 10px;
}

/* --- Dialog Actions --- */
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}

/* --- Close Icon --- */
.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  border: none;
  background: transparent;
  min-width: 40px;
  min-height: 40px;
  font-size: 20px;
  cursor: pointer;
  color: #4b5563;
  transition: 0.2s;
}

.modal-close:hover {
  color: #111827;
  transform: scale(1.12);
}

/* --- Animation --- */
@keyframes modalZoom {
  from {
    opacity: 0;
    transform: translateY(25px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* model inside error */
.alert-error {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b31919;
  border-radius: 8px;
  margin-bottom: 20px;
}

.alert-icon {
  font-size: 20px;
  margin-top: 2px;
}

.alert-text div {
  line-height: 1.5;
  font-size: 15px;
}

.modal-form {
  display: grid;
  gap: 16px;
}

.modal-form .modal-actions {
  margin-top: 4px;
}

.modal-actions .btn,
.portal-list .btn {
  min-height: 44px;
}

.modal-field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.modal-field label,
.modal-check label {
  color: var(--color-text);
  font-size: 14px;
  font-weight: 500;
}

.modal-field :is(input:not([type="hidden"]), select, textarea),
.modal-form .multi-checkbox input {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #8b93a2;
  border-radius: 8px;
  background-color: var(--color-surface);
  color: var(--color-text);
  font: inherit;
}

.modal-field select {
  padding-inline-end: 36px;
  appearance: none;
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
}

.modal-field textarea {
  resize: vertical;
}

.modal-field p,
.portal-list p {
  margin: 0;
  color: var(--color-field-text);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.modal-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}

.modal-form .multi-checkbox {
  min-width: 0;
  overflow-x: auto;
}

.modal-form .multi-checkbox table {
  width: 100%;
  min-width: 340px;
  margin-bottom: 12px;
}

.portal-list {
  display: grid;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.portal-list__item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow-wrap: anywhere;
}

.portal-list__item h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.portal-list__status {
  padding: 4px 8px;
  border-radius: 6px;
  background: #e6ffd4;
  color: #305c1c;
  font-size: 14px;
}
