/* Scudo anti-Kit: vedi livechat-widget.css */
.bwf-form :where(button,input,textarea,select){text-transform:none !important;letter-spacing:normal !important;min-width:0 !important;width:auto !important;margin:0 !important;padding:0 !important;background:transparent !important;border:0 !important;border-radius:0 !important;box-shadow:none !important;color:inherit !important;font:inherit !important}
/* Scudo anti-Kit: vedi livechat-widget.css */
[class*="bwf-field"] :where(button,input,textarea,select){text-transform:none !important;letter-spacing:normal !important;min-width:0 !important;width:auto !important;margin:0 !important;padding:0 !important;background:transparent !important;border:0 !important;border-radius:0 !important;box-shadow:none !important;color:inherit !important;font:inherit !important}
/**
 * BWF Forms Frontend — Responsive, Modern, Accessible
 * Works with any WP theme, avoids conflicts via scoped selectors
 */

.bwf-form-wrapper {
  --bwf-f-primary: #8e44ad;
  --bwf-f-primary-light: rgba(142,68,173,0.08);
  --bwf-f-text: #1a1a2e;
  --bwf-f-text-dim: #6b7280;
  --bwf-f-border: #e5e7eb;
  --bwf-f-bg: #ffffff;
  --bwf-f-radius: 12px;
  --bwf-f-shadow: 0 4px 24px rgba(0,0,0,0.06);
  --bwf-f-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-family: var(--bwf-f-font) !important;
  max-width: 680px !important;
  margin: 0 auto !important;
}

/* ━━━ HEADER ━━━ */
.bwf-form-header { margin-bottom: 24px !important; }
.bwf-form-title { font-size: 24px !important; font-weight: 700 !important; color: var(--bwf-f-text) !important; margin: 0 0 6px !important; }
.bwf-form-subtitle { font-size: 15px !important; color: var(--bwf-f-text-dim) !important; margin: 0 !important; }

/* ━━━ MODERN STYLE ━━━ */
.bwf-form--modern {
  background: var(--bwf-f-bg) !important;
  border: 1px solid var(--bwf-f-border) !important;
  border-radius: var(--bwf-f-radius) !important;
  padding: 32px !important;
  box-shadow: var(--bwf-f-shadow) !important;
}

/* ━━━ MINIMAL STYLE ━━━ */
.bwf-form--minimal { padding: 0 !important; background: transparent !important; border: none !important; box-shadow: none !important; }
.bwf-form--minimal .bwf-form-fields { display: flex; gap: 12px; flex-wrap: wrap; }
.bwf-form--minimal .bwf-form-field { margin-bottom: 0 !important; }
.bwf-form--minimal .bwf-label { display: none; }
.bwf-form--minimal .bwf-input { border-radius: 999px !important; padding: 12px 20px !important; }

/* ━━━ FIELDS ━━━ */
.bwf-form-fields {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.bwf-form-field { margin-bottom: 0 !important; }
.bwf-field--100 { grid-column: 1 / -1; }
.bwf-field--50 { }

@media (max-width: 600px) {
  .bwf-form-fields { grid-template-columns: 1fr; }
}

.bwf-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--bwf-f-text);
  margin-bottom: 6px;
}

.bwf-input,
.bwf-textarea,
.bwf-select {
  width: 100% !important;
  padding: 12px 16px !important;
  border: 2px solid var(--bwf-f-border) !important;
  border-radius: 10px !important;
  font-size: 15px !important;
  font-family: var(--bwf-f-font) !important;
  color: var(--bwf-f-text) !important;
  background: var(--bwf-f-bg) !important;
  transition: all 0.2s ease;
  box-sizing: border-box;
  appearance: none !important;
  -webkit-appearance: none !important;
}

.bwf-textarea { min-height: 100px !important; resize: vertical; }

.bwf-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236b7280'%3E%3Cpath d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  padding-right: 40px !important;
  cursor: pointer;
}

.bwf-input:focus, .bwf-textarea:focus, .bwf-select:focus {
  outline: none !important;
  border-color: var(--bwf-f-primary) !important;
  box-shadow: 0 0 0 4px var(--bwf-f-primary-light) !important;
}

.bwf-input::placeholder, .bwf-textarea::placeholder {
  color: #9ca3af !important;
}

