/**
 * XP Modal Component Styles
 */

/* Backdrop overlay - SOMA style */
.xp-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(18, 18, 18, 0.7);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 1299;
  opacity: 0;
  visibility: hidden;
  transition: opacity 280ms cubic-bezier(0.4, 0, 0.2, 1), 
              visibility 280ms cubic-bezier(0.4, 0, 0.2, 1);
}

.xp-modal-overlay--active {
  opacity: 1;
  visibility: visible;
}

/* Modal container */
.xp-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 280ms cubic-bezier(0.4, 0, 0.2, 1), 
              visibility 280ms cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
}

.xp-modal--active {
  opacity: 1;
  visibility: visible;
}

/* Modal dialog - SOMA animation */
.xp-modal__dialog {
  position: relative;
  width: 100%;
  max-width: 560px;
  transform: scale(0.8) translateY(20px);
  opacity: 0;
  transition: transform 280ms cubic-bezier(0.4, 0, 0.2, 1),
              opacity 280ms cubic-bezier(0.4, 0, 0.2, 1);
}

.xp-modal--active .xp-modal__dialog {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* Size variants */
.xp-modal--small .xp-modal__dialog {
  max-width: 360px;
}

.xp-modal--medium .xp-modal__dialog {
  max-width: 560px;
}

.xp-modal--large .xp-modal__dialog {
  max-width: 800px;
}

/* Modal content wrapper - SOMA elevation */
.xp-modal__content {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 24px 48px rgba(18, 18, 18, 0.16),
              0 8px 16px rgba(18, 18, 18, 0.08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Modal header - SOMA style */
.xp-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 24px 24px 0;
  gap: 16px;
  border-bottom: none;
  background: #ffffff;
}

/* Modal title - SOMA heading-5 variant */
.xp-modal__title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #121212;
  line-height: 1.4;
  letter-spacing: -0.01em;
  flex: 1;
}

/* Close button - SOMA icon button style */
.xp-modal__close {
  border: none;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  color: #5d5d5d;
  cursor: pointer;
  padding: 4px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1),
              color 150ms cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  margin: -4px -4px 0 0;
}

.xp-modal__close:hover {
  background: #f5f5f5;
  color: #121212;
}

.xp-modal__close:active {
  background: #e8e8e8;
}

.xp-modal__close:focus-visible {
  outline: 2px solid #0066ff;
  outline-offset: 2px;
}

/* Modal body - SOMA content style */
.xp-modal__body {
  padding: 16px 24px 24px;
  max-height: calc(85vh - 120px);
  overflow-y: auto;
  color: #404040;
  font-size: 14px;
  line-height: 1.6;
}

.xp-modal__body::-webkit-scrollbar {
  width: 8px;
}

.xp-modal__body::-webkit-scrollbar-track {
  background: transparent;
}

.xp-modal__body::-webkit-scrollbar-thumb {
  background: #d0d0d0;
  border-radius: 4px;
}

.xp-modal__body::-webkit-scrollbar-thumb:hover {
  background: #b0b0b0;
}

.xp-modal__body p {
  margin: 0 0 16px;
}

.xp-modal__body p:last-child {
  margin-bottom: 0;
}

.xp-modal__body h3 {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 600;
  color: #121212;
  line-height: 1.4;
}

.xp-modal__body ul,
.xp-modal__body ol {
  margin: 0 0 16px;
  padding-left: 24px;
}

.xp-modal__body li {
  margin-bottom: 8px;
}

/* Divider - SOMA style */
.xp-modal__divider {
  height: 1px;
  background: #e8e8e8;
  margin: 0;
  border: none;
}

/* Modal actions - SOMA footer */
.xp-modal__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px 24px;
  background: #ffffff;
}

/* Responsive */
@media (max-width: 768px) {
  .xp-modal {
    padding: 16px;
  }

  .xp-modal__dialog {
    max-width: 100%;
  }

  .xp-modal--small .xp-modal__dialog,
  .xp-modal--medium .xp-modal__dialog,
  .xp-modal--large .xp-modal__dialog {
    max-width: 100%;
  }

  .xp-modal__content {
    border-radius: 8px;
  }

  .xp-modal__header {
    padding: 20px 16px 12px;
  }

  .xp-modal__title {
    font-size: 18px;
  }

  .xp-modal__body {
    padding: 12px 16px 20px;
    max-height: calc(85vh - 100px);
  }

  .xp-modal__actions {
    padding: 12px 16px 20px;
  }
}

/* Dark mode support (future) */
@media (prefers-color-scheme: dark) {
  .xp-modal-overlay {
    background: rgba(0, 0, 0, 0.85);
  }

  .xp-modal__content {
    background: #1a1a1a;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4),
                0 8px 16px rgba(0, 0, 0, 0.3);
  }

  .xp-modal__header,
  .xp-modal__body,
  .xp-modal__actions {
    background: #1a1a1a;
  }

  .xp-modal__title,
  .xp-modal__body h3 {
    color: #f5f5f5;
  }

  .xp-modal__body {
    color: #d0d0d0;
  }

  .xp-modal__close {
    color: #a0a0a0;
  }

  .xp-modal__close:hover {
    background: #2a2a2a;
    color: #f5f5f5;
  }

  .xp-modal__close:active {
    background: #3a3a3a;
  }

  .xp-modal__divider {
    background: #2a2a2a;
  }

  .xp-modal__body::-webkit-scrollbar-thumb {
    background: #404040;
  }

  .xp-modal__body::-webkit-scrollbar-thumb:hover {
    background: #505050;
  }
}
