/**
 * THE CONNECTED HAVEN - FORM STYLES
 *
 * Additional form-related styles
 *
 * @package Blocksy_Child_TCH
 * @version 1.0.0
 */

/* ==========================================================================
   FORM MESSAGES
   ========================================================================== */

.tch-form-message {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  margin-top: var(--space-md);
  border-radius: var(--radius-lg);
  font-size: 0.9375rem;
  animation: tch-slide-up 0.3s ease;
}

.tch-form-message--success {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.tch-form-message--error {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.tch-form-message svg {
  flex-shrink: 0;
}

@keyframes tch-slide-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   SPINNER
   ========================================================================== */

.tch-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: tch-spin 0.8s linear infinite;
}

@keyframes tch-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   FORM VALIDATION STATES
   ========================================================================== */

.tch-input--error {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

.tch-input--success {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1) !important;
}

/* ==========================================================================
   FORM GROUPS
   ========================================================================== */

.tch-form-group {
  margin-bottom: var(--space-lg);
}

.tch-form-group__label {
  display: block;
  margin-bottom: var(--space-sm);
  font-weight: 600;
  color: var(--tch-dark);
}

.tch-form-group__label .required {
  color: #ef4444;
}

.tch-form-group__help {
  margin-top: var(--space-xs);
  font-size: 0.8125rem;
  color: var(--tch-muted);
}

.tch-form-group__error {
  margin-top: var(--space-xs);
  font-size: 0.8125rem;
  color: #ef4444;
}

/* ==========================================================================
   CHECKBOX & RADIO
   ========================================================================== */

.tch-checkbox,
.tch-radio {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  cursor: pointer;
}

.tch-checkbox input,
.tch-radio input {
  width: 18px;
  height: 18px;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--tch-primary);
}

.tch-checkbox__label,
.tch-radio__label {
  font-size: 0.9375rem;
  line-height: 1.5;
}

/* ==========================================================================
   SELECT
   ========================================================================== */

.tch-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

/* ==========================================================================
   RANGE SLIDER
   ========================================================================== */

.tch-range {
  appearance: none;
  width: 100%;
  height: 8px;
  background: var(--tch-light);
  border-radius: var(--radius-full);
  outline: none;
}

.tch-range::-webkit-slider-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  background: var(--tch-primary);
  border-radius: 50%;
  cursor: pointer;
  transition: transform var(--transition-base);
}

.tch-range::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

.tch-range::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--tch-primary);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

/* ==========================================================================
   TOGGLE SWITCH
   ========================================================================== */

.tch-toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

.tch-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.tch-toggle__slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--tch-light);
  transition: var(--transition-base);
  border-radius: var(--radius-full);
}

.tch-toggle__slider::before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: var(--tch-white);
  transition: var(--transition-base);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
}

.tch-toggle input:checked + .tch-toggle__slider {
  background-color: var(--tch-primary);
}

.tch-toggle input:checked + .tch-toggle__slider::before {
  transform: translateX(22px);
}