// Modal Overlay
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-background-overlay-50);
  z-index: map.get($z-index, 'modal');
}

// Modal Layout
.layout {
  display: flex;
  flex-direction: column;
  background: var(--color-surface-primary);
  border-radius: map.get($radius, 'lg');
  overflow: hidden;
  box-shadow: 0px 10px 40px rgba(0, 0, 0, 0.15);
  max-width: 100%;
  max-height: 90vh;
}

// Modal Header
.header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: map.get($spacing-scale, 'lg');
  background: var(--color-surface-primary);
}

.headerTitle {
  flex: 1;
  @include heading-4;
  color: var(--color-text-primary);
  margin: 0;
}

.closeButton {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  color: var(--color-text-secondary);
  flex-shrink: 0;

  @include transition(color);

  &:hover {
    color: var(--color-text-primary);
  }

  &:active {
    transform: scale(0.95);
  }
}

// Modal Content
.content {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

// Modal Footer
.footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: map.get($spacing-scale, 's-3');
  padding: map.get($spacing-scale, 'lg');
  background: var(--color-surface-primary);
  border-top: 1px solid var(--color-border);
}

.discardButton {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px map.get($spacing-scale, 'md');
  background: var(--color-surface-primary);
  border: 1px solid var(--color-grey-neutral);
  border-radius: map.get($radius, 'md');
  color: var(--color-semantic-danger);
  cursor: pointer;
  @include body-medium;

  @include transition(background-color, border-color);

  &:hover {
    background: var(--color-surface-alt);
    border-color: var(--color-semantic-danger);
  }

  &:active {
    transform: scale(0.98);
  }
}

// Responsive adjustments
@media (max-width: $breakpoint-md) {
  .layout {
    width: 100% !important;
    max-width: calc(100vw - 32px);
  }

  .header {
    padding: map.get($spacing-scale, 'md') map.get($spacing-scale, 'md') map.get($spacing-scale, 'lg') map.get($spacing-scale, 'md');
  }

  .footer {
    padding: map.get($spacing-scale, 'md');
    flex-wrap: wrap;
  }

  .discardButton {
    flex: 1;
    min-width: 120px;
  }
}
