/* H3X Contact Form — frontend styles.
 *
 * The accent colour (and its derived darker / contrast values) are
 * injected inline on the form element as CSS custom properties:
 *   --h3xcf-accent       primary brand colour
 *   --h3xcf-accent-dark  hover/active for the submit button
 *   --h3xcf-accent-fg    legible foreground (black or white) for text
 *                        sitting on the accent background
 * Everything else falls back to neutral defaults so the form looks fine
 * even if the inline values are missing.
 */

.h3xcf-form {
    --h3xcf-accent: #f06402;
    --h3xcf-accent-dark: #d35702;
    --h3xcf-accent-fg: #ffffff;
    --h3xcf-bg: #ffffff;
    --h3xcf-border: #e2e5ea;
    --h3xcf-border-strong: #c4c9d2;
    --h3xcf-text: #1c1f23;
    --h3xcf-text-muted: #6b7280;
    --h3xcf-radius: 10px;
    --h3xcf-shadow: 0 1px 2px rgba(20, 24, 33, 0.04), 0 8px 24px rgba(20, 24, 33, 0.06);

    display: block;
    max-width: 720px;
    margin: 0 auto;
    padding: 2rem 2rem 1.75rem;
    background: var(--h3xcf-bg);
    border: 1px solid var(--h3xcf-border);
    border-radius: var(--h3xcf-radius);
    box-shadow: var(--h3xcf-shadow);
    color: var(--h3xcf-text);
    font-family: inherit;
    line-height: 1.5;
    box-sizing: border-box;
}

.h3xcf-form *,
.h3xcf-form *::before,
.h3xcf-form *::after {
    box-sizing: border-box;
}

/* ---- Field layout -------------------------------------------------- */

/* The standard fields live in a flex row that wraps. A field with an
   explicit width (set inline by the renderer) keeps that width, so two
   consecutive narrow fields (each <= ~40% of the form, + the 4% gap) pair
   up on one line; anything wider takes the full row. Fields without a set
   width default to a full-width line. */
.h3xcf-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem 4%;
    align-items: flex-start;
}

.h3xcf-fields > .h3xcf-field {
    flex: 1 1 100%;
    min-width: 0;
    margin-bottom: 0;
}

/* ---- Field cards --------------------------------------------------- */

.h3xcf-field {
    display: block;
    margin-bottom: 1.25rem;
}

.h3xcf-field > label {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--h3xcf-text);
    margin-bottom: 0.4rem;
}

.h3xcf-req {
    color: var(--h3xcf-accent);
    font-weight: 700;
    margin-left: 2px;
}

.h3xcf-help {
    margin: 0.35rem 0 0;
    font-size: 0.82rem;
    color: var(--h3xcf-text-muted);
    line-height: 1.45;
}

/* ---- Inputs -------------------------------------------------------- */

.h3xcf-field input[type="text"],
.h3xcf-field input[type="email"],
.h3xcf-field input[type="tel"],
.h3xcf-field input[type="number"],
.h3xcf-field select,
.h3xcf-field textarea {
    width: 100%;
    padding: 0.7rem 0.85rem;
    font: inherit;
    font-size: 0.95rem;
    line-height: 1.4;
    color: var(--h3xcf-text);
    background: #ffffff;
    border: 1px solid var(--h3xcf-border-strong);
    border-radius: 8px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    -webkit-appearance: none;
       -moz-appearance: none;
            appearance: none;
}

.h3xcf-field select {
    background-image:
        linear-gradient(45deg, transparent 50%, currentColor 50%),
        linear-gradient(135deg, currentColor 50%, transparent 50%);
    background-position:
        calc(100% - 18px) calc(50% - 2px),
        calc(100% - 13px) calc(50% - 2px);
    background-size: 5px 5px;
    background-repeat: no-repeat;
    padding-right: 2.25rem;
}

.h3xcf-field textarea {
    min-height: 7.5rem;
    resize: vertical;
}

.h3xcf-field input:focus,
.h3xcf-field select:focus,
.h3xcf-field textarea:focus {
    outline: 0;
    border-color: var(--h3xcf-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--h3xcf-accent) 20%, transparent);
}

.h3xcf-field input::placeholder,
.h3xcf-field textarea::placeholder {
    color: var(--h3xcf-text-muted);
    opacity: 0.85;
}

.h3xcf-field input[type="file"] {
    width: 100%;
    padding: 0.55rem 0.6rem;
    border: 1px dashed var(--h3xcf-border-strong);
    border-radius: 8px;
    background: #fbfbfc;
    font-size: 0.9rem;
}

.h3xcf-field input[type="file"]:focus {
    outline: 0;
    border-color: var(--h3xcf-accent);
}

/* ---- Radio / checkbox groups -------------------------------------- */

.h3xcf-radio-group,
.h3xcf-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.6rem 0.85rem;
    background: #fbfbfc;
    border: 1px solid var(--h3xcf-border);
    border-radius: 8px;
}

.h3xcf-radio,
.h3xcf-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
    cursor: pointer;
    font-size: 0.95rem;
}

.h3xcf-radio input,
.h3xcf-checkbox input {
    accent-color: var(--h3xcf-accent);
    width: 1.05em;
    height: 1.05em;
    margin: 0;
}

