/* Faddat Forms - Frontend Styles
   Version: 1.0.0 | faddat.com
----------------------------------------------- */

:root {
  --fdf-primary:     #2563eb;
  --fdf-primary-h:   #1d4ed8;
  --fdf-danger:      #dc2626;
  --fdf-success:     #16a34a;
  --fdf-border:      #d1d5db;
  --fdf-border-r:    #2563eb;
  --fdf-bg:          #ffffff;
  --fdf-text:        #111827;
  --fdf-placeholder: #9ca3af;
  --fdf-radius:      6px;
  --fdf-transition:  0.15s ease;
  --fdf-font:        inherit;
}

.fdf-form-wrap { max-width: 720px; font-family: var(--fdf-font); }

.fdf-form-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.5rem; }
.fdf-form-description { color: #6b7280; margin-bottom: 1.5rem; }

/* ---- Form messages ---- */
.fdf-form-messages:empty { display: none; }
.fdf-form-messages { padding: 0.75rem 1rem; border-radius: var(--fdf-radius); margin-bottom: 1.25rem; }
.fdf-form-messages.fdf-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.fdf-form-messages.fdf-error   { background: #fef2f2; border: 1px solid #fecaca; color: #dc2626; }

/* ---- Fields grid ---- */
.fdf-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.fdf-field {
  box-sizing: border-box;
}

.fdf-field--width-100 { width: 100%; }
.fdf-field--width-75  { width: calc(75% - 0.5rem); }
.fdf-field--width-66  { width: calc(66.666% - 0.5rem); }
.fdf-field--width-50  { width: calc(50% - 0.5rem); }
.fdf-field--width-33  { width: calc(33.333% - 0.5rem); }
.fdf-field--width-25  { width: calc(25% - 0.5rem); }

@media (max-width: 600px) {
  .fdf-field { width: 100% !important; }
}

/* ---- Label ---- */
.fdf-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fdf-text);
  margin-bottom: 0.375rem;
}
.fdf-required { color: var(--fdf-danger); margin-left: 2px; }

/* ---- Inputs ---- */
.fdf-input,
.fdf-form input[type=text],
.fdf-form input[type=email],
.fdf-form input[type=number],
.fdf-form input[type=tel],
.fdf-form input[type=url],
.fdf-form input[type=date],
.fdf-form input[type=time],
.fdf-form input[type=file],
.fdf-form select,
.fdf-form textarea {
  width: 100%;
  padding: 0.5625rem 0.75rem;
  border: 1.5px solid var(--fdf-border);
  border-radius: var(--fdf-radius);
  background: var(--fdf-bg);
  color: var(--fdf-text);
  font-size: 0.9375rem;
  line-height: 1.5;
  box-sizing: border-box;
  transition: border-color var(--fdf-transition), box-shadow var(--fdf-transition);
  outline: none;
}

.fdf-input:focus,
.fdf-form input:focus,
.fdf-form select:focus,
.fdf-form textarea:focus {
  border-color: var(--fdf-border-r);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}

.fdf-input.fdf-has-error,
.fdf-field--has-error .fdf-input {
  border-color: var(--fdf-danger);
}

.fdf-form textarea { resize: vertical; min-height: 100px; }
.fdf-form select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%236b7280' d='M4 6l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.6rem center; background-size: 14px; padding-right: 2rem; }

/* ---- Radio / Checkbox ---- */
.fdf-radio-group,
.fdf-checkbox-group { display: flex; flex-direction: column; gap: 0.4rem; }

.fdf-radio-label,
.fdf-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
  cursor: pointer;
}

.fdf-radio,
.fdf-checkbox {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  accent-color: var(--fdf-primary);
}

/* ---- File ---- */
.fdf-file-wrap { position: relative; }
.fdf-file-hint { margin: 0.3rem 0 0; font-size: 0.8rem; color: #6b7280; }

/* ---- Description ---- */
.fdf-description { margin: 0.3rem 0 0; font-size: 0.8125rem; color: #6b7280; }

/* ---- Error message ---- */
.fdf-field__error { display: block; font-size: 0.8125rem; color: var(--fdf-danger); min-height: 1.2em; margin-top: 0.25rem; }

/* ---- Layout fields ---- */
.fdf-divider { border: none; border-top: 1px solid var(--fdf-border); margin: 0.5rem 0; }
.fdf-heading { margin: 0 0 0.25rem; }
.fdf-heading-sub { margin: 0; color: #6b7280; font-size: 0.9rem; }

/* ---- Submit button ---- */
.fdf-submit-wrap { margin-top: 1.25rem; }
.fdf-submit-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.5rem;
  background: var(--fdf-primary);
  color: #fff;
  border: none;
  border-radius: var(--fdf-radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--fdf-transition), transform var(--fdf-transition);
}
.fdf-submit-btn:hover { background: var(--fdf-primary-h); }
.fdf-submit-btn:active { transform: scale(0.98); }
.fdf-submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* Spinner */
.fdf-submit-spinner {
  display: none;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: fdf-spin 0.6s linear infinite;
}
.fdf-form--submitting .fdf-submit-spinner { display: inline-block; }
.fdf-form--submitting .fdf-submit-text { opacity: 0.8; }

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