/* =========================================================================
   Flavor Dashboard – Frontend Form Styles
   ========================================================================= */

.fd-form-wrapper {
  max-width: 640px;
  margin: 0 auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.fd-form {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

/* ---- Field containers ---- */

.fd-form-field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.fd-form-field-full {
  width: 100%;
}

.fd-form-field-half {
  width: calc(50% - 0.625rem);
}

@media (max-width: 600px) {
  .fd-form-field-half {
    width: 100%;
  }
}

/* ---- Labels ---- */

.fd-form-field > label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
}

.fd-form-required {
  color: #ef4444;
}

/* ---- Inputs ---- */

.fd-form-field input[type="text"],
.fd-form-field input[type="email"],
.fd-form-field input[type="url"],
.fd-form-field input[type="tel"],
.fd-form-field input[type="number"],
.fd-form-field input[type="date"],
.fd-form-field textarea,
.fd-form-field select {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 0.9375rem;
  color: #1f2937;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  box-sizing: border-box;
}

.fd-form-field input:focus,
.fd-form-field textarea:focus,
.fd-form-field select:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.fd-form-field input::placeholder,
.fd-form-field textarea::placeholder {
  color: #9ca3af;
}

.fd-form-field textarea {
  resize: vertical;
  min-height: 100px;
}

.fd-form-field select {
  cursor: pointer;
  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='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.25rem;
}

/* ---- Options (radio/checkbox groups) ---- */

.fd-form-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.fd-form-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: #374151;
}

.fd-form-option input[type="radio"],
.fd-form-option input[type="checkbox"] {
  width: 1.125rem;
  height: 1.125rem;
  accent-color: #6366f1;
  cursor: pointer;
}

/* ---- Layout elements ---- */

.fd-form-heading {
  width: 100%;
  font-size: 1.25rem;
  font-weight: 600;
  color: #1f2937;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid #e5e7eb;
}

.fd-form-paragraph {
  width: 100%;
  font-size: 0.875rem;
  color: #6b7280;
  line-height: 1.5;
}

.fd-form-divider {
  width: 100%;
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 0.5rem 0;
}

/* ---- Buttons ---- */

.fd-form-submit {
  width: 100%;
  padding-top: 0.5rem;
}

.fd-form-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  font-size: 0.9375rem;
  font-weight: 600;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, opacity 0.2s;
  text-decoration: none;
}

.fd-form-button:hover {
  opacity: 0.9;
}

.fd-form-button:active {
  transform: scale(0.98);
}

.fd-form-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Primary (default) */
.fd-form-button,
.fd-form-button--primary {
  background: #6366f1;
  color: #fff;
}

.fd-form-button--primary:hover {
  background: #4f46e5;
}

/* Secondary */
.fd-form-button--secondary {
  background: #4b5563;
  color: #fff;
}

.fd-form-button--secondary:hover {
  background: #374151;
}

/* Success */
.fd-form-button--success {
  background: #059669;
  color: #fff;
}

.fd-form-button--success:hover {
  background: #047857;
}

/* Danger */
.fd-form-button--danger {
  background: #dc2626;
  color: #fff;
}

.fd-form-button--danger:hover {
  background: #b91c1c;
}

/* Outline */
.fd-form-button--outline {
  background: transparent;
  color: #6366f1;
  border: 2px solid #6366f1;
}

.fd-form-button--outline:hover {
  background: rgba(99, 102, 241, 0.08);
}

/* Spinner for loading state */
.fd-form-button .fd-spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: fd-spin 0.6s linear infinite;
}

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

/* ---- Success / Error ---- */

.fd-form-success {
  text-align: center;
  padding: 2rem;
  opacity: 1;
  transition: opacity 0.5s ease;
}

.fd-form-success--fade-out {
  opacity: 0;
}

.fd-form-success-icon {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: #10b981;
  color: #fff;
  font-size: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.fd-form-success p {
  font-size: 1.0625rem;
  color: #374151;
  margin: 0;
}

.fd-form-error {
  padding: 0.75rem 1rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 0.5rem;
  color: #dc2626;
  font-size: 0.875rem;
  margin-top: 0.75rem;
}

/* ---- Validation ---- */

.fd-form-field.fd-field-error input,
.fd-form-field.fd-field-error textarea,
.fd-form-field.fd-field-error select {
  border-color: #ef4444;
}

.fd-form-field .fd-field-error-msg {
  color: #ef4444;
  font-size: 0.75rem;
  margin-top: 0.125rem;
}
