/* HubSpot Form Optimization - Compact & Conversion-Friendly */

/* Form Container Optimization */
.hero-form-container,
.contact-form-container {
    padding: 1.5rem !important;
}

.hero-form-container h3,
.contact-form-container h2 {
    font-size: 1.25rem !important;
    margin-bottom: 0.35rem !important;
}

.hero-form-container p,
.contact-form-container p {
    font-size: 0.875rem !important;
    margin-bottom: 1rem !important;
}

/* HubSpot Form Styling */
.hbspt-form {
    max-width: 100% !important;
}

/* Form Fields Optimization - Reduce Spacing */
.hbspt-form .hs-form-field {
    margin-bottom: 0.5rem !important;
}

.hbspt-form .hs-form-field:last-of-type {
    margin-bottom: 0.75rem !important;
}

/* Input Fields - Compact Height */
.hbspt-form input[type="text"],
.hbspt-form input[type="email"],
.hbspt-form input[type="tel"],
.hbspt-form input[type="number"],
.hbspt-form select,
.hbspt-form textarea {
    width: 100% !important;
    padding: 0.5rem 0.85rem !important;
    border: 1px solid #ddd !important;
    border-radius: 6px !important;
    font-size: 0.875rem !important;
    line-height: 1.4 !important;
    transition: border-color 0.3s ease !important;
    background: #fff !important;
    font-family: 'Inter', sans-serif !important;
}

.hbspt-form textarea {
    min-height: 60px !important;
    max-height: 100px !important;
    resize: vertical !important;
}

.hbspt-form input:focus,
.hbspt-form select:focus,
.hbspt-form textarea:focus {
    outline: none !important;
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 0 3px rgba(44, 95, 141, 0.1) !important;
}

/* Labels - Compact */
.hbspt-form label {
    display: block !important;
    margin-bottom: 0.25rem !important;
    font-weight: 500 !important;
    font-size: 0.8125rem !important;
    color: var(--text-dark) !important;
}

/* Hide Optional Labels */
.hbspt-form .hs-form-required {
    color: #dc3545 !important;
}

/* Error Messages - Compact */
.hbspt-form .hs-error-msgs {
    list-style: none !important;
    padding: 0 !important;
    margin: 0.35rem 0 0 0 !important;
}

.hbspt-form .hs-error-msgs li label {
    color: #dc3545 !important;
    font-size: 0.8125rem !important;
    font-weight: 400 !important;
    margin: 0 !important;
}

/* Submit Button - Prominent & Compact */
.hbspt-form .hs-submit {
    margin-top: 0.75rem !important;
}

.hbspt-form input[type="submit"],
.hbspt-form .hs-button {
    width: 100% !important;
    padding: 0.75rem 1.75rem !important;
    background: var(--secondary-color) !important;
    color: var(--primary-color) !important;
    border: none !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    font-size: 0.9375rem !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 12px rgba(201, 169, 97, 0.3) !important;
    font-family: 'Inter', sans-serif !important;
}

.hbspt-form input[type="submit"]:hover,
.hbspt-form .hs-button:hover {
    background: #d4b46d !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(201, 169, 97, 0.4) !important;
}

