/* ============================================================
 * Smile · Forms (Claude Design canon)
 * Components: form-field, checkbox, switch, radio
 * Spec: design_handoff_smile_v2/COMPONENTS.md §form-field, §switch
 *      design_handoff_smile_prestashop/02_styles_full.css
 *
 * Aliases legacy Bootstrap selectors to Claude Design styling without
 * touching templates: .form-control, .custom-checkbox, .custom-radio.
 * ============================================================ */

/* ============================================================
 * FORM-FIELD: label + input + error/hint stack
 * Markup canon:
 *   <div class="smile-form-field">
 *     <label class="smile-form-field__label" for="x">Label</label>
 *     <input class="smile-form-field__input" id="x" ...>
 *     <span class="smile-form-field__hint">Helper text</span>
 *     <span class="smile-form-field__error">Error text</span>
 *   </div>
 * ============================================================ */
.smile-form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  margin: 0 0 16px;
}
.smile-form-field__label,
.smile-form-field label {
  font-family: var(--f-body, Inter, sans-serif);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2, #6B6360);
  margin: 0;
}
.smile-form-field__label .req,
.smile-form-field__label[data-required="true"]::after {
  color: var(--burgundy, #6B2C2C);
  margin-left: 2px;
}
.smile-form-field__input,
.smile-form-field input,
.smile-form-field select,
.smile-form-field textarea {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line, #E8DFD6);
  border-radius: 10px;
  padding: 0 14px;
  font-family: var(--f-body, Inter, sans-serif);
  font-size: 15px;
  color: var(--ink, #2B2826);
  background: var(--bg, #F8F4F0);
  box-sizing: border-box;
  transition: border-color 0.15s, background 0.15s;
  outline: none;
}
.smile-form-field textarea {
  height: auto;
  min-height: 96px;
  padding: 12px 14px;
  resize: vertical;
  line-height: 1.5;
}
.smile-form-field__input:hover,
.smile-form-field input:hover { border-color: var(--ink-2, #6B6360); }
.smile-form-field__input:focus,
.smile-form-field input:focus,
.smile-form-field select:focus,
.smile-form-field textarea:focus {
  border-color: var(--ink, #2B2826);
  background: #fff;
}
.smile-form-field__hint,
.smile-form-field .hint {
  font-size: 12px;
  color: var(--ink-3, #9A928B);
  line-height: 1.4;
}
.smile-form-field__error,
.smile-form-field .error,
.smile-form-field.has-error .smile-form-field__input {
  color: var(--burgundy-deep, #501F1F);
}
.smile-form-field.has-error .smile-form-field__input,
.smile-form-field.has-error input { border-color: var(--burgundy, #6B2C2C); }
.smile-form-field__error { font-size: 12px; color: var(--burgundy-deep, #501F1F); }

/* ============================================================
 * Aliases para markup PrestaShop legacy
 * (no necesitamos cambiar .tpl — el styling Claude Design aplica)
 * ============================================================ */
.form-group .form-control-label,
.form-group label,
.form-control-label {
  font-family: var(--f-body, Inter, sans-serif) !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase !important;
  color: var(--ink-2, #6B6360) !important;
  margin: 0 0 6px !important;
  text-align: left !important;
  display: block !important;
}
.form-group .form-control-label.required::after,
.form-group label.required::after,
.form-control-label.required::after {
  content: " *" !important;
  color: var(--burgundy, #6B2C2C) !important;
}

input.form-control,
select.form-control,
textarea.form-control {
  font-family: var(--f-body, Inter, sans-serif) !important;
  font-size: 15px !important;
  color: var(--ink, #2B2826) !important;
  background: var(--bg, #F8F4F0) !important;
  border: 1px solid var(--line, #E8DFD6) !important;
  border-radius: 10px !important;
  height: 48px !important;
  padding: 0 14px !important;
  box-sizing: border-box !important;
  transition: border-color 0.15s, background 0.15s !important;
  outline: none !important;
  box-shadow: none !important;
}
textarea.form-control {
  height: auto !important;
  min-height: 96px !important;
  padding: 12px 14px !important;
  line-height: 1.5 !important;
}
input.form-control:hover,
select.form-control:hover,
textarea.form-control:hover { border-color: var(--ink-2) !important; }
input.form-control:focus,
select.form-control:focus,
textarea.form-control:focus {
  border-color: var(--ink, #2B2826) !important;
  background: #fff !important;
  box-shadow: none !important;
  outline: none !important;
}
input.form-control::placeholder,
textarea.form-control::placeholder {
  color: var(--ink-3, #9A928B) !important;
  opacity: 1;
}

/* Form-group spacing */
.form-group,
.form-group.row {
  margin: 0 0 16px !important;
  padding: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
}

/* Comments/hints inline */
.form-control-comment,
.form-control-comment span,
.form-text { font-size: 12px !important; color: var(--ink-3, #9A928B) !important; line-height: 1.4 !important; }

/* ============================================================
 * CHECKBOX — Claude Design (override .custom-checkbox)
 * ============================================================ */
.smile-checkbox,
.custom-checkbox {
  position: relative !important;
  display: inline-flex !important;
  align-items: flex-start !important;
  gap: 10px !important;
  cursor: pointer !important;
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
  border: 0 !important;
}
.smile-checkbox > input[type="checkbox"],
.custom-checkbox > input[type="checkbox"],
.custom-checkbox input[type="checkbox"].ps-shown-by-js {
  appearance: none !important;
  -webkit-appearance: none !important;
  width: 20px !important;
  height: 20px !important;
  min-width: 20px !important;
  border: 1.5px solid var(--line, #E8DFD6) !important;
  border-radius: 4px !important;
  background: #fff !important;
  cursor: pointer !important;
  position: relative !important;
  flex-shrink: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  vertical-align: top !important;
  transition: background 0.15s, border-color 0.15s !important;
}
.smile-checkbox > input[type="checkbox"]:hover,
.custom-checkbox > input[type="checkbox"]:hover { border-color: var(--ink-2, #6B6360) !important; }
.smile-checkbox > input[type="checkbox"]:checked,
.custom-checkbox > input[type="checkbox"]:checked {
  background: var(--ink, #2B2826) !important;
  border-color: var(--ink, #2B2826) !important;
}
.smile-checkbox > input[type="checkbox"]:checked::after,
.custom-checkbox > input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 6px;
  height: 11px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.smile-checkbox > input[type="checkbox"]:focus-visible,
.custom-checkbox > input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--burgundy, #6B2C2C) !important;
  outline-offset: 2px !important;
}

/* Hide legacy material-icons fallback span next to checkbox */
.custom-checkbox > input[type="checkbox"] + span > i.material-icons,
.custom-checkbox > input[type="checkbox"] + span > .checkbox-checked { display: none !important; }
/* If the legacy <span> wrapper is supposed to render the icon, force it hidden + ourselves draw */
.custom-checkbox > input[type="checkbox"] ~ span > i,
.custom-checkbox > input[type="checkbox"] ~ span > .checkbox-checked { display: none !important; }

/* Checkbox label */
.smile-checkbox > label,
.custom-checkbox > label,
.custom-checkbox span:not(:first-child) {
  font-family: var(--f-body, Inter, sans-serif) !important;
  font-size: 14px !important;
  color: var(--ink, #2B2826) !important;
  line-height: 1.5 !important;
  margin: 0 !important;
  cursor: pointer !important;
  flex: 1 1 auto !important;
  font-weight: 400 !important;
}

/* ============================================================
 * RADIO — Claude Design (override .custom-radio)
 * ============================================================ */
.smile-radio,
.custom-radio {
  position: relative !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 10px !important;
  cursor: pointer !important;
  background: transparent !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  float: none !important;
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
}
.smile-radio > input[type="radio"],
.custom-radio > input[type="radio"],
.custom-radio input[type="radio"].ps-shown-by-js {
  appearance: none !important;
  -webkit-appearance: none !important;
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  border: 1.5px solid var(--line, #E8DFD6) !important;
  border-radius: 50% !important;
  background: #fff !important;
  cursor: pointer !important;
  position: relative !important;
  flex-shrink: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  transition: border-color 0.15s !important;
}
.smile-radio > input[type="radio"]:hover,
.custom-radio > input[type="radio"]:hover { border-color: var(--ink-2) !important; }
.smile-radio > input[type="radio"]:checked,
.custom-radio > input[type="radio"]:checked {
  border-color: var(--ink, #2B2826) !important;
  background: #fff !important;
}
.smile-radio > input[type="radio"]:checked::after,
.custom-radio > input[type="radio"]:checked::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--ink, #2B2826);
}
.smile-radio > input[type="radio"]:focus-visible,
.custom-radio > input[type="radio"]:focus-visible {
  outline: 2px solid var(--burgundy, #6B2C2C) !important;
  outline-offset: 2px !important;
}

/* Hide legacy <span></span> sibling that PrestaShop renders next to the input */
.custom-radio > span:not(.address-alias):not(.sr-only) { display: none !important; }
.custom-radio > input[type="radio"] + span:empty { display: none !important; }

/* ============================================================
 * SWITCH — Claude Design (toggle slider)
 * Markup: <label class="smile-switch"><input type="checkbox"><span class="smile-switch__track"></span></label>
 * ============================================================ */
.smile-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 44px;
  height: 24px;
  cursor: pointer;
}
.smile-switch input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  opacity: 0;
}
.smile-switch__track {
  position: absolute;
  inset: 0;
  background: var(--line, #E8DFD6);
  border-radius: 999px;
  transition: background 0.18s var(--ease, ease);
}
.smile-switch__track::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s var(--ease, ease);
  box-shadow: 0 1px 3px rgba(43, 40, 38, 0.18);
}
.smile-switch input[type="checkbox"]:checked + .smile-switch__track {
  background: var(--ink, #2B2826);
}
.smile-switch input[type="checkbox"]:checked + .smile-switch__track::before {
  transform: translateX(20px);
}
.smile-switch input[type="checkbox"]:focus-visible + .smile-switch__track {
  outline: 2px solid var(--burgundy, #6B2C2C);
  outline-offset: 2px;
}

/* ============================================================
 * PASSWORD-STRENGTH meter (Claude Design canon)
 * Spec: design_handoff_smile_v2/COMPONENTS.md §password-strength
 *
 * Markup canon:
 *   <div class="smile-password-strength" data-strength="3">
 *     <div class="smile-password-strength__bar">
 *       <div class="smile-password-strength__fill"></div>
 *     </div>
 *     <span class="smile-password-strength__label">Buena</span>
 *   </div>
 *
 * Data-strength: 0 (vacío), 1 (débil), 2 (regular), 3 (buena), 4 (fuerte)
 *
 * Override de PS legacy `.ps-password-policy-feedback-container`.
 * ============================================================ */
.smile-password-strength,
.ps-password-policy-feedback-container {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  margin-top: 6px !important;
  font-family: var(--f-body, Inter, sans-serif) !important;
}
.smile-password-strength__bar,
.password-strength-meter,
.progress-password-strength {
  display: block !important;
  width: 100% !important;
  flex: 1 1 auto !important;
  height: 4px !important;
  background: var(--line, #E8DFD6) !important;
  border-radius: 999px !important;
  overflow: hidden !important;
  position: relative !important;
  margin: 0 !important;
}
.smile-password-strength__fill,
.password-strength-meter .progress-bar,
.progress-password-strength .progress-bar {
  display: block;
  height: 100% !important;
  width: 0%;
  background: var(--burgundy, #6B2C2C) !important;
  transition: width 0.25s var(--ease, ease), background-color 0.2s !important;
  border-radius: 999px !important;
}
.smile-password-strength[data-strength="0"] .smile-password-strength__fill { width: 0%; }
.smile-password-strength[data-strength="1"] .smile-password-strength__fill { width: 25%; background: #C84A3A !important; }
.smile-password-strength[data-strength="2"] .smile-password-strength__fill { width: 50%; background: var(--champagne, #B8924F) !important; }
.smile-password-strength[data-strength="3"] .smile-password-strength__fill { width: 75%; background: #5BA15C !important; }
.smile-password-strength[data-strength="4"] .smile-password-strength__fill { width: 100%; background: #2E5C3F !important; }

.smile-password-strength__label,
.password-strength-text {
  font-size: 12px !important;
  font-weight: 500 !important;
  color: var(--ink-2, #6B6360) !important;
  white-space: nowrap !important;
  font-variant-numeric: tabular-nums !important;
}
