/* Modal chính */
#addDescendantModal.modal-descendant {
  position: fixed;
  z-index: 1000;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  font-family: "Inter", Helvetica, Arial, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 20px;
}

/* Nội dung modal */
#addDescendantModal .modal-content-descendant {
  background: #ffffff;
  color: #1a1a1a;
  margin: auto;
  padding: 24px;
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  position: relative;
}

/* Nút đóng */
#addDescendantModal .close-descendant {
  position: absolute;
  top: 16px;
  right: 16px;
  color: #4b5563;
  font-size: 24px;
  font-weight: 500;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

#addDescendantModal .close-descendant:hover {
  background-color: #f3f4f6;
  color: #2563eb;
}

/* Icon thông tin */
#addDescendantModal .info-icon {
  position: absolute;
  top: 16px;
  left: 16px;
  font-size: 18px;
  color: #2563eb;
  cursor: pointer;
 text-decoration: none;
 font-weight: bolder;
  width: auto;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

#addDescendantModal .info-icon:hover {
  background-color: #f3f4f6;
}

/* Hộp thông tin */
#addDescendantModal .info-box {
  position: absolute;
  top: 48px;
  left: 16px;
  margin-left: 20px;
  background: #ffffff;
  border: 1px solid #0c017b;
  border-radius: 0 8px 8px 8px;
  padding: 12px;
  font-size: 13px;
  text-align: justify;
  color: #4b5563;
  width: 90%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  z-index: 1001;
}

/* Văn bản highlight trong info-box */
#addDescendantModal .info-box .highlight {
  color: #2563eb;
  font-weight: 600;
}

/* Tiêu đề phía trên */
#addDescendantModal .modal-title-top {
  text-align: center;
  color: #4b5563;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  padding-top: 24px;
}

/* Tiêu đề chính */
#addDescendantModal .modal-title {
  text-align: center;
  color: #2563eb;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
}

/* Form bên trong modal */
#addDescendantModal .form-descendant {
  display: grid;
  gap: 16px;
}

/* Nhóm form cơ bản */
#addDescendantModal .form-descendant .form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Container cho các field nằm cùng hàng */
#addDescendantModal .form-descendant .form-group-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Các form-group có class half-width */
#addDescendantModal .form-descendant .form-group.half-width {
  flex: 1;
}

/* Các form-group có class full-width */
#addDescendantModal .form-descendant .form-group.full-width {
  grid-column: 1 / -1;
}

/* Label trong form */
#addDescendantModal .form-descendant label {
  font-size: 13px;
  font-weight: 500;
  color: #374151;
}

/* Input và select trong form */
#addDescendantModal .form-descendant input,
#addDescendantModal .form-descendant select {
  height: 42px;
  width: 100%;
  padding: 0 12px;
  font-size: 14px;
  color: #1a1a1a;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background-color: #f9fafb;
  transition: all 0.2s ease;
}

/* Input ngày mất */
#addDescendantModal .form-descendant #death_date {
  height: 42px;
  padding: 0 12px;
  font-size: 14px;
  color: #1a1a1a;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background-color: #f9fafb;
}

/* Trạng thái focus cho input và select */
#addDescendantModal .form-descendant input:focus,
#addDescendantModal .form-descendant select:focus {
  border-color: #2563eb;
  background-color: #ffffff;
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Button trong form */
#addDescendantModal .form-descendant #submitButton {
  width: 100%;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  background-color: #2563eb;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

/* Trạng thái hover cho button */
#addDescendantModal .form-descendant #submitButton:hover {
  background-color: #1d4ed8;
}

/* Trạng thái loading của button */
#addDescendantModal .form-descendant .button-loading {
  opacity: 0.7;
  cursor: not-allowed;
  position: relative;
}

/* Hiệu ứng loading */
#addDescendantModal .form-descendant .button-loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  border: 2px solid #ffffff;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 1s linear infinite;
}

/* Button bị vô hiệu hóa */
#addDescendantModal .form-descendant button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Select2 */
.select2-container {
  width: 100% !important;
}

.select2-container .select2-selection--single {
  height: 42px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background-color: #f9fafb;
}

.select2-container--default
  .select2-selection--single
  .select2-selection__rendered {
  line-height: 42px;
  color: #1a1a1a;
  padding-left: 12px;
}

.select2-container--default
  .select2-selection--single
  .select2-selection__arrow {
  height: 40px;
  right: 8px;
}

.select2-container--default
  .select2-selection--single
  .select2-selection__clear {
  color: #4b5563;
  font-size: 16px;
  margin-right: 8px;
}

.select2-container--default
  .select2-selection--single
  .select2-selection__clear:hover {
  color: #2563eb;
}

.select2-dropdown {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background-color: #ffffff;
  z-index: 1001;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.select2-results__option {
  padding: 8px 12px;
  font-size: 14px;
}

.select2-results__option--highlighted {
  background-color: #f3f4f6;
}

/* Note cho Cha/Mẹ */
.note-ancestor {
  font-size: 12px;
  color: #991b1b;
  margin-top: 8px;
  text-align: center;
}
.success-container {
  text-align: center;
  margin: 15px 0;
  padding: 15px;
  border: 1px solid #28a745;
  border-radius: 5px;
  background-color: #e6ffed;
  position: relative;
}
.success-message {
  color: #28a745;
  font-size: 20px;
  margin-bottom: 10px;
  font-weight: bold;
}
.success-instruction {
  color: #082cad;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 10px;
}
.success-ok-button {
  width: 100%;
  padding: 10px;
  background-color: #28a745;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
  margin-top: 10px;
}
.success-ok-button:hover {
  background-color: #218838;
}
.guide-gif {
  display: block;
  margin: 10px auto;
  max-width: 90%;
  height: auto;
}
/* Media query cho màn hình nhỏ */
@media (max-width: 640px) {
  #addDescendantModal .modal-content-descendant {
    max-width: 90%;
    padding: 16px;
  }

  #addDescendantModal .form-descendant .form-group-row {
    grid-template-columns: 1fr;
  }

  #addDescendantModal .form-descendant .form-group.half-width {
    grid-column: 1 / -1;
  }

  #addDescendantModal .close-descendant,
  #addDescendantModal .info-icon {
    width: auto;
    height: 28px;
    font-size: 20px;
  }

  #addDescendantModal .info-box {
    width: 90%;
    top: 40px;
    left: 12px;
  }

  .select2-container .select2-selection--single {
    height: 38px;
  }

  .select2-container--default
    .select2-selection--single
    .select2-selection__rendered {
    line-height: 38px;
  }

  .select2-container--default
    .select2-selection--single
    .select2-selection__arrow {
    height: 36px;
  }

  #guideModal .guide-content {
    max-width: 90%;
    padding: 16px;
  }
}

@keyframes spin {
  to {
    transform: translateY(-50%) rotate(360deg);
  }
}
