/* ══════════════════════════════════════════════════════════════════════════════
   Newsletter block
   ══════════════════════════════════════════════════════════════════════════════ */

.newsletter {
    background: var(--wp--preset--color--dark);
    padding: 96px 0;
}

.newsletter .nw-inner {
    /* uses .container from theme */
}

/* ── Header ────────────────────────────────────────────────────────────────── */
.nw-header {
    margin-bottom: 40px;
}

.nw-title {
    font-size: 32px;
    font-weight: 400;
    line-height: 1;
    color: var(--wp--preset--color--white);
    margin: 0 0 16px;
}

.nw-rule {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
    margin: 0 0 16px;
}

.nw-rule--section {
    margin: 0;
}

.nw-desc,
.nw-desc p {
    font-size: 16px;
    font-weight: 300;
    line-height: 24px;
    color: var(--wp--preset--color--neutral-100);
    margin: 0;
}

/* ── Sections ──────────────────────────────────────────────────────────────── */
.nw-section {
    margin-bottom: 56px;
}

.nw-section-header {
    margin-bottom: 24px;
}

.nw-section-header--collapsible {
    cursor: pointer;
    user-select: none;
}

.nw-section-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.nw-section-title {
    font-size: 16px;
    font-weight: 300;
    line-height: 24px;
    color: var(--wp--preset--color--white);
    display: block;
    margin-bottom: 8px;
}

.nw-section-title-row .nw-section-title {
    margin-bottom: 0;
}

.nw-section-arrow {
    color: var(--wp--preset--color--white);
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

/* Collapsible section states */
.nw-section.is-collapsed .nw-section-arrow {
    transform: rotate(-90deg);
}

.nw-section-body {
    display: grid;
    grid-template-rows: 1fr;
    transition: grid-template-rows 0.35s ease;
}

.nw-section-body > div {
    min-height: 0;
    overflow: hidden;
}

.nw-section.is-collapsed .nw-section-body {
    grid-template-rows: 0fr;
}

/* ── "Zaznacz / Odznacz wszystkie" ─────────────────────────────────────────── */
.nw-section-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 16px;
}

.nw-toggle-all {
    background: none;
    border: none;
    padding: 0;
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
    color: var(--wp--preset--color--white);
    cursor: pointer;
    text-decoration: none;
}

.nw-toggle-all:hover {
    text-decoration: underline;
}

.nw-sep {
    color: var(--wp--preset--color--white);
    font-size: 14px;
    line-height: 20px;
    user-select: none;
}

/* ── Fields grid (Twoje dane) ──────────────────────────────────────────────── */
.nw-fields-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.nw-field {
    position: relative;
}

.nw-input,
.nw-select {
    width: 100%;
    height: 56px;
    background: var(--wp--preset--color--black);
    border: none;
    border-radius: 4px;
    padding: 0 24px;
    font-size: 14px;
    font-weight: 300;
    line-height: 20px;
    color: var(--wp--preset--color--white);
    appearance: none;
    -webkit-appearance: none;
    outline: none;
    font-family: inherit;
}

.nw-input::placeholder {
    color: var(--wp--preset--color--white);
    opacity: 1;
}

.nw-input:focus,
.nw-select:focus {
    outline: 2px solid rgba(255, 255, 255, 0.4);
    outline-offset: -2px;
}

/* Custom select arrow */
.nw-select-wrap {
    position: relative;
}

.nw-select-wrap .nw-select {
    padding-right: 52px;
    cursor: pointer;
}

.nw-chevron {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--wp--preset--color--white);
    pointer-events: none;
    flex-shrink: 0;
}

/* Select option colors */
.nw-select option {
    background: var(--wp--preset--color--black);
    color: var(--wp--preset--color--white);
}