/* Form Legends & Fieldsets */
.hbspt-form fieldset {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

.hbspt-form legend {
    display: none !important;
}

/* Remove Extra Spacing */
.hbspt-form .hs-form-booleancheckbox,
.hbspt-form .hs-form-radio {
    margin-top: 0.5rem !important;
}

.hbspt-form .hs-form-booleancheckbox label,
.hbspt-form .hs-form-radio label {
    display: inline-block !important;
    margin-left: 0.5rem !important;
    font-size: 0.875rem !important;
}

/* Dependent Fields */
.hbspt-form .hs-dependent-field {
    margin-top: 0.75rem !important;
}

/* Privacy Policy & Legal Text - Compact */
.hbspt-form .hs-richtext {
    font-size: 0.8125rem !important;
    line-height: 1.5 !important;
    color: var(--text-light) !important;
    margin-top: 1rem !important;
}

.hbspt-form .hs-richtext p {
    margin-bottom: 0.5rem !important;
}

.hbspt-form .hs-richtext a {
    color: var(--accent-color) !important;
    text-decoration: underline !important;
}

/* Success Message */
.hbspt-form .submitted-message {
    padding: 1.5rem !important;
    background: #d4edda !important;
    border: 1px solid #c3e6cb !important;
    border-radius: 8px !important;
    color: #155724 !important;
    text-align: center !important;
    font-size: 1rem !important;
}

/* Loading State */
.hbspt-form .hs-loading {
    opacity: 0.6 !important;
    pointer-events: none !important;
}

/* Inline Form Errors */
.hbspt-form .hs-form-field.hs-error input,
.hbspt-form .hs-form-field.hs-error select,
.hbspt-form .hs-form-field.hs-error textarea {
    border-color: #dc3545 !important;
}

/* Multi-Column Layout for Desktop */
@media (min-width: 768px) {
    .hbspt-form .hs-form-field {
        margin-bottom: 0.85rem !important;
    }
    
    .hero-form-container {
        padding: 2rem !important;
    }
    
    .contact-form-container {
        padding: 2.5rem !important;
    }
}

/* Mobile Optimization */
@media (max-width: 767px) {
    .hero-form-container,
    .contact-form-container {
        padding: 1.25rem !important;
    }
    
    .hbspt-form .hs-form-field {
        margin-bottom: 0.4rem !important;
    }
    
    .hbspt-form input[type="text"],
    .hbspt-form input[type="email"],
    .hbspt-form input[type="tel"],
    .hbspt-form input[type="number"],
    .hbspt-form select,
    .hbspt-form textarea {
        padding: 0.45rem 0.75rem !important;
        font-size: 0.875rem !important;
    }
    
    .hbspt-form label {
        font-size: 0.75rem !important;
        margin-bottom: 0.2rem !important;
    }
    
    .hbspt-form input[type="submit"],
    .hbspt-form .hs-button {
        padding: 0.65rem 1.5rem !important;
        font-size: 0.875rem !important;
    }
    
    .hbspt-form textarea {
        min-height: 50px !important;
        max-height: 80px !important;
    }
}

/* Extra Compact for Small Mobile */
@media (max-width: 480px) {
    .hero-form-container,
    .contact-form-container {
        padding: 1.25rem !important;
    }
    
    .hero-form-container h3,
    .contact-form-container h2 {
        font-size: 1.25rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .hero-form-container p,
    .contact-form-container p {
        font-size: 0.875rem !important;
        margin-bottom: 1rem !important;
    }
}

/* Hide Non-Essential Form Elements */
.hbspt-form .hs-field-desc {
    display: none !important;
}

/* Remove Add-ons Section */
.hbspt-form .hs-add-on,
.hbspt-form .hs-form-addon,
.hbspt-form .form-addon,
.hbspt-form [class*="addon"],
.hbspt-form [class*="add-on"],
.hbspt-form [id*="addon"],
.hbspt-form [id*="add-on"] {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
}

/* Hide optional fields to keep form short */
.hbspt-form .hs-form-field.optional,
.hbspt-form .hs-form-field[class*="optional"],
.hbspt-form .hs-form-field:has(label:contains("Optional")),
.hbspt-form .hs-company,
.hbspt-form .hs-jobtitle,
.hbspt-form .hs-website,
.hbspt-form .hs-address,
.hbspt-form .hs-city,
.hbspt-form .hs-state,
.hbspt-form .hs-zip {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
    height: 0 !important;
}

/* Keep only essential fields visible */
.hbspt-form .hs-firstname,
.hbspt-form .hs-lastname,
.hbspt-form .hs-email,
.hbspt-form .hs-phone,
.hbspt-form .hs-message,
.hbspt-form .hs-submit {
    display: block !important;
}

/* Hide Add-ons by fieldtype */
.hbspt-form .hs-fieldtype-addon,
.hbspt-form [data-type*="addon"],
.hbspt-form .hs-form-field[class*="addon"],
.hbspt-form fieldset[class*="addon"] {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
    height: 0 !important;
    max-height: 0 !important;
}

/* Remove any form section labeled as Add-ons */
.hbspt-form label:contains("Add-on"),
.hbspt-form label:contains("Add-On"),
.hbspt-form legend:contains("Add-on"),
.hbspt-form legend:contains("Add-On") {
    display: none !important;
}

.hbspt-form .hs-form-field:has(label:contains("Add-on")),
.hbspt-form .hs-form-field:has(label:contains("Add-On")) {
    display: none !important;
}

/* Remove empty spaces after Add-ons removal */
.hbspt-form .hs-form-field:empty {
    display: none !important;
}

.hbspt-form fieldset:empty {
    display: none !important;
}

.hbspt-form div:empty {
    margin: 0 !important;
    padding: 0 !important;
}

/* Placeholder Styling */
.hbspt-form input::placeholder,
.hbspt-form textarea::placeholder {
    color: #999 !important;
    opacity: 1 !important;
}

/* Focus States - Enhanced */
.hbspt-form input:focus::placeholder,
.hbspt-form textarea:focus::placeholder {
    opacity: 0.5 !important;
}

/* Form Row Optimization */
.hbspt-form .hs-form-field > label span {
    color: #dc3545 !important;
}

/* Legal Consent - More Compact */
.hbspt-form .legal-consent-container {
    margin-top: 0.75rem !important;
    margin-bottom: 0.75rem !important;
}

.hbspt-form .legal-consent-container .hs-form-booleancheckbox {
    margin: 0 !important;
}

.hbspt-form .legal-consent-container .hs-richtext p {
    font-size: 0.75rem !important;
    line-height: 1.4 !important;
    margin-bottom: 0.35rem !important;
}

/* Remove HubSpot Branding if Present */
.hbspt-form .hs-form-iframe {
    width: 100% !important;
}

/* Ensure Proper Form Width */
.hbspt-form form {
    width: 100% !important;
}

/* Clean up any orphaned elements */
.hbspt-form .hs-form > div:empty,
.hbspt-form .hs-form-field:empty,
.hbspt-form .hs_error_rollup:empty {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Ensure no gaps from removed elements */
.hbspt-form .hs-form-field + .hs-form-field {
    margin-top: 0.75rem !important;
}

/* Fix any broken margins */
.hbspt-form .hs-submit {
    margin-top: 1rem !important;
    margin-bottom: 0 !important;
}

/* Dropdown Styling */
.hbspt-form select {
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    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 9L1 4h10z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 1rem center !important;
    background-size: 12px !important;
    padding-right: 2.5rem !important;
}

/* Radio & Checkbox Groups - Compact */
.hbspt-form .hs-form-radio-display,
.hbspt-form .hs-form-checkbox-display {
    margin-bottom: 0.4rem !important;
}

.hbspt-form input[type="radio"],
.hbspt-form input[type="checkbox"] {
    margin-right: 0.5rem !important;
}

/* Form Instructions */
.hbspt-form .hs-form-field .hs-field-desc {
    font-size: 0.8125rem !important;
    color: var(--text-light) !important;
    margin-top: 0.25rem !important;
}

/* Date Picker Optimization */
.hbspt-form input[type="date"] {
    padding: 0.65rem 1rem !important;
}

/* Number Input */
.hbspt-form input[type="number"] {
    -moz-appearance: textfield !important;
}

.hbspt-form input[type="number"]::-webkit-outer-spin-button,
.hbspt-form input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}

/* Form Title Above Form - More Compact */
.hero-form-container h3 {
    font-size: 1.35rem !important;
    margin-bottom: 0.5rem !important;
}

.hero-form-container > p {
    font-size: 0.9375rem !important;
    margin-bottom: 1.25rem !important;
}

.contact-form-container h2 {
    font-size: 1.75rem !important;
    margin-bottom: 0.5rem !important;
}

.contact-form-container > p {
    font-size: 1rem !important;
    margin-bottom: 1.25rem !important;
}

/* Ensure Forms Don't Overflow */
.hbspt-form * {
    box-sizing: border-box !important;
}

/* Progressive Disclosure Fields */
.hbspt-form .hs-dependent-field {
    animation: slideDown 0.3s ease !important;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 200px;
    }
}

/* Accessibility - Focus Visible */
.hbspt-form input:focus-visible,
.hbspt-form select:focus-visible,
.hbspt-form textarea:focus-visible,
.hbspt-form button:focus-visible {
    outline: 2px solid var(--accent-color) !important;
    outline-offset: 2px !important;
}

/* Form Field Icons (if needed) */
.hbspt-form .hs-input {
    position: relative !important;
}

/* Autofill Styling */
.hbspt-form input:-webkit-autofill,
.hbspt-form input:-webkit-autofill:hover,
.hbspt-form input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 30px white inset !important;
    -webkit-text-fill-color: var(--text-dark) !important;
}

/* Form Group Spacing */
.hbspt-form .form-columns-2 .hs-form-field {
    width: 100% !important;
}

@media (min-width: 768px) {
    .hbspt-form .form-columns-2 {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 0.85rem !important;
    }
    
    .hbspt-form .form-columns-2 .hs-form-field {
        margin-bottom: 0 !important;
    }
    
    .hbspt-form .form-columns-2 .hs-submit,
    .hbspt-form .form-columns-2 .legal-consent-container {
        grid-column: 1 / -1 !important;
    }
}

/* Recaptcha Compact */
.hbspt-form .hs-recaptcha {
    margin: 0.75rem 0 !important;
    transform: scale(0.9) !important;
    transform-origin: 0 0 !important;
}

@media (max-width: 480px) {
    .hbspt-form .hs-recaptcha {
        transform: scale(0.85) !important;
    }
}

/* Loading Spinner */
.hbspt-form .hs-loading::after {
    content: '' !important;
    display: inline-block !important;
    width: 16px !important;
    height: 16px !important;
    border: 2px solid var(--secondary-color) !important;
    border-top-color: transparent !important;
    border-radius: 50% !important;
    animation: spin 0.6s linear infinite !important;
    margin-left: 0.5rem !important;
}

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