/* Utility classes */
.hf-bg-white {
    background-color: #fff;
}

.hf-bg-light {
    background-color: #f9fafb;
}

.hf-bg-dark {
    background-color: #2d2aa5;
}

.hf-border {
    border: 1px solid #ddd;
}

.hf-rounded {
    border-radius: 8px;
}

.hf-padding-md {
    padding: 24px;
}

.hf-padding-lg {
    padding: 32px;
}

.hf-shadow {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.hf-w-full {
    width: 100% !important;
    max-width: none !important;
}

/* Scoped form styling */
[id^="hf-form-"] {
    padding: 20px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    font-family: "Roboto", sans-serif;
    border-radius: 8px;
    position: relative;
    z-index: 1;
}

/* Dark background labels, headline, and footer note in white */
[id^="hf-form-"].hf-bg-dark h2,
[id^="hf-form-"].hf-bg-dark .hf-field label,
[id^="hf-form-"].hf-bg-dark .hf-footer-note,
[id^="hf-form-"].hf-bg-dark .hf-privacy-policy {
    color: #fff;
}

[id^="hf-form-"] h2 {
    font-size: 24px;
    text-align: center;
    margin-bottom: 16px;
    margin-top: 0;
}

/* Fieldset resets */
[id^="hf-form-"] fieldset {
    border: none;
    margin: 0;
    padding: 0;
}

/* Field wrapper */
[id^="hf-form-"] .hf-field {
    display: flex;
    flex-direction: column;
}

[id^="hf-form-"] .hf-field label {
    font-weight: 500;
    margin-bottom: 4px;
}

/* Inputs, selects, textareas, date inputs */
[id^="hf-form-"] input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
[id^="hf-form-"] select,
[id^="hf-form-"] textarea,
[id^="hf-form-"] input[type="date"] {
    padding: 12px 20px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    width: 100%;
    resize: vertical;
    background-color: #fff;
    color: #333;
    transition: border-color .3s ease, box-shadow .3s ease;
    appearance: none;
}

/* Checkbox and radio styling */
[id^="hf-form-"] input[type="checkbox"],
[id^="hf-form-"] input[type="radio"] {
    width: auto;
    height: auto;
    margin-right: 8px;
    accent-color: #22c55e; /* Modern browsers: green accent */
    cursor: pointer;
}

/* Ensure checkbox/radio labels align properly */
[id^="hf-form-"] .hf-privacy-policy,
[id^="hf-form-"] label input[type="checkbox"],
[id^="hf-form-"] label input[type="radio"] {
    display: inline-flex;
    align-items: center;
}

/* Custom arrow for select */
[id^="hf-form-"] select {
    background-image: url("data:image/svg+xml;utf8,<svg fill='%23333' viewBox='0 0 24 24'><path d='M7 10l5 5 5-5z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 1em;
}

/* Hide default calendar icon */
[id^="hf-form-"] input[type="date"]::-webkit-calendar-picker-indicator {
    display: none;
}

/* Focus states */
[id^="hf-form-"] input:focus,
[id^="hf-form-"] select:focus,
[id^="hf-form-"] textarea:focus {
    outline: none;
    border-color: #40caa1;
    box-shadow: 0 0 0 3px rgba(64, 202, 161, 0.2);
}

/* Submit button styling */
[id^="hf-form-"] .submit-button {
    background-color: #40caa1;
    color: #fff;
    padding: 12px 20px;
    border: none;
    border-radius: 30px;
    font-size: 18px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

[id^="hf-form-"] .submit-button:hover {
    background-color: #339e85;
}

[id^="hf-form-"] .hf-privacy-policy {
    font-size: 12px;
    line-height: normal;
}

/* Footer note styling */
[id^="hf-form-"] .hf-footer-note {
    font-size: 14px;
    color: #666;
    margin-top: 8px;
}

/* Grid layouts on fieldset when form layout is default, columns or mixed */
[id^="hf-form-"].default fieldset,
[id^="hf-form-"].columns fieldset,
[id^="hf-form-"].mixed fieldset {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

/* Single column for default layout */
[id^="hf-form-"].default fieldset {
    grid-template-columns: 1fr;
}


[id^="hf-form-"] .hf-required {
    color: #e53935;
    font-weight: bold;
}

[id^="hf-form-"] .hf-error,
[id^="hf-form-"] [data-hf-error] {
    color: #e53935 !important;
    text-align: center;
    margin: 1rem 0 0 0;
}

[id^="hf-form-"] .hf-success {
    text-align: center;
}

[id^="hf-form-"].hf-bg-dark .hf-success {
    color: #fff;
}

[id^="hf-form-"] .hf-loading {
    text-align: center;
    font-size: 1rem;
    color: #2d2aa5;
}

[id^="hf-form-"].hf-bg-dark .hf-loading {
    color: #40caa1;
}

[id^="hf-form-"] .hf-spinner {
    animation: spin 1s linear infinite;
    display: inline-block;
}

[id^="hf-form-"]  .hf-submit.loading {
    opacity: 0.6;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

@keyframes spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}


@media (max-width: 480px) {
    [id^="hf-form-"].columns fieldset,
    [id^="hf-form-"].mixed fieldset {
        grid-template-columns: 1fr;
    }
}

/* reCAPTCHA */
.hf-recaptcha {
    align-items: center;
    justify-content: center;
    margin-top: 2rem;
}

/* custom themes */

/* Ebook Theme */
[id^="hf-form-"].hf-ebook-theme {
    background-color: #fff;
    border: 1px solid #ccc; /* subtle gray border */
    border-radius: 6px;
    padding: 20px;
    gap: 8px;
    /*max-width: 640px;*/
    margin: 0 auto;
}

/* Pre-title green text */
[id^="hf-form-"].hf-ebook-theme .hf-pre-title {
    color: #40caa1;
    font-weight: 600;
    text-align: left;
    margin-bottom: 0 !important;
}

/* Main heading bold & larger */
[id^="hf-form-"].hf-ebook-theme h2 {
    font-size: 30px;
    font-weight: 700;
    color: #2D2AA5;
    text-align: left;
    margin-top: 0;
}

/* Description under heading */
[id^="hf-form-"].hf-ebook-theme .hf-description {
    font-size: 1.5rem;
    margin-bottom: 20px;
}

/* Form grid: two inputs side by side on desktop */
[id^="hf-form-"].hf-ebook-theme fieldset {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 640px) {
    [id^="hf-form-"].hf-ebook-theme fieldset {
        grid-template-columns: 1fr;
    }
}

/* Labels */
[id^="hf-form-"].hf-ebook-theme .hf-field label {
    font-size: 12px;
    font-weight: 500;
}

/* Submit button: rounded green */
[id^="hf-form-"].hf-ebook-theme .submit-button {
    background-color: #40caa1;
    color: white;
    font-weight: 600;
    padding: 10px 22px;
    border-radius: 30px;
    margin-top: 16px;
    transition: background-color 0.3s ease;
    align-self: center;
}

[id^="hf-form-"].hf-ebook-theme .submit-button:hover {
    background-color: #5dd2af;
}
