/**
 * Rohowef-style Popup card layout for customdbwef modals.
 * Mirrors Popup + DuplicateWorkflowPopup / DeleteConfirmationPopup structure.
 */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: hsl(0 0% 0% / 0.5);
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  position: relative;
  width: 100%;
  max-width: 42rem;
  min-width: 0;
  background: var(--cdb-card);
  border: 1px solid hsl(220 13% 88% / 0.5);
  border-radius: 12px;
  overflow: hidden;
  box-shadow:
    0 20px 25px -5px hsl(220 8.9% 15% / 0.1),
    0 8px 10px -6px hsl(220 8.9% 15% / 0.1);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--cdb-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.modal-close:hover {
  background: var(--cdb-sidebar-hover);
  color: var(--cdb-fg);
}

.modal-close iconify-icon {
  width: 14px;
  height: 14px;
}

.modal-card {
  display: flex;
  min-height: 380px;
  min-width: 0;
  flex-direction: column;
}

.modal-card__form {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
}

.modal-card__main {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
}

.modal-card__header {
  flex-shrink: 0;
  padding: 20px 44px 0 20px;
}

.modal-card__header-inner {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-card__title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.modal-card__icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--cdb-muted);
}

.modal-card__icon--danger {
  color: var(--cdb-danger);
}

.modal-card__title {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.375;
  color: var(--cdb-fg);
}

.modal-card__subtitle {
  margin: 0;
  font-size: 12px;
  line-height: 1.625;
  color: var(--cdb-muted);
}

.modal-card__meta {
  margin: 8px 0 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--cdb-fg);
}

.modal-card__meta:empty {
  display: none;
}

.modal-card__body {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  justify-content: center;
  gap: 20px;
  padding: 32px 20px;
}

.modal-body-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 560px) {
  .modal-body-row {
    grid-template-columns: 1fr;
  }
}

.modal-card__footer {
  display: flex;
  width: 100%;
  flex-shrink: 0;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid hsl(220 13% 88% / 0.4);
  background: hsl(220 14% 96% / 0.35);
  padding: 16px 20px;
}

.modal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.1s ease,
    opacity 0.15s ease;
  box-shadow: 0 1px 2px hsl(220 8.9% 15% / 0.08);
}

.modal-btn iconify-icon {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.modal-btn--outline {
  border: 1px solid var(--cdb-border-strong);
  background: transparent;
  color: var(--cdb-fg);
}

.modal-btn--outline:hover:not(:disabled):not(.is-loading) {
  background: var(--cdb-sidebar-hover);
  box-shadow: 0 2px 6px hsl(220 8.9% 15% / 0.08);
}

.modal-btn--outline:active:not(:disabled):not(.is-loading) {
  transform: translateY(1px);
}

.modal-btn--primary {
  border: none;
  background: var(--cdb-primary);
  color: var(--cdb-primary-fg);
}

.modal-btn--primary:hover:not(:disabled):not(.is-loading) {
  background: var(--cdb-primary-hover);
  box-shadow: 0 3px 10px hsl(221 83% 53% / 0.32);
}

.modal-btn--primary:active:not(:disabled):not(.is-loading) {
  transform: translateY(1px);
  box-shadow: 0 1px 3px hsl(221 83% 53% / 0.22);
}

.modal-btn--danger {
  border: none;
  background: var(--cdb-danger);
  color: hsl(0 0% 98%);
}

.modal-btn--danger:hover:not(:disabled):not(.is-loading) {
  background: hsl(0 84% 52%);
  box-shadow: 0 3px 10px hsl(0 84% 60% / 0.28);
}

.modal-btn--danger:active:not(:disabled):not(.is-loading) {
  transform: translateY(1px);
  box-shadow: 0 1px 3px hsl(0 84% 60% / 0.22);
}

.modal-card__body--compact {
  padding-top: 16px;
  padding-bottom: 16px;
}

.delete-league-modal__name {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--cdb-fg);
  word-break: break-word;
}

.modal-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.modal-form-error {
  color: var(--cdb-danger);
  font-size: 12px;
  min-height: 1.2em;
  margin: 0;
}
