/* BingeBear CRM — Frontend Form Styles */

.bb-form-wrapper {
    max-width: 600px;
    margin: 0 auto;
}

.bb-form-row {
    margin-bottom: 18px;
}

.bb-form-row label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 15px;
    color: #333;
}

.bb-required {
    color: #d63638;
}

.bb-form-row input[type="text"],
.bb-form-row input[type="email"],
.bb-form-row input[type="tel"],
.bb-form-row input[type="number"],
.bb-form-row input[type="date"],
.bb-form-row textarea,
.bb-form-row select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 16px;
    font-family: inherit;
    background: #fff;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.bb-form-row input:focus,
.bb-form-row textarea:focus,
.bb-form-row select:focus {
    border-color: #e8530e;
    outline: none;
    box-shadow: 0 0 0 2px rgba(232, 83, 14, 0.15);
}

/* Inline validation error state */
.bb-form-row.bb-has-error input,
.bb-form-row.bb-has-error textarea,
.bb-form-row.bb-has-error select {
    border-color: #d63638;
    box-shadow: 0 0 0 2px rgba(214, 54, 56, 0.15);
}

.bb-field-error {
    color: #d63638;
    font-size: 13px;
    margin-top: 4px;
    display: none;
}

.bb-form-row.bb-has-error .bb-field-error {
    display: block;
}

/* Submit button */
.bb-form-btn {
    display: inline-block;
    padding: 14px 32px;
    background: #e8530e;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
    width: 100%;
}

.bb-form-btn:hover {
    background: #c9440b;
}

.bb-form-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Messages */
.bb-form-message {
    margin-top: 16px;
    padding: 14px 18px;
    border-radius: 6px;
    font-size: 15px;
    line-height: 1.5;
}

.bb-form-message.bb-success {
    background: #edfaef;
    color: #0a6c1e;
    border: 1px solid #b8e6c1;
}

.bb-form-message.bb-error {
    background: #fef0f0;
    color: #8b1a1a;
    border: 1px solid #f5c6c6;
}

.bb-form-row.bb-form-submit {
    margin-top: 24px;
}

/* Radio & Checkbox groups */
.bb-radio-group,
.bb-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bb-radio-group label,
.bb-checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 400;
    cursor: pointer;
}

.bb-radio-group input[type="radio"],
.bb-checkbox-group input[type="checkbox"] {
    width: auto;
    margin: 0;
}

/* Consent checkbox */
.bb-consent-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.bb-consent-row input[type="checkbox"] {
    width: auto;
    margin-top: 3px;
    flex-shrink: 0;
}

.bb-consent-row label {
    font-weight: 400;
    font-size: 14px;
    color: #555;
    margin-bottom: 0;
}

/* Heading & HTML fields */
.bb-field-heading h3 {
    margin: 24px 0 8px;
    font-size: 20px;
    color: #222;
    border-bottom: 2px solid #e8530e;
    padding-bottom: 8px;
}

.bb-field-html {
    margin-bottom: 18px;
    font-size: 14px;
    color: #555;
    line-height: 1.6;
}

/* Honeypot */
.bb-hp-field {
    position: absolute;
    left: -9999px;
    opacity: 0;
    height: 0;
    width: 0;
    overflow: hidden;
}

/* Multi-step Progress Bar */
.bb-progress-bar {
    display: flex;
    margin-bottom: 32px;
    padding: 0;
    list-style: none;
    counter-reset: step;
}

.bb-progress-step {
    flex: 1;
    text-align: center;
    position: relative;
    font-size: 13px;
    color: #999;
    font-weight: 500;
}

.bb-progress-step::before {
    content: counter(step);
    counter-increment: step;
    display: block;
    width: 32px;
    height: 32px;
    line-height: 32px;
    border-radius: 50%;
    background: #e0e0e0;
    color: #999;
    margin: 0 auto 8px;
    font-weight: 700;
    font-size: 14px;
    transition: background 0.3s, color 0.3s;
}

.bb-progress-step::after {
    content: '';
    position: absolute;
    top: 15px;
    left: calc(50% + 20px);
    width: calc(100% - 40px);
    height: 3px;
    background: #e0e0e0;
    transition: background 0.3s;
}

.bb-progress-step:last-child::after {
    display: none;
}

.bb-progress-step.bb-step-active::before {
    background: #e8530e;
    color: #fff;
}

.bb-progress-step.bb-step-active {
    color: #e8530e;
}

.bb-progress-step.bb-step-done::before {
    background: #0a6c1e;
    color: #fff;
    content: '\2713';
}

.bb-progress-step.bb-step-done::after {
    background: #0a6c1e;
}

.bb-progress-step.bb-step-done {
    color: #0a6c1e;
}

/* Step containers */
.bb-step {
    display: none;
}

.bb-step.bb-step-visible {
    display: block;
}

