/* Custom Crafted Modal Styles */

/* Modal backdrop */
.customcrafted-modal::backdrop {
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

/* Ensure modal is scrollable on mobile */
@media (max-width: 768px) {
  .customcrafted-modal {
    max-height: 95vh;
    margin: 2.5vh auto;
    max-width: calc(100% - 32px);
  }

  .customcrafted-modal .selection-option {
    min-height: auto;
  }
}

/* Selection option hover state */
.selection-option.selected {
  /* border-color: #466587; */
  background-color: #e8eaec;
}

/* File upload hover state */
#file-drop-zone.drag-over {
  border-color: #466587;
  background-color: #f6f6f6;
}

/* ==================== Dynamic Content (Description + Estimated Time) ==================== */
/* Hide both content sections by default */
.dynamic-content {
  display: none;
}

/* Show custom content when custom option is selected */
.customcrafted-modal:has(.selection-option[data-option="custom"].selected)
  #custom-content {
  display: block;
}

/* Show CAD content when CAD option is selected */
.customcrafted-modal:has(.selection-option[data-option="cad"].selected)
  #cad-content {
  display: block;
}

/* Default: show custom content if no selection (fallback) */
.customcrafted-modal:not(:has(.selection-option.selected)) #custom-content {
  display: block;
}

/* ==================== Form Validation Styles ==================== */

/* Invalid feedback message - hidden by default */
.invalid-feedback {
  display: none;
  align-items: center;
  gap: 6px;
  color: #d31212;
  font-size: 13px;
  font-family: "Lato", sans-serif;
  margin-top: -4px;
}

.invalid-feedback::before {
  content: "";
  display: inline-block;
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  background-image: url("/static/assets/image/icon/error.svg");
  background-size: contain;
  background-repeat: no-repeat;
}

/* Show feedback when field is invalid */
.is-invalid + .invalid-feedback,
.is-invalid ~ .invalid-feedback {
  display: flex;
}

/* Invalid input/dropzone border */
input.is-invalid,
textarea.is-invalid,
select.is-invalid,
.is-invalid#file-drop-zone,
.is-invalid#cad-file-drop-zone {
  border-color: #d31212 !important;
}

/* Valid input border (optional - subtle green) */
/* input.is-valid,
textarea.is-valid,
select.is-valid {
  border-color: #28a745 !important;
} */

/* ==================== Disabled Input/Select Styles ==================== */
input:disabled,
textarea:disabled,
select:disabled {
  background-color: #f6f6f6 !important;
  color: #9ca3af !important;
  cursor: not-allowed !important;
  opacity: 0.6;
  border-color: #e5e7eb !important;
}

select:disabled {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%239ca3af' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E") !important;
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
  padding-right: 2.5rem;
}

/* Disabled label styling */
label:has(+ input:disabled),
label:has(+ select:disabled),
label:has(+ textarea:disabled) {
  color: #9ca3af;
  cursor: not-allowed;
}

/* ==================== Loading Overlay ==================== */
.modal-loading-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(4px);
  z-index: 100;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
}

.modal-loading-overlay.active {
  display: flex;
}

.modal-loading-overlay img {
  width: 80px;
  height: 80px;
  filter: invert(32%) sepia(15%) saturate(1200%) hue-rotate(175deg)
    brightness(90%) contrast(88%);
  /* Makes white SVG into #466587 color */
}

.modal-loading-overlay span {
  font-family: "Lato", sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: #466587;
}