/* ── Floating label ────────────────────────────────────────────────────────── */
.nw-label {
    position: absolute;
    left: 24px;
    right: 52px; /* stop before chevron */
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    font-weight: 300;
    line-height: 20px;
    color: rgba(255, 255, 255, 0.5);
    pointer-events: none;
    transition: top 0.15s ease, font-size 0.15s ease, transform 0.15s ease, color 0.15s ease, line-height 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nw-label-req {
    color: inherit;
}

/* Floating (focused or has value) — inputs */
.nw-input:focus ~ .nw-label,
.nw-input:not(:placeholder-shown) ~ .nw-label {
    top: 10px;
    transform: none;
    font-size: 10px;
    line-height: 12px;
    color: rgba(255, 255, 255, 0.7);
}

/* Shift text down in input when label floats */
.nw-input:focus,
.nw-input:not(:placeholder-shown) {
    padding-top: 18px;
    padding-bottom: 0;
}

/* Floating — selects (JS-toggled .has-value or :focus) */
.nw-select:focus ~ .nw-label,
.nw-select-wrap.has-value .nw-label {
    top: 10px;
    transform: none;
    font-size: 10px;
    line-height: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.nw-select-wrap.has-value .nw-select {
    padding-top: 18px;
    padding-bottom: 0;
}

/* ── Checkboxes ────────────────────────────────────────────────────────────── */
.nw-checkboxes-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.nw-checks-half {
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 560px;
}

.nw-check-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nw-check-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    min-height: 20px;
    position: relative;
}

.nw-cb {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    overflow: hidden;
    pointer-events: none;
}

.nw-cb-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.nw-cb-icon--checked {
    display: none;
}

.nw-cb:checked + .nw-cb-box .nw-cb-icon:not(.nw-cb-icon--checked) {
    display: none;
}

.nw-cb:checked + .nw-cb-box .nw-cb-icon--checked {
    display: block;
}

.nw-cb:focus-visible + .nw-cb-box {
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: 2px;
    border-radius: 2px;
}

.nw-cb-text {
    font-size: 14px;
    font-weight: 300;
    line-height: 20px;
    color: var(--wp--preset--color--white);
    flex: 1;
}

.nw-check-desc {
    font-size: 12px;
    font-weight: 300;
    line-height: 16px;
    color: #e4e4ea;
    margin: 0;
    padding-left: 32px; /* 20px cb + 12px gap */
}

/* ── Consent ───────────────────────────────────────────────────────────────── */
.nw-consent-outer {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.nw-consent-outer .nw-check-item {
    width: 100%;
}

.nw-section--consent .nw-check-label--consent {
    align-items: flex-start;
}

.nw-section--consent .nw-cb-text {
    display: flex;
    gap: 3px;
}

.nw-consent-required {
    color: #ff2126;
    flex-shrink: 0;
    line-height: 20px;
}

.nw-consent-body {
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
}

.nw-consent-body.is-expanded {
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
}

.nw-consent-body p {
    margin: 0;
    font-size: 14px;
    font-weight: 300;
    line-height: 20px;
    color: var(--wp--preset--color--white);
}

.nw-consent-more {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    padding: 0;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    color: var(--wp--preset--color--white);
    cursor: pointer;
}

.nw-consent-more:hover {
    text-decoration: underline;
}

.nw-consent-more svg {
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.nw-consent-more[aria-expanded="true"] svg {
    transform: scaleY(-1);
}

/* ── Footer ────────────────────────────────────────────────────────────────── */
.nw-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.nw-required-note {
    font-size: 16px;
    font-weight: 300;
    line-height: 24px;
    color: var(--wp--preset--color--neutral-100);
    margin: 0;
}

.nw-msg {
    flex: 1;
    font-size: 14px;
    font-weight: 300;
    line-height: 20px;
    color: var(--wp--preset--color--white);
}

.nw-msg.is-error {
    color: #ff2126;
}

.nw-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 18px 40px;
    background: transparent;
    border: 1px solid var(--wp--preset--color--white);
    color: var(--wp--preset--color--white);
    font-size: 16px;
    font-weight: 700;
    line-height: 20px;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    font-family: inherit;
}

.nw-submit:hover {
    background: var(--wp--preset--color--white);
    color: var(--wp--preset--color--dark);
}

.nw-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.nw-submit.is-loading {
    position: relative;
    color: transparent !important;
}

.nw-submit.is-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: var(--wp--preset--color--white);
    border-radius: 50%;
    animation: nw-btn-spin 0.6s linear infinite;
}

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

/* ── Success state ─────────────────────────────────────────────────────────── */
.nw-success-inner {
    max-width: 640px;
}

.nw-success-title-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.nw-success-icon {
    color: var(--wp--preset--color--white);
    flex-shrink: 0;
}

.nw-success-title {
    font-size: 32px;
    font-weight: 400;
    line-height: 1;
    color: var(--wp--preset--color--white);
    margin: 0;
}

.nw-success-desc {
    font-size: 16px;
    font-weight: 300;
    line-height: 24px;
    color: var(--wp--preset--color--neutral-100);
    margin: 16px 0 0;
}

/* ── Validation ────────────────────────────────────────────────────────────── */
.nw-input.is-invalid,
.nw-select-wrap.is-invalid .nw-select {
    outline: 2px solid #ff2126;
    outline-offset: -2px;
}

.nw-field-error {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    font-weight: 300;
    line-height: 16px;
    color: #ff2126;
}

.nw-check-item.is-invalid .nw-cb-box {
    outline: 2px solid #ff2126;
    outline-offset: 1px;
    border-radius: 2px;
}

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 991px) {
    .nw-fields-grid {
        grid-template-columns: 1fr;
    }

    .nw-checkboxes-grid {
        grid-template-columns: 1fr;
    }

    .nw-checks-half {
        max-width: 100%;
    }
}

@media (max-width: 767px) {
    .newsletter {
        padding: 40px 0;
    }

    .nw-title {
        font-size: 24px;
    }

    .nw-success-title {
        font-size: 24px;
    }

    .nw-success-title-row {
        align-items: flex-start;
    }

    .nw-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .nw-submit {
        width: 100%;
        justify-content: center;
    }

    .nw-section-actions {
        justify-content: space-between;
    }
}