/* Validation states */
.bwf-input--valid { border-color: #10b981 !important; }
.bwf-input--error { border-color: #ef4444 !important; }
.bwf-input--error:focus { box-shadow: 0 0 0 4px rgba(239,68,68,0.1) !important; }

.bwf-field-error {
  font-size: 12px !important;
  color: #ef4444 !important;
  margin-top: 4px !important;
  font-weight: 500 !important;
}

/* ━━━ CHECKBOX ━━━ */
.bwf-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--bwf-f-text-dim);
  cursor: pointer;
  line-height: 1.5;
}

.bwf-checkbox-label input[type="checkbox"] {
  width: 18px !important; height: 18px !important;
  accent-color: var(--bwf-f-primary);
  margin-top: 2px !important;
  flex-shrink: 0;
  cursor: pointer;
}

.bwf-checkbox-label a {
  color: var(--bwf-f-primary);
  text-decoration: underline;
}

.bwf-checkbox--error .bwf-checkbox-label { color: #ef4444; }

/* ━━━ SUBMIT ━━━ */
.bwf-form-submit { margin-top: 20px !important; grid-column: 1 / -1; }

.bwf-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: none !important; cursor: pointer; font-family: var(--bwf-f-font) !important; transition: all 0.2s ease; text-decoration: none !important; }
.bwf-btn--primary {
  width: 100% !important;
  padding: 14px 28px !important;
  background: linear-gradient(135deg, #8e44ad, #3498db) !important;
  color: #fff !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  border-radius: 10px !important;
  box-shadow: 0 4px 15px rgba(142,68,173,0.3) !important;
}
.bwf-btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(142,68,173,0.4) !important;
}
.bwf-btn--primary:disabled {
  opacity: 0.6;
  transform: none;
  cursor: not-allowed;
}
.bwf-btn-loader { display: inline-flex; animation: bwf-form-spin 1s linear infinite; }
@keyframes bwf-form-spin { to { transform: rotate(360deg); } }

/* ━━━ SUCCESS ━━━ */
.bwf-form-success {
  text-align: center;
  padding: 40px 20px !important;
  animation: bwf-form-fade-in 0.5s ease;
}
.bwf-success-icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff; font-size: 32px; font-weight: 700;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}
.bwf-form-success h4 { font-size: 22px !important; color: #10b981 !important; margin: 0 0 8px !important; }
.bwf-form-success p { font-size: 15px !important; color: var(--bwf-f-text-dim) !important; margin: 0 !important; }

@keyframes bwf-form-fade-in { from { opacity: 0; transform: translateY(10px); } }

/* ━━━ ERROR ━━━ */
.bwf-form-error {
  background: rgba(239,68,68,0.08) !important;
  border: 1px solid rgba(239,68,68,0.2) !important;
  border-radius: 10px !important;
  padding: 12px 16px !important;
  margin-top: 16px !important;
}
.bwf-error-text { font-size: 14px; color: #ef4444; margin: 0; }

/* ━━━ SMART CTA ━━━ */
.bwf-smart-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s ease;
  cursor: pointer;
}
.bwf-cta--primary {
  background: linear-gradient(135deg, #8e44ad, #3498db);
  color: #fff;
  padding: 12px 28px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(142,68,173,0.25);
}
.bwf-cta--primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(142,68,173,0.35); color: #fff; }
.bwf-cta--outline {
  border: 2px solid var(--bwf-f-primary);
  color: var(--bwf-f-primary);
  padding: 10px 24px;
  border-radius: 10px;
  background: transparent;
}
.bwf-cta--outline:hover { background: var(--bwf-f-primary-light); }
.bwf-cta--link { color: var(--bwf-f-primary); padding: 0; }
.bwf-cta--link:hover { text-decoration: underline; }
.bwf-cta-icon { font-size: 18px; }

/* ━━━ DARK MODE ━━━ */
@media (prefers-color-scheme: dark) {
  .bwf-form--modern {
    --bwf-f-bg: #1a1a2e;
    --bwf-f-text: #e4e4f0;
    --bwf-f-text-dim: rgba(255,255,255,0.5);
    --bwf-f-border: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.08) !important;
  }
}
