/* ═══════════════════════════════════════════════════
   هارد گارانتی — Frontend Form Styles
   RTL / Persian / Vazirmatn
═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700&display=swap');

/* ── Root variables ── */
:root {
  --hwf-red:     #cc0000;
  --hwf-dark:    #1a1a1a;
  --hwf-gray:    #6b7280;
  --hwf-light:   #f8f9fa;
  --hwf-border:  #e0e0e0;
  --hwf-radius:  8px;
  --hwf-shadow:  0 2px 12px rgba(0,0,0,.08);
  --hwf-input-h: 44px;
}

/* ── Wrapper ── */
.hwf-wrapper {
  font-family: 'Vazirmatn', Tahoma, Arial, sans-serif;
  direction: rtl;
  text-align: right;
  color: var(--hwf-dark);
  max-width: 860px;
  margin: 0 auto;
}

.hwf-intro {
  background: #fff8e1;
  border-right: 4px solid #f59e0b;
  padding: 12px 16px;
  border-radius: var(--hwf-radius);
  margin-bottom: 20px;
  font-size: 14px;
  color: #92400e;
}

/* ── Form ── */
.hwf-form { display: flex; flex-direction: column; gap: 0; }

/* ── Sections ── */
.hwf-section {
  border: 1px solid var(--hwf-border);
  border-radius: var(--hwf-radius);
  overflow: hidden;
  margin-bottom: 16px;
  background: #fff;
  box-shadow: var(--hwf-shadow);
}

.hwf-section-header {
  background: var(--hwf-red);
  color: #fff;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
}

.hwf-section-num {
  background: rgba(255,255,255,.25);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.hwf-section-title { flex: 1; }

.hwf-section-body { padding: 18px 20px; }

/* ── Rows & fields ── */
.hwf-row {
  display: flex;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.hwf-row:last-child { margin-bottom: 0; }

.hwf-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 180px;
}
.hwf-field-lg   { flex: 2; min-width: 250px; }
.hwf-field-full { flex: 1 0 100%; }

.hwf-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--hwf-gray);
}

.hwf-field input[type="text"],
.hwf-field input[type="tel"],
.hwf-field input[type="email"],
.hwf-field input[type="url"],
.hwf-field textarea,
.hwf-field select {
  font-family: 'Vazirmatn', Tahoma, Arial, sans-serif;
  font-size: 14px;
  color: var(--hwf-dark);
  background: var(--hwf-light);
  border: 1.5px solid var(--hwf-border);
  border-radius: 6px;
  padding: 0 14px;
  height: var(--hwf-input-h);
  width: 100%;
  transition: border-color .2s, box-shadow .2s;
  outline: none;
  direction: rtl;
}
.hwf-field input[dir="ltr"] { direction: ltr; text-align: left; }
.hwf-field textarea {
  height: auto;
  padding: 12px 14px;
  resize: vertical;
}
.hwf-field input:focus,
.hwf-field textarea:focus {
  border-color: var(--hwf-red);
  box-shadow: 0 0 0 3px rgba(204,0,0,.12);
  background: #fff;
}
.hwf-field input.hwf-invalid {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239,68,68,.12);
}

/* ── Radio groups ── */
.hwf-radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
}

.hwf-radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  padding: 8px 14px;
  border: 1.5px solid var(--hwf-border);
  border-radius: 6px;
  background: var(--hwf-light);
  transition: all .2s;
}
.hwf-radio-label:hover { border-color: var(--hwf-red); background: #fff5f5; }
.hwf-radio-label input[type="radio"] { width: 16px; height: 16px; accent-color: var(--hwf-red); }
.hwf-radio-label:has(input:checked) {
  border-color: var(--hwf-red);
  background: #fff0f0;
  color: var(--hwf-red);
  font-weight: 600;
}

/* ── Checkbox grid ── */
.hwf-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}

