/* ================================================================
   Custom Fields Box — scoped under #custom_fields_box
   ================================================================ */

/* Hide separators */
#custom_fields_box .custom-field-separator {
  display: none !important;
}

/* ── Field wrapper reset ───────────────────────────────────────── */
#custom_fields_box .form-group {
  margin-bottom: 0;
  width: 100%;
}

/* ── Primary color text ─────────────────────────────────────────── */
#custom_fields_box .text-color-primary {
  color: #121212 !important;
  font-size: 12px;
  font-weight: bold;
}

/* ── Required asterisk ──────────────────────────────────────────── */
#custom_fields_box small[style*="color: red"] {
  color: #EF4444 !important;
  font-size: 12px;
  font-weight: 700;
}

/* ── Hint text in label ─────────────────────────────────────────── */
#custom_fields_box label > small:not([style]) {
  color: #9CA3AF;
  font-size: 12px;
  font-weight: 400;
}

/* ================================================================
   LABEL — shared
   ================================================================ */
#custom_fields_box .input-label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px;
  margin-bottom: 12px;
}

/* ================================================================
   INPUTS — text / number / date / time / textarea
   ================================================================ */
#custom_fields_box .input-text .form-control {
  width: 100%;
  height: 42px;
  padding: 10px 12px;
  font-size: 12px;
  color: #191919;
  background: #fff;
  border: 1.5px solid #E5E0DA;
  border-radius: 4px;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
  font-family: inherit;
  box-sizing: border-box;
}

#custom_fields_box .input-text .form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(110, 90, 74, 0.1);
}

#custom_fields_box .input-text .form-control::placeholder {
  color: #B7A99B;
  font-weight: 400;
}

#custom_fields_box .input-text textarea.form-control {
  height: auto;
  min-height: 110px;
  padding: 12px 14px;
  resize: vertical;
}

#custom_fields_box input[type="date"],
#custom_fields_box input[type="time"] {
  cursor: pointer;
}

#custom_fields_box input[type="date"]::-webkit-calendar-picker-indicator,
#custom_fields_box input[type="time"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.5;
}

/* ================================================================
   DROPDOWN / SELECT
   ================================================================ */
#custom_fields_box #product-custom-user-dropdown-fields .form-group > div > label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-bottom: 12px;
  cursor: default;
}

#custom_fields_box #product-custom-user-dropdown-fields select.form-control {
  width: 100%;
  height: 42px;
  font-size: 12px;
  color: #191919;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6L8 10L12 6' stroke='%236B7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 10px center;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  border: 1.5px solid #E5E0DA;
  border-radius: 4px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.18s, box-shadow 0.18s;
  font-family: inherit;
  box-sizing: border-box;
}

#custom_fields_box #product-custom-user-dropdown-fields select.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(110, 90, 74, 0.1);
}

/* RTL: arrow on right */
[dir="rtl"] #custom_fields_box #product-custom-user-dropdown-fields select.form-control,
.rtl #custom_fields_box #product-custom-user-dropdown-fields select.form-control {
  padding: 10px 12px;
}

/* ================================================================
   CHECKBOX GROUP
   ================================================================ */

/* Section title label */
#custom_fields_box #product-custom-user-option-fields > label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  font-weight: 600;
  color: #191919;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #F0EBE4;
  cursor: default;
}

/* Each option row */
#custom_fields_box #product-custom-user-option-fields .form-group {
  margin-bottom: 8px;
}

#custom_fields_box #product-custom-user-option-fields .form-group:last-child {
  margin-bottom: 0;
}

#custom_fields_box #product-custom-user-option-fields .form-group > label {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 12px 14px !important;
  border-radius: 8px !important;
  border: 1.5px solid #E5E0DA !important;
  background: #FAFAF9 !important;
  cursor: pointer !important;
  margin-bottom: 0 !important;
  transition: border-color 0.18s, background-color 0.18s;
  font-weight: 400 !important;
  font-size: 14px;
  color: #191919;
}

