/* ==========================================================
   WHALE OS Modal System - Relate Style
   ========================================================== */

:root {
  --modal-width-sm: 420px;
  --modal-width-md: 600px;
  --modal-width-lg: 840px;
  --modal-width-xl: 1100px;
}

/* Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 5, 32, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 5000;
  animation: whale-fade-in 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Modal Dialog */
.modal {
  width: 100%;
  max-width: var(--modal-width-md);
  background: #ffffff;
  border: 1px solid var(--stone-divider, #e2e8f0);
  border-radius: var(--radius-modal, 16px);
  box-shadow: var(--shadow-relate-modal);
  color: var(--midnight-ink, #020520);
  overflow: hidden;
  animation: whale-scale-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.modal-sm { max-width: var(--modal-width-sm); }
.modal-md { max-width: var(--modal-width-md); }
.modal-lg { max-width: var(--modal-width-lg); }
.modal-xl { max-width: var(--modal-width-xl); }

/* Header */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--stone-divider, #e2e8f0);
  background-color: #ffffff;
}

.modal-title {
  font-size: var(--fs-title, 16px);
  font-weight: var(--fw-semibold, 600);
  color: var(--midnight-ink, #020520);
  margin: 0;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 9999px;
  background: transparent;
  color: var(--ash-helper, #6b7280);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  font-size: 16px;
}

.modal-close:hover {
  background: #f1f5f9;
  color: var(--midnight-ink, #020520);
}

/* Body */
.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: calc(85vh - 120px);
  overflow-y: auto;
  color: var(--graphite-body, #14141e);
}

/* Footer */
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--stone-divider, #e2e8f0);
  background-color: #fafbfc;
}

/* Variants */
.modal-full {
  width: min(96vw, 1500px);
  height: min(92vh, 950px);
  max-width: none;
}

.modal-danger .modal-header {
  border-bottom-color: var(--coral-lost, #f26052);
}

.modal-success .modal-header {
  border-bottom-color: var(--mint-win, #16ca2e);
}

.modal-warning .modal-header {
  border-bottom-color: var(--amber-pending, #ffa64d);
}