.hwf-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  padding: 8px 12px;
  border: 1.5px solid var(--hwf-border);
  border-radius: 6px;
  background: var(--hwf-light);
  transition: all .2s;
}
.hwf-checkbox-label:hover { border-color: var(--hwf-red); background: #fff5f5; }
.hwf-checkbox-label input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--hwf-red); flex-shrink: 0; }
.hwf-checkbox-label:has(input:checked) {
  border-color: var(--hwf-red);
  background: #fff0f0;
  color: var(--hwf-red);
  font-weight: 600;
}

.hwf-label { font-size: 13px; font-weight: 600; color: var(--hwf-gray); margin-bottom: 10px; }

/* ── Terms section ── */
.hwf-section-terms .hwf-section-body { background: #fafafa; }

.hwf-terms-list {
  padding-right: 20px;
  font-size: 13px;
  line-height: 2.2;
  color: #444;
}
.hwf-terms-list li { margin-bottom: 2px; }

.hwf-terms-accept {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 10px 14px;
  border: 1.5px solid var(--hwf-border);
  border-radius: 6px;
  background: #fff;
  transition: all .2s;
}
.hwf-terms-accept:hover { border-color: var(--hwf-red); }
.hwf-terms-accept:has(input:checked) { border-color: #16a34a; background: #f0fdf4; color: #15803d; }
.hwf-terms-accept input[type="checkbox"] { width: 18px; height: 18px; accent-color: #16a34a; }

/* ── Required star ── */
.req { color: var(--hwf-red); }

/* ── Submit row ── */
.hwf-submit-row {
  text-align: center;
  margin-top: 8px;
}

/* ── Buttons ── */
.hwf-btn {
  font-family: 'Vazirmatn', Tahoma, Arial, sans-serif;
  font-size: 15px;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  padding: 13px 36px;
  transition: all .2s;
  display: inline-block;
  text-decoration: none;
}

.hwf-btn-submit {
  background: var(--hwf-red);
  color: #fff;
  min-width: 220px;
}
.hwf-btn-submit:hover { background: #a80000; transform: translateY(-1px); box-shadow: 0 4px 14px rgba(204,0,0,.3); }
.hwf-btn-submit:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.hwf-btn-primary {
  background: var(--hwf-red);
  color: #fff;
}
.hwf-btn-primary:hover { background: #a80000; }

.hwf-btn-secondary {
  background: #e5e7eb;
  color: #374151;
}
.hwf-btn-secondary:hover { background: #d1d5db; }

/* ── Error box ── */
.hwf-error-box {
  background: #fef2f2;
  border: 1.5px solid #fca5a5;
  color: #991b1b;
  border-radius: 8px;
  padding: 14px 18px;
  font-size: 14px;
  line-height: 1.8;
  margin-top: 12px;
}

/* ── Success box ── */
.hwf-success-box {
  background: #f0fdf4;
  border: 2px solid #86efac;
  border-radius: var(--hwf-radius);
  padding: 32px 24px;
  text-align: center;
  margin-bottom: 20px;
}
.hwf-success-icon { font-size: 52px; margin-bottom: 12px; }
.hwf-success-box h3 { font-size: 20px; color: #15803d; margin-bottom: 10px; }
.hwf-success-box p  { font-size: 14px; color: #166534; margin-bottom: 6px; }
.hwf-success-box strong { font-size: 18px; font-weight: 700; color: var(--hwf-red); }

.hwf-success-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 20px;
}

/* ── Loading spinner inside button ── */
@keyframes hwf-spin {
  to { transform: rotate(360deg); }
}
.hwf-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  display: inline-block;
  animation: hwf-spin .6s linear infinite;
  vertical-align: middle;
  margin-left: 6px;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .hwf-row   { flex-direction: column; }
  .hwf-field { min-width: unset; }
  .hwf-field-lg { flex: unset; }
  .hwf-radio-group { gap: 8px; }
  .hwf-checkbox-grid { grid-template-columns: repeat(2, 1fr); }
  .hwf-section-header { font-size: 13px; }
  .hwf-btn-submit { width: 100%; }
}
