/*
 * NuciBici Forms — frontend
 *
 * - Every box and button is a pill (fully semicircular ends).
 * - Fields are uncoloured: transparent, black outline.
 * - Only the send button is coloured, by site section:
 *     welcome   blue    / white text
 *     community red     / white text
 *     museum    black   / white text
 *     events    yellow  / black text
 *     cake      green   / white text
 *     gallery   yellow  / black text
 * - Button text is never underlined.
 *
 * !important is used on the properties the Hello Elementor parent theme also
 * sets on inputs and buttons, the same way the theme's own stylesheet does.
 */

.nb-form {
    --nb-h: var(--nav-height, 28px);
    --nb-y: var(--ypsilon, 2vw);
    --nb-btn-bg: #fbdd03;
    --nb-btn-fg: #000;

    box-sizing: border-box;
    width: 100%;
    max-width: 760px;
    margin: 0;
    color: #000;
    font-family: Arial, Helvetica, sans-serif;
}

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

.nb-form--center {
    margin-left: auto;
    margin-right: auto;
}

/* Inside the Events page's inline panel the panel already sets the width. */
.nucibici-submit-inline .nb-form {
    max-width: none;
}

/* Send-button colours per site section */
.nb-section--welcome   { --nb-btn-bg: var(--welcome, #1380c3);   --nb-btn-fg: #fff; }
.nb-section--community { --nb-btn-bg: var(--community, #d51e30); --nb-btn-fg: #fff; }
.nb-section--museum    { --nb-btn-bg: var(--museum, #000);       --nb-btn-fg: #fff; }
.nb-section--events    { --nb-btn-bg: var(--events, #fbdd03);    --nb-btn-fg: #000; }
.nb-section--cake      { --nb-btn-bg: var(--cake, #41ac4a);      --nb-btn-fg: #fff; }
.nb-section--gallery   { --nb-btn-bg: var(--events, #fbdd03);    --nb-btn-fg: #000; }

/* Layout */
.nb-form .nb-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--nb-y);
    margin: 0;
}

.nb-form .nb-field {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: calc(var(--nb-y) / 3);
    min-width: 0;
    margin: 0;
}

.nb-form .nb-field--full {
    grid-column: 1 / -1;
}

.nb-form .nb-label {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    color: #000;
    font-size: inherit;
    font-weight: 600;
    line-height: 1.3;
    text-align: center;
}

/* Fields: uncoloured pills */
.nb-form .nb-control {
    display: block;
    width: 100%;
    height: var(--nb-h);
    min-height: 0;
    margin: 0;
    padding: 0 calc(var(--nb-h) * .6) !important;
    border: 1.5px solid #000 !important;
    border-radius: 9999px !important;
    background-color: transparent !important;
    color: #000 !important;
    font: inherit;
    line-height: 1;
    text-align: left;
    outline: 0;
    box-shadow: none;
    -webkit-appearance: none;
    appearance: none;
}

.nb-form .nb-control:focus,
.nb-form .nb-control:focus-visible {
    border-color: #000 !important;
    background-color: transparent !important;
    box-shadow: inset 0 0 0 1px #000 !important;
    outline: 0;
}

.nb-form .nb-select,
.nb-form .nb-input--date {
    text-align: center;
    text-align-last: center;
}

.nb-form .nb-select {
    padding-right: calc(var(--nb-h) * .9) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23000' stroke-width='1.5'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right calc(var(--nb-h) * .4) center !important;
    background-size: 10px auto !important;
}

.nb-form .nb-input--date {
    min-width: 0;
    max-width: 100%;
}

/* Multi-line: the radius is larger than half the height, so the browser
   clamps it and the ends stay fully semicircular at any number of lines. */
.nb-form .nb-textarea {
    height: auto;
    min-height: calc(var(--nb-h) * 2.4);
    padding: calc(var(--nb-h) * .4) calc(var(--nb-h) * 1.1) !important;
    line-height: 1.4;
    resize: none;
}

/* File chooser: a pill button, uncoloured like the other fields */
.nb-form .nb-file {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: calc(var(--nb-y) / 3);
    width: 100%;
}

.nb-form .nb-file-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: var(--nb-h);
    margin: 0;
    padding: 0 calc(var(--nb-y) * .9);
    border: 1.5px solid #000;
    border-radius: 9999px;
    background: transparent;
    color: #000;
    font-weight: 600;
    text-decoration: none !important;
    white-space: nowrap;
    cursor: pointer;
}

.nb-form .nb-file-button:focus-within {
    box-shadow: inset 0 0 0 1px #000;
}

.nb-form .nb-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    overflow: hidden;
    opacity: 0;
    clip: rect(0 0 0 0);
}

.nb-form .nb-file-names,
.nb-form .nb-help {
    display: block;
    max-width: 100%;
    font-size: .9em;
    line-height: 1.4;
    text-align: center;
    overflow-wrap: anywhere;
}

.nb-form .nb-help {
    color: #555;
}

.nb-form .nb-file-names.is-error {
    color: #d51e30;
}

/* Send button: the only coloured element */
.nb-form .nb-actions {
    display: flex;
    justify-content: center;
    margin-top: var(--nb-y);
}

.nb-form .nb-submit,
.nb-form .nb-submit:hover,
.nb-form .nb-submit:focus,
.nb-form .nb-submit:focus-visible,
.nb-form .nb-submit:active,
.nb-form .nb-submit:visited {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: var(--nb-h);
    min-height: 0;
    margin: 0;
    padding: 0 calc(var(--nb-y) * .9) !important;
    border: 0 !important;
    border-radius: 9999px !important;
    background: var(--nb-btn-bg) !important;
    background-image: none !important;
    color: var(--nb-btn-fg) !important;
    font: inherit;
    font-weight: 600;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    text-decoration: none !important;
    white-space: nowrap;
    box-shadow: none !important;
    outline: 0;
    opacity: 1;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.nb-form .nb-submit:focus-visible {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #000 !important;
}

.nb-form .nb-submit[disabled] {
    opacity: .6;
    cursor: default;
}

/* Messages */
.nb-form .nb-response {
    min-height: 1.4em;
    margin-top: var(--nb-y);
    color: #000;
    text-align: center;
    line-height: 1.4;
}

.nb-form .nb-response.is-error {
    color: #d51e30;
}

/* "I agree" tick-box: a round pill with a black dot when ticked (uncoloured like the other fields) */
.nb-form .nb-field--checkbox {
    align-items: center;
}

.nb-form .nb-check {
    display: inline-flex;
    align-items: center;
    gap: calc(var(--nb-y) / 2);
    max-width: 100%;
    margin: 0;
    font-weight: 600;
    line-height: 1.4;
    text-align: left;
    cursor: pointer;
}

.nb-form .nb-check-input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    overflow: hidden;
    opacity: 0;
    clip: rect(0 0 0 0);
}

.nb-form .nb-check-box {
    flex: 0 0 auto;
    box-sizing: border-box;
    width: calc(var(--nb-h) * .7);
    height: calc(var(--nb-h) * .7);
    border: 1.5px solid #000;
    border-radius: 9999px;
    background: transparent;
}

.nb-form .nb-check-input:checked + .nb-check-box {
    background: #000;
    box-shadow: inset 0 0 0 3px #fff;
}

.nb-form .nb-check-input:focus-visible + .nb-check-box {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #000;
}

.nb-form .nb-check-input:checked:focus-visible + .nb-check-box {
    box-shadow: inset 0 0 0 3px #fff, 0 0 0 2px #fff, 0 0 0 4px #000;
}

.nb-form .nb-check-text a {
    color: #000;
    text-decoration: underline;
}

/* Members-only prompt, and fields filled in from a member's account */
.nb-form .nb-members-note {
    margin: 0 0 var(--nb-y);
    text-align: center;
    line-height: 1.4;
}

.nb-form .nb-control[readonly] {
    cursor: default;
}

/* Honeypot: off-screen, not display:none (some bots skip display:none) */
.nb-form .nb-hp {
    position: absolute !important;
    left: -9999px !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

@media (max-width: 520px) {
    .nb-form .nb-fields {
        grid-template-columns: 1fr;
    }

    .nb-form .nb-field--half {
        grid-column: 1 / -1;
    }
}
