/* ============================================================
   Brevo Newsletter Form — Frontend Form Styles
   ============================================================ */

.bnf-form-wrap {
    --bnf-primary:     #0073aa;
    --bnf-primary-hov: #005a87;
    --bnf-radius:      6px;
    --bnf-border:      #d1d5db;
    --bnf-bg:          #f9fafb;
    --bnf-focus:       rgba(0,115,170,.25);
    --bnf-text:        #1f2937;
    --bnf-label:       #374151;
    --bnf-red:         #dc2626;
    --bnf-green:       #16a34a;

    font-family: inherit;
    width: 100%;
}

/* ---- Form layout ---- */
.bnf-form { width: 100%; }

.bnf-fields {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

/* These fields always span full width */
.bnf-field--privacy,
.bnf-field--phone    { grid-column: 1 / -1; }

/* ---- Label ---- */
.bnf-field label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;       /* base — overridden by inline style from settings */
    font-weight: 600;      /* base — overridden by inline style from settings */
    color: #374151;        /* base — overridden by inline style from settings */
}

.bnf-required {
    color: var(--bnf-red);
    margin-left: 2px;
}

/* ---- Inputs / Select ---- */
.bnf-form input[type="text"],
.bnf-form input[type="email"],
.bnf-form input[type="tel"],
.bnf-form input[type="date"],
.bnf-form select {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--bnf-border);
    border-radius: var(--bnf-radius);
    background: #fff;
    font-size: 15px;
    color: var(--bnf-text);
    transition: border-color .15s, box-shadow .15s;
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
}

.bnf-form input:focus,
.bnf-form select:focus {
    outline: none;
    border-color: var(--bnf-primary);
    box-shadow: 0 0 0 3px var(--bnf-focus);
}

.bnf-form input.bnf-invalid,
.bnf-form select.bnf-invalid {
    border-color: var(--bnf-red);
    box-shadow: 0 0 0 3px rgba(220,38,38,.15);
}

/* Chevron arrow for selects */
.bnf-form select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath fill='%236b7280' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}

/* ---- Phone field ---- */
.bnf-phone-wrap {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

/* The dial-code select now contains full country names — give it enough room */
.bnf-phone-code {
    flex: 0 0 auto;
    width: 260px;
    max-width: 55%;
}

@media (max-width: 520px) {
    .bnf-phone-wrap     { flex-direction: column; }
    .bnf-phone-code     { width: 100%; max-width: 100%; }
}

.bnf-phone-wrap input[type="tel"] {
    flex: 1;
    min-width: 0; /* prevent overflow in flex context */
}

/* ---- Privacy checkbox ---- */
.bnf-privacy-label {
    display: flex !important;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-weight: 400 !important;
    font-size: 14px;
    line-height: 1.5;
    color: var(--bnf-label);
}

.bnf-privacy-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 1px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--bnf-primary);
}

.bnf-privacy-label a {
    color: var(--bnf-primary);
    text-decoration: underline;
}
.bnf-privacy-label a:hover { color: var(--bnf-primary-hov); }

/* ---- Submit button ---- */
.bnf-submit-wrap {
    margin-top: 20px;
}

.bnf-submit-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: var(--bnf-primary);
    color: #fff;
    border: none;
    border-radius: var(--bnf-radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, transform .1s;
}

.bnf-submit-btn:hover:not(:disabled) { background: var(--bnf-primary-hov); }
.bnf-submit-btn:active               { transform: scale(.98); }
.bnf-submit-btn:disabled             { opacity: .7; cursor: not-allowed; }

/* Spinner */
.bnf-btn-spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: bnf-spin .7s linear infinite;
}

.bnf-loading .bnf-btn-spinner { display: inline-block; }

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

/* ---- Messages ---- */
.bnf-messages {
    margin-top: 14px;
    font-size: 14px;
    font-weight: 500;
    min-height: 0;
}

.bnf-msg-success {
    padding: 12px 16px;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: var(--bnf-radius);
    color: var(--bnf-green);
}

.bnf-msg-error {
    padding: 12px 16px;
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: var(--bnf-radius);
    color: var(--bnf-red);
}
