/* ==========================================================================
   Hostfully Form Styles - Symphony Theme
   ========================================================================== */

/* --------------------------------------------------------------------------
   Design Tokens (CSS Custom Properties)
   -------------------------------------------------------------------------- */
:root {
    --hf-primary: #2D2AA5;
    --hf-secondary: #31B48D;
    --hf-purple: #8A5BDA;
    --hf-purple-light: #C4B5FD;
    --hf-blue-light: #E7F1FF;
    --hf-text: #212529;
    --hf-text-muted: #666;
    --hf-white: #FFFFFF;
    --hf-input-bg: #F8F8FF;
    --hf-input-bg-light: #FFFFFF;
    --hf-input-border: rgba(45, 42, 165, 0.15);
    --hf-radius-card: 30px;
    --hf-radius-input: 50px;
    --hf-radius-button: 50px;
    --hf-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* --------------------------------------------------------------------------
   Utility Classes
   -------------------------------------------------------------------------- */
.hf-bg-white {
    background-color: var(--hf-white);
}

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

.hf-bg-dark {
    background-color: var(--hf-primary);
}

.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: var(--hf-shadow);
}

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

/* --------------------------------------------------------------------------
   Base Form Styling
   -------------------------------------------------------------------------- */
[id^="hf-form-"] {
    padding: 32px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    font-family: "Inter", "Roboto", -apple-system, BlinkMacSystemFont, sans-serif;
    border-radius: var(--hf-radius-card);
    position: relative;
    z-index: 1;
}

[id^="hf-form-"] h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 16px;
    margin-top: 0;
    color: var(--hf-text);
}

/* 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: 700;
    font-size: 14px;
    margin-bottom: 8px;
    margin-top: 8px;
    color: var(--hf-text);
}

/* --------------------------------------------------------------------------
   Input Styling (Pill-shaped)
   -------------------------------------------------------------------------- */
[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: 18px 28px;
    border: 1px solid var(--hf-input-border);
    border-radius: var(--hf-radius-input);
    font-size: 16px;
    width: 100%;
    resize: vertical;
    background-color: var(--hf-input-bg);
    color: var(--hf-text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    appearance: none;
    box-sizing: border-box;
}

[id^="hf-form-"] input::placeholder,
[id^="hf-form-"] textarea::placeholder {
    color: #9CA3AF;
}

/* Focus states */
[id^="hf-form-"] input:focus,
[id^="hf-form-"] select:focus,
[id^="hf-form-"] textarea:focus {
    outline: none;
    border-color: var(--hf-secondary);
    box-shadow: 0 0 0 3px rgba(49, 180, 141, 0.15);
    background-color: var(--hf-white);
}

/* 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: var(--hf-secondary);
    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' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 1em;
    padding-right: 48px;
}

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

/* --------------------------------------------------------------------------
   Submit Button
   -------------------------------------------------------------------------- */
[id^="hf-form-"] .submit-button {
    background-color: var(--hf-secondary);
    color: var(--hf-white);
    padding: 16px 32px;
    border: none;
    border-radius: var(--hf-radius-button);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
    margin-top: 8px;
}

[id^="hf-form-"] .submit-button:hover {
    background-color: #28a07a;
    transform: translateY(-1px);
}

[id^="hf-form-"] .submit-button:active {
    transform: translateY(0);
}

/* --------------------------------------------------------------------------
   Form Elements
   -------------------------------------------------------------------------- */
[id^="hf-form-"] .hf-privacy-policy {
    font-size: 13px;
    line-height: 1.5;
    color: var(--hf-text-muted);
}

[id^="hf-form-"] .hf-footer-note {
    font-size: 13px;
    color: var(--hf-text-muted);
    margin-top: 8px;
    text-align: center;
}

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

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

[id^="hf-form-"] .hf-success {
    text-align: center;
    font-size: 18px;
    font-weight: 500;
}

[id^="hf-form-"] .hf-loading {
    text-align: center;
    font-size: 1rem;
    color: var(--hf-primary);
}

[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); }
}

/* --------------------------------------------------------------------------
   Layout Modes
   -------------------------------------------------------------------------- */
/* 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: 8px 16px;
}

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

@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: 1rem;
}

/* ==========================================================================
   THEME: Symphony (Light Blue) - Default modern theme
   ========================================================================== */