/* Step navigation */
.bb-step-nav {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.bb-step-nav .bb-step-prev,
.bb-step-nav .bb-step-next {
    flex: 1;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background 0.2s;
}

.bb-step-nav .bb-step-prev {
    background: #f0f0f0;
    color: #333;
}

.bb-step-nav .bb-step-prev:hover {
    background: #e0e0e0;
}

.bb-step-nav .bb-step-next {
    background: #e8530e;
    color: #fff;
}

.bb-step-nav .bb-step-next:hover {
    background: #c9440b;
}

/* Turnstile widget */
.bb-turnstile-row {
    margin-bottom: 18px;
}

/* UTM hidden fields — visually hidden but present in DOM */
.bb-utm-fields {
    display: none;
}

/* ══════════════════════════════════════
   Phone Input with Country Code
   ══════════════════════════════════════ */
.bb-phone-wrap {
    display: flex;
    gap: 0;
    align-items: stretch;
}

.bb-phone-country {
    flex: 0 0 auto;
    width: 110px;
    padding: 12px 8px 12px 12px;
    border: 1px solid #ccc;
    border-right: none;
    border-radius: 6px 0 0 6px;
    font-size: 15px;
    font-family: inherit;
    background: #f8f9fa;
    color: #333;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 10px;
    padding-right: 24px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.bb-phone-country:focus {
    border-color: #e8530e;
    outline: none;
    box-shadow: 0 0 0 2px rgba(232, 83, 14, 0.15);
    z-index: 1;
}

.bb-phone-input {
    flex: 1;
    border-radius: 0 6px 6px 0 !important;
}

/* Focus state for the whole phone group */
.bb-phone-wrap:focus-within .bb-phone-country {
    border-color: #e8530e;
}
.bb-phone-wrap:focus-within .bb-phone-input {
    border-color: #e8530e;
}

/* Error state */
.bb-has-error .bb-phone-country {
    border-color: #d63638;
}

/* ══════════════════════════════════════
   Autofill Detection Styling
   ══════════════════════════════════════ */
.bb-form-row input:-webkit-autofill,
.bb-form-row input:-webkit-autofill:hover,
.bb-form-row input:-webkit-autofill:focus,
.bb-form-row select:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 30px #fff inset !important;
    -webkit-text-fill-color: #333 !important;
    border-color: #e8530e !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* ══════════════════════════════════════
   Loading / Submitting State
   ══════════════════════════════════════ */
.bb-form-submit-btn {
    position: relative;
    transition: all 0.2s;
}
.bb-form-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}
.bb-form-submit-btn.bb-loading::after {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 8px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: bb-spin 0.6s linear infinite;
    vertical-align: middle;
}
@keyframes bb-spin {
    to { transform: rotate(360deg); }
}

/* ══════════════════════════════════════
   Character Counter (for textarea)
   ══════════════════════════════════════ */
.bb-char-count {
    font-size: 12px;
    color: #999;
    text-align: right;
    margin-top: 2px;
}
.bb-char-count.bb-over-limit {
    color: #d63638;
    font-weight: 600;
}

/* ══════════════════════════════════════
   Anti-flicker for Multi-step
   ══════════════════════════════════════ */
.bb-multistep .bb-step:not(.bb-step-active) {
    display: none;
}
.bb-multistep .bb-last-step-only {
    display: none;
}

/* ══════════════════════════════════════
   Loading Spinner in Submit Button
   ══════════════════════════════════════ */
.bb-submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.bb-btn-spinner {
    display: none;
    line-height: 0;
}
.bb-btn-spinner svg {
    animation: bb-spin 1s linear infinite;
}

/* ══════════════════════════════════════
   WhatsApp CTA Button (after success)
   ══════════════════════════════════════ */
.bb-whatsapp-cta {
    display: inline-block;
    margin-top: 12px;
    padding: 12px 24px;
    background: #25D366;
    color: #fff !important;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 15px;
    transition: background 0.2s;
}
.bb-whatsapp-cta:hover {
    background: #1ebe5d;
}

/* ══════════════════════════════════════
   Form Closed Message
   ══════════════════════════════════════ */
.bb-form-closed {
    text-align: center;
    padding: 32px 20px;
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    color: #666;
    font-size: 15px;
}

/* ══════════════════════════════════════
   File Upload Field
   ══════════════════════════════════════ */
.bb-form-row input[type="file"] {
    padding: 10px;
    border: 2px dashed #ccc;
    border-radius: 6px;
    width: 100%;
    cursor: pointer;
    background: #fafafa;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.bb-form-row input[type="file"]:hover {
    border-color: #e8530e;
}
.bb-file-info {
    font-size: 12px;
    color: #999;
    margin-top: 4px;
}

/* ══════════════════════════════════════
   Conditional Field Transition
   ══════════════════════════════════════ */
.bb-form-row[data-condition-field] {
    transition: opacity 0.2s, max-height 0.3s;
}
