/* Modal Styling - XMAX CRM */

/* Overlay */
.xmax-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Modal Container */
.xmax-modal {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  max-width: 500px;
  width: 90%;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Modal Header */
.xmax-modal-header {
  padding: 20px;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #f9f9f9, #ffffff);
}

.xmax-modal-header-title {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.xmax-modal-header-title i {
  font-size: 20px;
  color: #1e3a8a;
  width: 24px;
  text-align: center;
}

.xmax-modal-header-title h5 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

.xmax-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #999;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s;
}

.xmax-modal-close:hover {
  background: #f0f0f0;
  color: #333;
}

/* Modal Body */
.xmax-modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  color: #666;
  font-size: 14px;
}

.xmax-modal-body p {
  margin: 0 0 12px 0;
  line-height: 1.5;
}

.xmax-modal-body p:last-child {
  margin-bottom: 0;
}

/* Modal Footer */
.xmax-modal-footer {
  padding: 16px 20px;
  border-top: 1px solid #f0f0f0;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  background: #fafafa;
}

/* Modal Buttons */
.xmax-modal-btn {
  padding: 8px 20px;
  border-radius: 6px;
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.xmax-modal-btn-primary {
  background: #1e3a8a;
  color: #fff;
}

.xmax-modal-btn-primary:hover {
  background: #152a5f;
  box-shadow: 0 4px 12px rgba(30, 58, 138, 0.3);
}

.xmax-modal-btn-secondary {
  background: #f0f0f0;
  color: #333;
  border: 1px solid #e0e0e0;
}

.xmax-modal-btn-secondary:hover {
  background: #e8e8e8;
}

.xmax-modal-btn-danger {
  background: #ffebee;
  color: #ff6b35;
  border: 1px solid #ffccbc;
}

.xmax-modal-btn-danger:hover {
  background: #ffccbc;
}

.xmax-modal-btn-success {
  background: #e8f5e9;
  color: #32cd32;
  border: 1px solid #c8e6c9;
}

.xmax-modal-btn-success:hover {
  background: #c8e6c9;
}

/* Form Elements in Modal */
.xmax-modal-form-group {
  margin-bottom: 16px;
}

.xmax-modal-form-group:last-child {
  margin-bottom: 0;
}

.xmax-modal-form-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: #333;
  font-size: 13px;
}

.xmax-modal-form-input,
.xmax-modal-form-textarea,
.xmax-modal-form-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  transition: all 0.2s;
}

.xmax-modal-form-input:focus,
.xmax-modal-form-textarea:focus,
.xmax-modal-form-select:focus {
  outline: none;
  border-color: #1e3a8a;
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

.xmax-modal-form-textarea {
  resize: vertical;
  min-height: 100px;
}

/* Modal Sizes */
.xmax-modal.xmax-modal-sm {
  max-width: 380px;
}

.xmax-modal.xmax-modal-lg {
  max-width: 700px;
}

.xmax-modal.xmax-modal-xl {
  max-width: 900px;
}

/* Alert Modals */
.xmax-modal-alert {
  text-align: center;
}

.xmax-modal-alert-icon {
  font-size: 48px;
  margin-bottom: 16px;
  display: block;
}

.xmax-modal-alert-title {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
}

.xmax-modal-alert-message {
  color: #666;
  margin-bottom: 20px;
  line-height: 1.5;
}

/* Loading State */
.xmax-modal-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #1e3a8a;
  font-size: 14px;
}

.xmax-modal-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #f0f0f0;
  border-top-color: #1e3a8a;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 640px) {
  .xmax-modal {
    max-width: 95%;
    max-height: 90vh;
  }

  .xmax-modal-header {
    padding: 16px;
  }

  .xmax-modal-body {
    padding: 16px;
  }

  .xmax-modal-footer {
    padding: 12px 16px;
    flex-direction: column-reverse;
  }

  .xmax-modal-btn {
    width: 100%;
    justify-content: center;
  }
}
