/* ==================================================
   Modal Components - Consolidated Styles
   Single source of truth for all modal patterns
   ================================================== */

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  z-index: 1;
  transition: opacity var(--duration-base);
}

.modal-overlay.hidden {
  display: none;
}

/* Tailwind-compatible overlay variant */
.modal-overlay-tailwind {
  @apply fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity;
}

/* Modal Container */
.modal-container {
  @apply fixed inset-0 z-10 overflow-y-auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

/* Modal Content */
.modal-content {
  background: var(--app-bg-surface);
  border: 1px solid var(--app-border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
  max-width: 448px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
  position: relative;
  z-index: 10;
}

/* Tailwind-compatible content variant */
.modal-content-tailwind {
  @apply relative transform overflow-hidden rounded-lg bg-white text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg;
}

/* Modal Animation */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Modal Header */
.modal-header {
  padding: 20px;
  border-bottom: 1px solid var(--app-border-subtle);
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

/* Modal Icon */
.modal-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-icon.primary {
  background: rgba(74, 159, 216, 0.15);
}

.modal-icon.primary i {
  color: var(--app-accent-blue);
  width: 24px;
  height: 24px;
}

.modal-icon.success {
  background: rgba(107, 192, 112, 0.15);
}

.modal-icon.success i {
  color: var(--app-accent-green);
  width: 24px;
  height: 24px;
}

.modal-icon.error {
  background: rgba(231, 111, 111, 0.15);
}

.modal-icon.error i {
  color: var(--app-accent-red);
  width: 24px;
  height: 24px;
}

.modal-icon.warning {
  background: rgba(244, 197, 66, 0.15);
}

.modal-icon.warning i {
  color: var(--app-accent-yellow);
  width: 24px;
  height: 24px;
}

/* Modal Title */
.modal-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--app-text-primary);
}

/* Modal Body */
.modal-body {
  padding: 20px;
}

/* Modal Footer */
.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--app-border-subtle);
  background: rgba(0, 41, 69, 0.3);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
}

/* Sybil-specific Modal Utilities */
.sybil-modal-overlay {
  background: rgba(0, 0, 0, 0.5);
}

.sybil-modal-max-height {
  max-height: calc(100vh - 5rem);
}

.sybil-modal-top {
  top: 4rem;
}

/* Modal Glow Effects */
.modal-glow-blue {
  box-shadow: 0 0 20px rgba(74, 159, 216, 0.3), 0 10px 40px rgba(0, 0, 0, 0.4);
  position: relative;
  z-index: 10;
}

.modal-glow-magenta {
  box-shadow: 0 0 20px rgba(184, 118, 192, 0.3), 0 10px 40px rgba(0, 0, 0, 0.4);
  position: relative;
  z-index: 10;
}

/* Modal Text Contrast */
.modal-glow-blue .text-app-text-primary,
.modal-glow-blue .text-primary,
.modal-glow-magenta .text-app-text-primary,
.modal-glow-magenta .text-primary {
  color: #FFFFFF; /* Pure white for maximum contrast on darker modal backgrounds */
}

.modal-glow-blue .text-app-text-secondary,
.modal-glow-blue .text-secondary,
.modal-glow-magenta .text-app-text-secondary,
.modal-glow-magenta .text-secondary {
  color: #C2E7FF; /* Light blue for secondary text */
}

.modal-glow-blue .text-app-text-tertiary,
.modal-glow-blue .text-tertiary,
.modal-glow-magenta .text-app-text-tertiary,
.modal-glow-magenta .text-tertiary {
  color: #8AB4CF; /* Medium blue for tertiary text */
}

/* Modal Labels */
.modal-glow-blue .form-label,
.modal-glow-magenta .form-label {
  color: #FFFFFF;
  font-weight: 500;
}

/* Modal Help Text */
.modal-glow-blue .form-help,
.modal-glow-magenta .form-help {
  color: #8AB4CF;
}

/* Modal Responsive Behavior */
@media (max-width: 768px) {
  .modal-content {
    max-width: 100%;
    border-radius: 16px 16px 0 0;
  }

  .modal-header {
    padding: 16px;
  }

  .modal-body {
    padding: 16px;
  }

  .modal-footer {
    padding: 12px 16px;
  }
}