/* ===== FORMS - Clube da Hora ===== */
/* Elementos de formulário: inputs, selects, checkboxes, radios */

/* ===== FORM GROUPS ===== */

.form-group {
  margin-bottom: 1rem;
}

.form-group:last-child {
  margin-bottom: 0;
}

/* ===== LABELS ===== */

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.form-label.required::after {
  content: ' *';
  color: var(--danger);
}

/* ===== INPUTS ===== */

.form-control {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  font-family: inherit;
  line-height: 1.5;
  color: var(--gray-900);
  background: var(--white);
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-md);
  transition: var(--transition-base);
  appearance: none;
}

.form-control:hover:not(:disabled) {
  border-color: var(--gray-400);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.1);
  background: var(--white);
}

.form-control::placeholder {
  color: var(--gray-400);
  font-weight: 400;
}

.form-control:disabled {
  background: var(--gray-100);
  color: var(--gray-500);
  cursor: not-allowed;
  opacity: 0.6;
}

/* Input com erro */
.form-control.is-invalid {
  border-color: var(--danger);
}

.form-control.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Textarea */
textarea.form-control {
  min-height: 100px;
  resize: vertical;
}

/* ===== SELECT ===== */

.form-select,
select.form-control {
  width: 100%;
  padding: 0.625rem 2.5rem 0.625rem 0.875rem;
  font-size: 0.875rem;
  font-family: inherit;
  line-height: 1.5;
  color: var(--gray-900);
  background: var(--white) url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e") no-repeat right 0.75rem center;
  background-size: 16px 16px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-md);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  transition: var(--transition-base);
}

.form-select:hover:not(:disabled),
select.form-control:hover:not(:disabled) {
  border-color: var(--gray-400);
}

.form-select:focus,
select.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.1);
}

.form-select:disabled,
select.form-control:disabled {
  background-color: var(--gray-100);
  color: var(--gray-500);
  cursor: not-allowed;
  opacity: 0.6;
}

/* ===== CHECKBOX E RADIO ===== */

.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.form-check-input {
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--gray-300);
  border-radius: 4px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  position: relative;
  transition: var(--transition-fast);
  flex-shrink: 0;
  background: var(--white);
}

.form-check-input:hover:not(:disabled) {
  border-color: var(--gray-400);
}

.form-check-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.1);
}

.form-check-input:checked {
  background: var(--primary);
  border-color: var(--primary);
}

.form-check-input:checked::after {
  content: '';
  display: block;
  position: absolute;
  left: 6.5px;
  top: 3px;
  width: 4px;
  height: 9px;
  border: solid var(--white);
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}

.form-check-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Radio button */
.form-check-input[type="radio"] {
  border-radius: var(--radius-full);
}

.form-check-input[type="radio"]:checked::after {
  left: 5px;
  top: 5px;
  width: 6px;
  height: 6px;
  border: none;
  background: var(--white);
  border-radius: var(--radius-full);
  transform: none;
}

.form-check-label {
  font-size: 0.875rem;
  color: var(--gray-700);
  cursor: pointer;
  user-select: none;
  line-height: 1.4;
  margin: 0;
}

.form-check-input:disabled+.form-check-label {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== MENSAGENS DE ERRO ===== */

.error-message {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-top: 0.375rem;
  font-size: 0.8125rem;
  color: var(--danger);
  font-weight: 500;
}

.error-message i {
  font-size: 0.875rem;
  flex-shrink: 0;
}

.invalid-feedback {
  display: block;
  margin-top: 0.375rem;
  font-size: 0.8125rem;
  color: var(--danger);
  font-weight: 500;
}

/* ===== FORM TEXT (HELPER) ===== */

.form-text {
  display: block;
  margin-top: 0.375rem;
  font-size: 0.8125rem;
  color: var(--gray-500);
  line-height: 1.4;
}

/* ===== INPUT GROUPS ===== */

.input-group {
  display: flex;
  width: 100%;
}

.input-group .form-control,
.input-group .form-select {
  border-radius: 0;
  flex: 1;
}

.input-group .form-control:first-child,
.input-group .form-select:first-child {
  border-top-left-radius: var(--radius-md);
  border-bottom-left-radius: var(--radius-md);
}

.input-group .form-control:last-child,
.input-group .form-select:last-child {
  border-top-right-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
}

.input-group-text {
  display: flex;
  align-items: center;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-700);
  background: var(--gray-100);
  border: 1.5px solid var(--gray-300);
  white-space: nowrap;
}

.input-group .input-group-text:first-child {
  border-top-left-radius: var(--radius-md);
  border-bottom-left-radius: var(--radius-md);
  border-right: none;
}

.input-group .input-group-text:last-child {
  border-top-right-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
  border-left: none;
}

/* ===== FLOATING LABELS (OPCIONAL) ===== */

.form-floating {
  position: relative;
}

.form-floating>.form-control,
.form-floating>.form-select {
  padding: 1rem 0.875rem 0.375rem;
}

.form-floating>label {
  position: absolute;
  top: 0;
  left: 0;
  padding: 1rem 0.875rem;
  pointer-events: none;
  color: var(--gray-400);
  transition: var(--transition-base);
  transform-origin: 0 0;
}

.form-floating>.form-control:focus~label,
.form-floating>.form-control:not(:placeholder-shown)~label,
.form-floating>.form-select~label {
  opacity: 0.65;
  transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem);
}