/**
 * WP Newsletter Pro — Public Styles
 * Uses CSS custom properties set by WNP_Form::styles_to_css() per form instance.
 * All values fall back to sensible defaults even without the inline style block.
 */

/* ── Defaults (overridden per-form by inline style vars) ──────────────────── */
:root {
    --wnp-accent:    #2563eb;
    --wnp-btn-text:  #ffffff;
    --wnp-form-bg:   transparent;
    --wnp-input-bg:  #ffffff;
    --wnp-border:    #e2e8f0;
    --wnp-text:      #1e293b;
    --wnp-radius:    8px;
    --wnp-font-size: 15px;
}

/* ── Form wrapper ─────────────────────────────────────────────────────────── */
.wnp-form-wrap {
    background: var(--wnp-form-bg);
    color: var(--wnp-text);
    font-size: var(--wnp-font-size);
    font-family: inherit;
    max-width: 560px;
    margin: 0 auto;
}

.wnp-form-title {
    font-size: calc(var(--wnp-font-size) * 1.35);
    font-weight: 700;
    margin: 0 0 6px;
    color: var(--wnp-text);
    line-height: 1.3;
}

.wnp-form-desc {
    font-size: calc(var(--wnp-font-size) * 0.93);
    color: #64748b;
    margin: 0 0 16px;
}

/* ── Fields ───────────────────────────────────────────────────────────────── */
.wnp-field {
    margin-bottom: 14px;
}

.wnp-label {
    display: block;
    font-size: calc(var(--wnp-font-size) * 0.87);
    font-weight: 500;
    margin-bottom: 5px;
    color: var(--wnp-text);
}

.wnp-req {
    color: #ef4444;
    margin-left: 2px;
}

.wnp-input {
    display: block;
    width: 100%;
    padding: 10px 14px;
    background: var(--wnp-input-bg);
    border: 1.5px solid var(--wnp-border);
    border-radius: var(--wnp-radius);
    font-size: var(--wnp-font-size);
    color: var(--wnp-text);
    line-height: 1.4;
    transition: border-color .15s, box-shadow .15s;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

.wnp-input:focus {
    outline: none;
    border-color: var(--wnp-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--wnp-accent) 18%, transparent);
}

.wnp-input::placeholder { color: #94a3b8; }

/* ── Email + button inline row ────────────────────────────────────────────── */
.wnp-email-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.wnp-email-input {
    flex: 1;
}

/* ── Submit button ────────────────────────────────────────────────────────── */
.wnp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--wnp-radius);
    font-size: var(--wnp-font-size);
    font-weight: 600;
    cursor: pointer;
    transition: opacity .15s, transform .1s;
    white-space: nowrap;
    line-height: 1.4;
}

.wnp-btn:active { transform: scale(.98); }

.wnp-submit-btn {
    background: var(--wnp-accent);
    color: var(--wnp-btn-text);
}

.wnp-submit-btn:hover { opacity: .9; }
.wnp-submit-btn:disabled { opacity: .6; cursor: not-allowed; }

/* ── Spinner ──────────────────────────────────────────────────────────────── */
.wnp-btn-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: wnp-spin .6s linear infinite;
}

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

/* ── Captcha ──────────────────────────────────────────────────────────────── */
.wnp-captcha-input {
    max-width: 120px;
}

/* ── Consent checkbox ─────────────────────────────────────────────────────── */
.wnp-consent-label {
    display: flex;
    gap: 9px;
    align-items: flex-start;
    cursor: pointer;
    font-size: calc(var(--wnp-font-size) * 0.87);
    color: #64748b;
    line-height: 1.5;
}

.wnp-consent-label input[type="checkbox"] {
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: var(--wnp-accent);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* ── Response / flash messages ────────────────────────────────────────────── */
.wnp-response {
    padding: 11px 16px;
    border-radius: var(--wnp-radius);
    margin-bottom: 14px;
    font-size: calc(var(--wnp-font-size) * 0.93);
    font-weight: 500;
}

.wnp-response.is-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.wnp-response.is-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* ── Site-wide flash (confirm / unsub redirects) ──────────────────────────── */
.wnp-flash {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    z-index: 99999;
    box-shadow: 0 4px 20px rgba(0,0,0,.15);
    max-width: 480px;
    text-align: center;
}

.wnp-flash-success { background: #166534; color: #fff; }
.wnp-flash-info    { background: #1e40af; color: #fff; }
.wnp-flash-error   { background: #991b1b; color: #fff; }

/* ── Unsubscribe reason modal ─────────────────────────────────────────────── */
.wnp-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99998;
    padding: 24px;
}

.wnp-modal-box {
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    max-width: 440px;
    width: 100%;
    box-shadow: 0 8px 40px rgba(0,0,0,.18);
}

.wnp-modal-box h3 {
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 700;
}

.wnp-reason-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 18px;
}

.wnp-reason-btn {
    display: block;
    padding: 12px 18px;
    background: #f1f5f9;
    border-radius: 8px;
    color: #1e293b;
    text-decoration: none;
    font-weight: 500;
    transition: background .15s;
}

.wnp-reason-btn:hover { background: #e2e8f0; }

.wnp-reason-skip {
    display: block;
    text-align: center;
    padding: 10px;
    color: #94a3b8;
    font-size: 13px;
    text-decoration: none;
    margin-top: 6px;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .wnp-email-row {
        flex-direction: column;
    }

    .wnp-submit-btn {
        width: 100%;
    }
}