[id^="hf-form-"].hf-symphony {
    background-color: var(--hf-blue-light);
    border-radius: var(--hf-radius-card);
    padding: 40px;
    border: none;
}

[id^="hf-form-"].hf-symphony h2 {
    color: var(--hf-text);
}

[id^="hf-form-"].hf-symphony input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
[id^="hf-form-"].hf-symphony select,
[id^="hf-form-"].hf-symphony textarea {
    background-color: var(--hf-input-bg);
    border: none;
}

[id^="hf-form-"].hf-symphony input:focus,
[id^="hf-form-"].hf-symphony select:focus,
[id^="hf-form-"].hf-symphony textarea:focus {
    border: none;
    box-shadow: 0 0 0 3px rgba(49, 180, 141, 0.2);
    background-color: var(--hf-input-bg);
}

[id^="hf-form-"].hf-symphony .submit-button {
    background-color: var(--hf-secondary);
}

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

/* ==========================================================================
   THEME: Purple
   ========================================================================== */
[id^="hf-form-"].hf-purple {
    background-color: var(--hf-purple-light);
    border-radius: var(--hf-radius-card);
    padding: 40px;
    border: none;
}

[id^="hf-form-"].hf-purple h2 {
    color: var(--hf-white);
}

[id^="hf-form-"].hf-purple .hf-field label {
    color: var(--hf-text);
}

[id^="hf-form-"].hf-purple input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
[id^="hf-form-"].hf-purple select,
[id^="hf-form-"].hf-purple textarea {
    background-color: var(--hf-white);
    border: none;
}

[id^="hf-form-"].hf-purple input:focus,
[id^="hf-form-"].hf-purple select:focus,
[id^="hf-form-"].hf-purple textarea:focus {
    border: none;
    box-shadow: 0 0 0 3px rgba(138, 91, 218, 0.2);
}

[id^="hf-form-"].hf-purple .submit-button {
    background-color: var(--hf-primary);
}

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

[id^="hf-form-"].hf-purple .hf-footer-note,
[id^="hf-form-"].hf-purple .hf-privacy-policy {
    color: var(--hf-text);
}

[id^="hf-form-"].hf-purple .hf-success {
    color: var(--hf-text);
}

[id^="hf-form-"].hf-purple .hf-loading {
    color: var(--hf-purple);
}

/* ==========================================================================
   THEME: Dark / Blue (Legacy - updated)
   ========================================================================== */
[id^="hf-form-"].hf-bg-dark {
    border-radius: var(--hf-radius-card);
    padding: 40px;
}

[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: var(--hf-white);
}

[id^="hf-form-"].hf-bg-dark input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
[id^="hf-form-"].hf-bg-dark select,
[id^="hf-form-"].hf-bg-dark textarea,
[id^="hf-form-"].hf-bg-dark input[type="date"] {
    background-color: var(--hf-white);
    border: none;
    border-radius: var(--hf-radius-input);
}

[id^="hf-form-"].hf-bg-dark .submit-button {
    background-color: var(--hf-secondary);
}

[id^="hf-form-"].hf-bg-dark .hf-success {
    color: var(--hf-white);
}

[id^="hf-form-"].hf-bg-dark .hf-loading {
    color: var(--hf-secondary);
}

/* ==========================================================================
   THEME: Light (White background)
   ========================================================================== */
[id^="hf-form-"].hf-bg-white {
    background-color: var(--hf-white);
    border-radius: var(--hf-radius-card);
    border: none;
}

[id^="hf-form-"].hf-bg-white input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
[id^="hf-form-"].hf-bg-white select,
[id^="hf-form-"].hf-bg-white textarea {
    background-color: var(--hf-input-bg);
    border: none;
}

/* ==========================================================================
   THEME: Card (Light gray background)
   ========================================================================== */
[id^="hf-form-"].hf-bg-light {
    background-color: #F3F4F6;
    border-radius: var(--hf-radius-card);
    padding: 40px;
    border: none;
}

[id^="hf-form-"].hf-bg-light input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
[id^="hf-form-"].hf-bg-light select,
[id^="hf-form-"].hf-bg-light textarea {
    background-color: var(--hf-white);
    border: none;
}

/* ==========================================================================
   THEME: Ebook (Legacy - kept for compatibility)
   ========================================================================== */
