/* Modal Component System */

/* Modal Backdrop */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: var(--z-index-modal);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-backdrop.show {
  opacity: 1;
  visibility: visible;
}

/* Modal Container */
.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.7);
  background-color: var(--white);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--box-shadow-card);
  z-index: var(--z-index-tooltip);
  max-width: 90%;
  width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  transition: all 0.3s ease;
  opacity: 0;
  visibility: hidden;
}

.modal.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

/* Modal Header */
.modal-header {
  padding: var(--spacing-xl) var(--spacing-xl) var(--spacing-md);
  border-bottom: 1px solid var(--gray-light);
  text-align: center;
}

.modal-title {
  font-family: var(--font-primary);
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-large);
  color: var(--black);
  margin: 0;
  line-height: var(--line-height-tight);
}

.modal-subtitle {
  font-family: var(--font-primary);
  font-weight: var(--font-weight-medium);
  font-size: var(--font-size-medium);
  color: var(--primary-blue);
  margin: var(--spacing-xs) 0 0;
}

/* Modal Body */
.modal-body {
  padding: var(--spacing-xl);
  text-align: center;
}

.modal-body p {
  font-family: var(--font-primary);
  font-weight: var(--font-weight-regular);
  font-size: var(--font-size-medium);
  color: #555;
  line-height: var(--line-height-relaxed);
  margin-bottom: var(--spacing-md);
}

.modal-body .highlight {
  font-weight: var(--font-weight-semibold);
  color: var(--primary-blue);
}

.modal-body .badge-text {
  font-weight: var(--font-weight-semibold);
  color: var(--success-green);
}

/* Modal Footer */
.modal-footer {
  padding: var(--spacing-md) var(--spacing-xl) var(--spacing-xl);
  display: flex;
  gap: var(--spacing-md);
  justify-content: center;
}

/* Modal Buttons */
.modal-btn {
  padding: var(--spacing-md) var(--spacing-xl);
  border-radius: var(--border-radius-sm);
  font-family: var(--font-primary);
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-medium);
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  min-width: 140px;
  border: none;
}

.modal-btn-primary {
  background-color: var(--primary-blue);
  color: var(--white);
}

.modal-btn-primary:hover {
  background-color: var(--dark-navy);
  transform: translateY(-2px);
}

.modal-btn-secondary {
  background-color: transparent;
  color: var(--black);
  border: 2px solid var(--gray-light);
}

.modal-btn-secondary:hover {
  border-color: var(--black);
  background-color: var(--form-bg);
}

/* Close Button */
.modal-close {
  position: absolute;
  top: var(--spacing-md);
  right: var(--spacing-md);
  background: rgba(108, 117, 125, 0.1);
  border: 1px solid rgba(108, 117, 125, 0.2);
  border-radius: 50%;
  border: none;
  font-size: var(--font-size-large);
  color: var(--gray-light);
  cursor: pointer;
  padding: var(--spacing-xs);
  transition: all 0.3s ease;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: var(--black);
  background-color: var(--form-bg);
  border-radius: 50%;
}

/* Modal Icons */
.modal-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--spacing-md);
  background-color: var(--form-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}

.modal-icon.success {
  background-color: rgba(191, 218, 164, 0.2);
  color: var(--success-green);
}

.modal-icon.primary {
  background-color: rgba(85, 152, 233, 0.2);
  color: var(--primary-blue);
}

/* Specific Modal Types */

/* Background Check Modal */
.background-check-modal .modal-icon {
  background-color: rgba(85, 152, 233, 0.2);
  color: var(--primary-blue);
}

.background-check-modal .modal-title {
  color: var(--primary-blue);
}

/* Identity Verification Modal */
.identity-verification-modal .modal-icon {
  background-color: rgba(191, 218, 164, 0.2);
  color: var(--success-green);
}

.identity-verification-modal .modal-title {
  color: var(--success-green);
}

/* Welcome Message */
.welcome-text {
  font-family: var(--font-primary);
  font-weight: var(--font-weight-medium);
  font-size: var(--font-size-base);
  color: var(--black);
  margin-bottom: var(--spacing-lg);
}

.welcome-name {
  color: var(--primary-blue);
  font-weight: var(--font-weight-bold);
}

/* Modal Footer Note */
.modal-note {
  font-family: var(--font-primary);
  font-size: var(--font-size-small);
  color: #888;
  font-style: italic;
  margin-top: var(--spacing-md);
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--gray-light);
  text-align: center;
}

/* Loading State */
.modal.loading .modal-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 150px;
}

.modal-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--gray-light);
  border-top: 4px solid var(--primary-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: var(--spacing-md);
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Responsive Modal */
@media (max-width: 768px) {
  .modal {
    width: 95%;
    max-width: 400px;
    margin: var(--spacing-md);
  }
  
  .modal-header {
    padding: var(--spacing-lg) var(--spacing-md) var(--spacing-md);
  }
  
  .modal-body {
    padding: var(--spacing-md);
  }
  
  .modal-footer {
    padding: var(--spacing-md);
    flex-direction: column;
  }
  
  .modal-btn {
    width: 100%;
    margin-bottom: var(--spacing-xs);
  }
  
  .modal-title {
    font-size: var(--font-size-base);
  }
  
  .modal-icon {
    width: 60px;
    height: 60px;
    font-size: 2rem;
  }
}

@media (max-width: 480px) {
  .modal {
    width: 98%;
    max-height: 95vh;
  }
  
  .modal-header {
    padding: var(--spacing-md) var(--spacing-md) var(--spacing-sm);
  }
  
  .modal-body {
    padding: var(--spacing-sm) var(--spacing-md);
  }
  
  .modal-footer {
    padding: var(--spacing-sm) var(--spacing-md) var(--spacing-md);
  }
}

/* Animation Classes */
.modal-enter {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.7);
}

.modal-enter-active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  transition: all 0.3s ease;
}

.modal-exit {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.modal-exit-active {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.7);
  transition: all 0.3s ease;
}