#custom_fields_box #product-custom-user-option-fields .form-group > label:hover {
  border-color: var(--primary-color) !important;
  background: #FBF7F3 !important;
}

/* Checked state on parent label (set via JS class) */
#custom_fields_box #product-custom-user-option-fields .form-group > label.cf-checked {
  border-color: var(--primary-color) !important;
  background: #FBF7F3 !important;
}

/* Checkbox container */
#custom_fields_box .checkbox-container {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

/* Hide native input */
#custom_fields_box .checkbox-container .checkbox {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}

/* Custom checkmark box */
#custom_fields_box .custom-checkmark {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 20px !important;
  height: 20px !important;
  border-radius: 2px !important;
  border: 1.5px solid #D1CED2 !important;
  background: #fff !important;
  position: static !important;
  right: auto !important;
  top: auto !important;
  transition: background-color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

/* Checked state */
#custom_fields_box .checkbox-container .checkbox:checked + .custom-checkmark {
  background: var(--primary-color) !important;
  border-color: var(--primary-color) !important;
}

/* Checkmark tick via JS-injected SVG or ::after */
#custom_fields_box .custom-checkmark::after {
  content: '';
  display: block;
  width: 10px;
  height: 6px;
  border-left: 2px solid transparent;
  border-bottom: 2px solid transparent;
  transform: rotate(-45deg) translateY(-1px);
  transition: border-color 0.15s;
}

#custom_fields_box .checkbox-container .checkbox:checked + .custom-checkmark::after {
  border-left-color: #fff !important;
  border-bottom-color: #fff !important;
  /* override icomoon content */
  font-family: initial !important;
  font-size: 0 !important;
  position: static !important;
  top: auto !important;
}

/* Override icomoon icon on checked */
#custom_fields_box #product-custom-user-option-fields input:checked + span:after {
  content: '' !important;
  font-family: initial !important;
  font-size: 0 !important;
  position: static !important;
  top: auto !important;
}

/* Checkbox label text */
#custom_fields_box .custom-checkbox-label {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  font-size: 14px;
  color: #191919;
  line-height: 1.4;
  user-select: none;
}

/* ================================================================
   FILE / IMAGE UPLOAD
   ================================================================ */

/* Remove default form-control styling from file wrapper */
#custom_fields_box .form-group > .form-control {
  border: none !important;
  padding: 0 !important;
  background: transparent !important;
  height: auto !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

/* File label container */
#custom_fields_box .file-label {
  display: flex !important;
  align-items: center !important;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 4px;
  border: 1px solid #E5E0DA;
  background: white;
  cursor: pointer;
  transition: border-color 0.18s, background-color 0.18s;
  height: 42px;
  box-sizing: border-box;
}

#custom_fields_box .file-label:hover {
  border-color: var(--primary-color) !important;
  background: #FBF7F3;
}

/* File name / hint */
#custom_fields_box [id^="file-name-"] {
  flex: 1;
  font-size: 13px;
  color: #9CA3AF;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Preview image */
#custom_fields_box [id^="file-preview-"] img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #E5E0DA;
}

/* Delete button — icon only, no background */
#custom_fields_box [id^="file-delete-"] {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: none;
  border: none;
  padding: 0;
  color: #EF4444;
  opacity: 0.7;
  transition: opacity 0.15s;
}

#custom_fields_box [id^="file-delete-"]:hover {
  opacity: 1;
}

/* Upload button — "إرفق" (text set via JS) */
#custom_fields_box button[id^="file-upload-"] {
  flex-shrink: 0;
  width: 58px;
  height: 42px;
  background: var(--primary-color);
  color: #fff;
  border: none;
  border-radius: 4px 0 0 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
  font-family: inherit;
  line-height: 1;
  margin: -12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#custom_fields_box button[id^="file-upload-"]:hover {
  opacity: 0.85;
}