/* ---- Submit button ------------------------------------------------- */

.h3xcf-actions {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--h3xcf-border);
}

.h3xcf-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 140px;
    padding: 0.8rem 1.6rem;
    font: inherit;
    font-size: 1rem;
    font-weight: 600;
    color: var(--h3xcf-accent-fg);
    background: var(--h3xcf-accent);
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    letter-spacing: 0.01em;
    transition: background 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 2px 8px color-mix(in srgb, var(--h3xcf-accent) 25%, transparent);
}

.h3xcf-submit:hover {
    background: var(--h3xcf-accent-dark);
}

.h3xcf-submit:active {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.h3xcf-submit:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--h3xcf-accent) 30%, transparent);
}

/* ---- Notices ------------------------------------------------------- */

.h3xcf-notice {
    padding: 0.85rem 1rem;
    border-radius: 8px;
    margin: 0 auto 1.25rem;
    max-width: 720px;
    font-size: 0.95rem;
    line-height: 1.45;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}

.h3xcf-notice--success {
    background: #ecfdf3;
    border: 1px solid #b6e7c9;
    color: #1a5d2e;
}

.h3xcf-notice--success::before {
    content: "✓";
    font-weight: 700;
    margin-right: 0.1rem;
}

.h3xcf-notice--error,
.h3xcf-error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #7f1d1d;
}

.h3xcf-notice--error::before {
    content: "!";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.2em;
    height: 1.2em;
    background: #7f1d1d;
    color: #fff;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.85em;
    flex-shrink: 0;
}

/* ---- Turnstile widget ---------------------------------------------- */

.h3xcf-turnstile {
    margin: 1.25rem 0 0;
    min-height: 65px; /* avoid layout shift while widget loads */
}

/* ---- Product autocomplete + list ---------------------------------- */

.h3xcf-product-search,
.h3xcf-product-list {
    position: relative;
}

.h3xcf-product-search__results,
.h3xcf-product-list__results {
    position: absolute;
    z-index: 5;
    left: 0;
    right: 0;
    max-height: 280px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid var(--h3xcf-border-strong);
    border-radius: 8px;
    margin-top: 4px;
    box-shadow: 0 8px 24px rgba(20, 24, 33, 0.1);
}

.h3xcf-product-search__result,
.h3xcf-product-list__result {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.65rem 0.85rem;
    border: 0;
    border-bottom: 1px solid var(--h3xcf-border);
    background: #ffffff;
    cursor: pointer;
    font: inherit;
    color: var(--h3xcf-text);
}

.h3xcf-product-search__result:last-child,
.h3xcf-product-list__result:last-child {
    border-bottom: 0;
}

.h3xcf-product-search__result:hover,
.h3xcf-product-list__result:hover,
.h3xcf-product-search__result.is-active,
.h3xcf-product-list__result.is-active {
    background: color-mix(in srgb, var(--h3xcf-accent) 6%, #ffffff);
}

.h3xcf-product-search__result-name,
.h3xcf-product-list__result-name {
    font-weight: 600;
    display: block;
    color: var(--h3xcf-text);
}

.h3xcf-product-search__result-sku,
.h3xcf-product-list__result-sku {
    color: var(--h3xcf-text-muted);
    font-size: 0.85em;
}

.h3xcf-product-search__selected {
    margin-top: 0.6rem;
    padding: 0.6rem 0.85rem;
    background: #fbfbfc;
    border: 1px solid var(--h3xcf-border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.h3xcf-product-search__selected[hidden] {
    display: none;
}

.h3xcf-product-search__clear,
.h3xcf-product-list__remove {
    background: none;
    border: 0;
    color: #b91c1c;
    cursor: pointer;
    font: inherit;
    font-size: 0.85rem;
    text-decoration: underline;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

.h3xcf-product-search__clear:hover,
.h3xcf-product-list__remove:hover {
    background: #fef2f2;
}

.h3xcf-product-list__table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.75rem;
    font-size: 0.92rem;
}

.h3xcf-product-list__table thead {
    display: none;
}

.h3xcf-product-list:has(.h3xcf-product-list__row) .h3xcf-product-list__table thead {
    display: table-header-group;
    background: #fbfbfc;
}

.h3xcf-product-list__table th {
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--h3xcf-text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--h3xcf-border);
}

.h3xcf-product-list__table td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--h3xcf-border);
}

.h3xcf-product-list__qty {
    width: 4.5em;
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--h3xcf-border-strong);
    border-radius: 6px;
    font: inherit;
    font-size: 0.9rem;
    text-align: center;
}

/* ---- Mobile tightening -------------------------------------------- */

@media (max-width: 600px) {
    .h3xcf-form {
        padding: 1.25rem 1.1rem 1.1rem;
        border-radius: 8px;
    }
    /* Stack every field full-width on small screens, overriding any set
       field width so narrow fields don't get cramped. */
    .h3xcf-fields > .h3xcf-field {
        flex-basis: 100% !important;
        max-width: 100% !important;
    }
    .h3xcf-actions {
        margin-top: 1.1rem;
        padding-top: 1rem;
    }
    .h3xcf-submit {
        width: 100%;
    }
}
