/* ============================================================
   NEWSLETTER WIDGET — Footer subscription form
   ============================================================ */

.nw-widget {
    padding: 0px 0 0px;
    color: #fff;
}

.nw-widget__header {
    margin-bottom: 20px;
}

.nw-widget__title {
    font-size: clamp(18px, 2.5vw, 26px);
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin: 0 0 10px;
    font-family: var(--font-heading-bold, sans-serif);
    line-height: 1.2;
}

.nw-widget__subtitle {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.55);
    margin: 0;
    line-height: 1.6;
}

/* ============================================================
   CARDS GRID
   ============================================================ */

.nw-widget__cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 28px;
}

@media (max-width: 900px) {
    .nw-widget__cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .nw-widget__cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

/* ============================================================
   CARD
   ============================================================ */

.nw-card {
    display: block;
    background-color: transparent;
    color: var(--nw-card-bg, #fff);
    border: 1.5px solid var(--nw-card-bg, #fff);
    cursor: pointer;
    position: relative;
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-width 0.18s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.nw-card:hover {
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
    border-width: 2px;
}

.nw-card.is-selected {
    border-width: 2.5px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
}

.nw-card__checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.nw-card__inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 16px;
    box-sizing: border-box;
}

.nw-card__top {
    display: flex;
    justify-content: flex-end;
    margin-bottom: auto;
}

.nw-card__bottom {
    margin-top: auto;
}

.nw-card__title {
    font-size: var(--nw-card-title-size, 20px);
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    margin: 0 0 6px;
    font-family: var(--font-heading-bold, sans-serif);
    line-height: 1.1;
    color: var(--nw-card-title-color, var(--nw-card-bg, #fff));
}

.nw-card__desc {
    font-size: var(--nw-card-desc-size, 11px);
    line-height: 1.5;
    margin: 0;
    color: var(--nw-card-desc-color, rgba(255, 255, 255, 0.65));
}

@media (max-width: 480px) {
    .nw-card__inner {
        padding: 12px;
    }
}

/* ============================================================
   TOGGLE TRACK (visual indicator)
   ============================================================ */

.nw-toggle-track {
    display: block;
    width: 38px;
    height: 21px;
    background: transparent;
    border: 1.5px solid var(--nw-card-toggle-color, var(--nw-card-bg, #fff));
    border-radius: 11px;
    position: relative;
    transition: background 0.22s ease, border-color 0.22s ease;
    flex-shrink: 0;
}

.nw-toggle-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 15px;
    height: 15px;
    background: var(--nw-card-toggle-color, var(--nw-card-bg, #fff));
    border-radius: 50%;
    transition: transform 0.22s ease, background 0.22s ease;
    opacity: 0.5;
}

/* Toggle active state via checkbox sibling */
.nw-card__checkbox:checked ~ .nw-card__inner .nw-toggle-track {
    background: var(--nw-card-toggle-color, var(--nw-card-bg, #fff));
}

.nw-card__checkbox:checked ~ .nw-card__inner .nw-toggle-track::after {
    transform: translateX(17px);
    background: #000;
    opacity: 1;
}

/* ============================================================
   MAIN CTA
   ============================================================ */

.nw-widget__cta {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin: 0 0 0px;
    transition: margin 0.28s ease;
}

.nw-widget__cta .nw-widget__error {
    order: -1;
}

/* ============================================================
   FORM WRAPPER
   ============================================================ */

.nw-widget__form {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
    pointer-events: none;
}

.nw-widget__form.is-visible {
    max-height: 800px;
    opacity: 1;
    pointer-events: auto;
    margin-bottom: 10px;
}

.nw-form__row {
    margin-bottom: 12px;
}

.nw-form__row-3col {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.nw-form__row--hidden {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    margin-bottom: 0;
    transition: max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease, margin-bottom 0.35s ease;
    pointer-events: none;
}

.nw-form__row--hidden.is-visible {
    max-height: 500px;
    opacity: 1;
    pointer-events: auto;
}

/* ============================================================
   FORM FIELDS
   ============================================================ */

.nw-form__field {
    position: relative;
}

.nw-form__field--hidden {
    display: none;
}

.nw-form__field input,
.nw-form__field select {
    display: block;
    width: 100%;
    background: #fff;
    border: 1px solid #fff;
    color: #111;
    padding: 15px 16px 5px;
    font-size: 14px;
    font-family: var(--font-paragraph, Arial, sans-serif);
    outline: none;
    transition: border-color 0.2s ease, background 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
    line-height: 1.5 !important;
    border-radius: 0px ;
}

.nw-form__field input:focus,
.nw-form__field select:focus {
    border-color: #fff;
    background: #fff;
}

.nw-form__field select option {
    background: #fff;
    color: #111;
}

/* Floating label */
.nw-field-label {
    position: absolute;
    left: 16px;
    top: 14px;
    font-size: 14px;
    color: #111;
    pointer-events: none;
    transition: top 0.18s ease, font-size 0.18s ease, color 0.18s ease, letter-spacing 0.18s ease;
    line-height: 1;
}

.nw-form__field input:focus ~ .nw-field-label,
.nw-form__field input:not(:placeholder-shown) ~ .nw-field-label,
.nw-form__field select:focus ~ .nw-field-label,
.nw-form__field--select.has-value .nw-field-label {
    top: 6px;
    font-size: 10px;
    letter-spacing: 0.6px;
    color: #111;
}

/* Field error state */
.nw-form__field input.nw-field--error {
    border-color: #ff6b6b;
}

.nw-field-error-msg {
    display: block;
    font-size: 11px;
    color: #ff6b6b;
    margin-top: 4px;
    line-height: 1.4;
}

/* Select arrow */
.nw-form__field--select {
    position: relative;
}

.nw-select-arrow {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid #111;
    transition: transform 0.2s ease;
}

.nw-form__field--select select:focus ~ .nw-select-arrow {
    transform: translateY(-50%) rotate(180deg);
    top: calc(50%);
}

/* Two-column row for profile + job title */
.nw-form__row-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 16px;
}

@media (max-width: 600px) {
    .nw-form__row-3col {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .nw-form__row-2col {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* Desktop: Nome, Cognome, Email allineati; privacy su riga separata */
@media (min-width: 1024px) {
    #nw-form-wrap.is-visible .nw-form {
        display: grid;
        grid-template-columns: 0.75fr 0.75fr 1fr 1fr;
        gap: 14px;
        align-items: start;
    }

    #nw-form-wrap.is-visible #nw-main-fields-row {
        display: contents;
        margin-bottom: 0;
    }

    #nw-form-wrap.is-visible #nw-profile-row {
        display: contents;
        max-height: none;
    }

    #nw-form-wrap.is-visible #nw-main-fields-row > .nw-form__field:nth-child(1) { grid-column: 1; }
    #nw-form-wrap.is-visible #nw-main-fields-row > .nw-form__field:nth-child(2) { grid-column: 2; }
    #nw-form-wrap.is-visible #nw-main-fields-row > .nw-form__field:nth-child(3) { grid-column: 3; }

    #nw-form-wrap.is-visible #nw-profile-row .nw-form__row-2col {
        display: contents;
        margin-bottom: 0;
    }

    #nw-form-wrap.is-visible #nw-profile-row .nw-form__row-2col > .nw-form__field:nth-child(1) {
        grid-column: 4;
    }

    #nw-form-wrap.is-visible #nw-profile-row .nw-form__row-2col > .nw-form__field:nth-child(2):not(.nw-form__field--hidden) {
        grid-column: 1 / span 2;
    }

    #nw-form-wrap.is-visible #nw-profile-row .nw-form__privacy {
        grid-column: 1 / -1;
        margin-top: 6px;
    }
}

/* ============================================================
   PRIVACY CHECKBOX
   ============================================================ */

.nw-form__privacy {
    margin-bottom: 20px;
}

.nw-privacy-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    line-height: 1.5;
}

.nw-privacy-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.nw-privacy-box {
    flex-shrink: 0;
    width: 17px;
    height: 17px;
    border: 1.5px solid #fff;
    border-radius: 0px;
    margin-top: 1px;
    position: relative;
    transition: background 0.18s, border-color 0.18s;
    background: transparent;
}

.nw-privacy-label input:checked ~ .nw-privacy-box {
    background: #fff;
    border-color: #fff;
}

.nw-privacy-label input:checked ~ .nw-privacy-box::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 5px;
    height: 9px;
    border-right: 2px solid #111;
    border-bottom: 2px solid #111;
    transform: rotate(40deg);
}

.nw-privacy-text {
    font-size: 12px;
    color: #fff;
    line-height: 1.5;
}

.nw-privacy-text a {
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.nw-privacy-text a:hover {
    color: rgba(255, 255, 255, 0.8);
}

/* ============================================================
   SUBMIT BUTTON
   ============================================================ */

.nw-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    color: #111;
    border: none;
    padding: 13px 36px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: 0px;
    transition: background 0.18s ease, opacity 0.18s ease, transform 0.15s ease;
    font-family: var(--font-heading-bold, sans-serif);
    position: relative;
    white-space: nowrap;
}

.nw-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.88);
    transform: translateY(-1px);
}

.nw-btn:disabled {
    opacity: 0.38;
    cursor: not-allowed;
    transform: none;
}

.nw-btn__loader {
    display: none;
    width: 13px;
    height: 13px;
    border: 2px solid rgba(0, 0, 0, 0.18);
    border-top-color: #111;
    border-radius: 50%;
    animation: nw-spin 0.65s linear infinite;
}

.nw-btn.is-loading .nw-btn__loader {
    display: block;
}

.nw-btn.is-loading .nw-btn__text {
    opacity: 0.55;
}

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

/* ============================================================
   SUCCESS STATE
   ============================================================ */

.nw-widget__success {
    text-align: center;
    padding: 48px 20px;
    animation: nw-fadeUp 0.5s ease;
}

.nw-widget__success[hidden] {
    display: none;
}

.nw-success__icon {
    width: 54px;
    height: 54px;
    background: #fff;
    color: #111;
    border-radius: 50%;
    font-size: 22px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.nw-success__title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 10px;
    letter-spacing: 0.5px;
}

.nw-success__message {
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    margin: 0;
    line-height: 1.6;
}

/* ============================================================
   ERROR STATE
   ============================================================ */

.nw-widget__error {
    margin-top: 10px;
}

.nw-widget__error--selection {
    margin-top: 0;
}

.nw-widget__error[hidden] {
    display: none;
}

.nw-error__message {
    font-size: 14px;
    color: #ff2f2f;
    margin: 0;
    line-height: 1.5;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */

@keyframes nw-fadeUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================
   DONE STATE (after submission)
   ============================================================ */

.nw-widget--done .nw-widget__cards {
    opacity: 0.35;
    pointer-events: none;
}

.nw-widget--done .nw-widget__form {
    display: none;
}