[id^="hf-form-"].hf-ebook-theme {
    background-color: var(--hf-white);
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 24px;
    gap: 8px;
    margin: 0 auto;
}

[id^="hf-form-"].hf-ebook-theme .hf-pre-title {
    color: var(--hf-secondary);
    font-weight: 600;
    text-align: left;
    margin-bottom: 0 !important;
}

[id^="hf-form-"].hf-ebook-theme h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--hf-primary);
    text-align: left;
    margin-top: 0;
}

[id^="hf-form-"].hf-ebook-theme .hf-description {
    font-size: 1.25rem;
    margin-bottom: 20px;
}

[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;
    }
}

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

[id^="hf-form-"].hf-ebook-theme .submit-button {
    background-color: var(--hf-secondary);
    color: white;
    font-weight: 600;
    padding: 14px 28px;
    border-radius: var(--hf-radius-button);
    margin-top: 16px;
    align-self: center;
}

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

/* ==========================================================================
   THEME: Bare (No styling - inherits page styles)
   ========================================================================== */
[id^="hf-form-"].hf-bare {
    background: transparent;
    padding: 0;
    border-radius: 0;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */
@media (max-width: 768px) {
    :root {
        --hf-radius-card: 25px;
    }

    [id^="hf-form-"] {
        padding: 24px;
    }

    [id^="hf-form-"].hf-symphony,
    [id^="hf-form-"].hf-purple,
    [id^="hf-form-"].hf-bg-dark,
    [id^="hf-form-"].hf-bg-light {
        padding: 28px;
    }

    [id^="hf-form-"] h2 {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    [id^="hf-form-"] {
        padding: 20px;
    }

    [id^="hf-form-"].hf-symphony,
    [id^="hf-form-"].hf-purple,
    [id^="hf-form-"].hf-bg-dark,
    [id^="hf-form-"].hf-bg-light {
        padding: 24px;
    }

    [id^="hf-form-"] input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
    [id^="hf-form-"] select,
    [id^="hf-form-"] textarea {
        padding: 16px 24px;
    }

    [id^="hf-form-"] .submit-button {
        padding: 14px 24px;
    }
}

/* ==========================================================================
   LAYOUT: Horizontal (Title | Fields | Submit in one row)
   ========================================================================== */
[id^="hf-form-"].horizontal {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px 24px;
}

[id^="hf-form-"].horizontal h2 {
    flex: 0 0 auto;
    margin: 0;
    white-space: nowrap;
    order: 1;
}

[id^="hf-form-"].horizontal .hf-fields {
    flex: 1 1 auto;
    min-width: 200px;
    order: 2;
}

[id^="hf-form-"].horizontal .hf-fields fieldset {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 12px;
    align-items: center;
}

[id^="hf-form-"].horizontal .hf-fields .hf-field {
    flex: 1 1 150px;
    min-width: 150px;
}

[id^="hf-form-"].horizontal .hf-fields .hf-field label {
    margin-top: 0;
    margin-bottom: 4px;
}

[id^="hf-form-"].horizontal .submit-button {
    flex: 0 0 auto;
    margin-top: 0;
    order: 3;
}

[id^="hf-form-"].horizontal .hf-footer-note {
    flex: 0 0 100%;
    margin-top: -8px;
    text-align: center;
    order: 10;
}

[id^="hf-form-"].horizontal .hf-loading {
    flex: 0 0 100%;
    order: 9;
}

[id^="hf-form-"].horizontal .hf-recaptcha {
    flex: 0 0 100%;
    margin-top: 0;
    order: 5;
}

/* Hide labels in horizontal layout for cleaner appearance */
[id^="hf-form-"].horizontal .hf-fields .hf-field label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Responsive: Stack on smaller screens */
@media (max-width: 768px) {
    [id^="hf-form-"].horizontal {
        flex-direction: column;
        align-items: stretch;
    }

    [id^="hf-form-"].horizontal h2 {
        text-align: center;
        white-space: normal;
    }

    [id^="hf-form-"].horizontal .hf-fields fieldset {
        flex-direction: column;
    }

    [id^="hf-form-"].horizontal .hf-fields .hf-field {
        flex: 1 1 100%;
    }

    [id^="hf-form-"].horizontal .submit-button {
        width: 100%;
    }
}
