/**
 * XC Newsletter Connector — form styles
 *
 * Auto-adapts to user's WP theme (light/dark) via prefers-color-scheme.
 * Consistent visual language with the standalone Newsletter System.
 */

.xc-nl-form {
    box-sizing: border-box;
    font-family: inherit;
    line-height: 1.5;
    color: inherit;
    margin: 1em 0;
    --xc-bg: #f8fafc;
    --xc-bg-input: #fff;
    --xc-border: #e2e8f0;
    --xc-border-input: #cbd5e1;
    --xc-text: #0f172a;
    --xc-text-muted: #64748b;
    --xc-brand: #6366f1;
    --xc-brand-hover: #4f46e5;
    --xc-success-bg: #ecfdf5;
    --xc-success-text: #065f46;
    --xc-success-border: #a7f3d0;
    --xc-error-bg: #fef2f2;
    --xc-error-text: #991b1b;
    --xc-error-border: #fecaca;
    --xc-radius: 8px;
    --xc-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

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

@media (prefers-color-scheme: dark) {
    .xc-nl-form {
        --xc-bg: #1e293b;
        --xc-bg-input: #0f172a;
        --xc-border: #334155;
        --xc-border-input: #334155;
        --xc-text: #e2e8f0;
        --xc-text-muted: #94a3b8;
        --xc-success-bg: rgba(16, 185, 129, 0.1);
        --xc-success-text: #6ee7b7;
        --xc-success-border: #065f46;
        --xc-error-bg: rgba(220, 38, 38, 0.1);
        --xc-error-text: #fca5a5;
        --xc-error-border: #7f1d1d;
        --xc-shadow: 0 1px 3px rgba(0,0,0,0.3);
    }
}

.xc-nl-title {
    font-size: 1.25em;
    font-weight: 600;
    margin: 0 0 .5em;
    color: var(--xc-text);
    line-height: 1.3;
}

.xc-nl-desc {
    color: var(--xc-text-muted);
    margin: 0 0 1em;
    font-size: 0.95em;
}

.xc-nl-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
}

.xc-nl-input {
    flex: 1 1 200px;
    min-width: 0;
    padding: 0.65em 0.9em;
    border: 1px solid var(--xc-border-input);
    border-radius: var(--xc-radius);
    font-size: 0.95em;
    font-family: inherit;
    background: var(--xc-bg-input);
    color: var(--xc-text);
    transition: border-color .15s, box-shadow .15s;
}

.xc-nl-input::placeholder {
    color: var(--xc-text-muted);
    opacity: 0.7;
}

.xc-nl-input:focus {
    outline: 0;
    border-color: var(--xc-brand);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.xc-nl-button {
    padding: 0.65em 1.4em;
    border: 0;
    border-radius: var(--xc-radius);
    background: var(--xc-brand);
    color: #fff;
    font-weight: 600;
    font-size: 0.95em;
    cursor: pointer;
    transition: background .15s, transform .1s;
    font-family: inherit;
    white-space: nowrap;
}

.xc-nl-button:hover { background: var(--xc-brand-hover); }
.xc-nl-button:active { transform: translateY(1px); }
.xc-nl-button:disabled { opacity: 0.6; cursor: wait; }

.xc-nl-message {
    margin-top: 0.75em;
    font-size: 0.9em;
    padding: 0.6em 0.85em;
    border-radius: var(--xc-radius);
    display: none;
    animation: xcFadeIn 0.25s ease-out;
}

.xc-nl-message.xc-nl-success {
    display: block;
    background: var(--xc-success-bg);
    color: var(--xc-success-text);
    border: 1px solid var(--xc-success-border);
}

.xc-nl-message.xc-nl-error {
    display: block;
    background: var(--xc-error-bg);
    color: var(--xc-error-text);
    border: 1px solid var(--xc-error-border);
}

@keyframes xcFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Style: card */
.xc-nl-style-card {
    background: var(--xc-bg);
    border: 1px solid var(--xc-border);
    border-radius: 12px;
    padding: 1.5em;
    box-shadow: var(--xc-shadow);
}

/* Style: inline */
.xc-nl-style-inline {
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}

/* Style: minimal */
.xc-nl-style-minimal {
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}
.xc-nl-style-minimal .xc-nl-title,
.xc-nl-style-minimal .xc-nl-desc {
    display: none;
}
.xc-nl-style-minimal .xc-nl-fields { flex-wrap: nowrap; }

@media (max-width: 480px) {
    .xc-nl-fields { flex-direction: column; }
    .xc-nl-input { flex: none; width: 100%; }
    .xc-nl-button { width: 100%; }
    .xc-nl-style-minimal .xc-nl-fields {
        flex-wrap: wrap;
        flex-direction: column;
    }
}

/* Checkbox rows (WooCommerce, comments, registration) */
.xc-nl-woo-checkbox,
.comment-form-newsletter {
    margin: 1em 0;
    padding: 0.75em 1em;
    background: rgba(99, 102, 241, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(99, 102, 241, 0.15);
}

.xc-nl-woo-checkbox label,
.comment-form-newsletter label {
    cursor: pointer;
    color: inherit;
    font-size: 0.95em;
    line-height: 1.5;
}

.xc-nl-woo-checkbox input[type="checkbox"],
.comment-form-newsletter input[type="checkbox"] {
    margin-right: 0.5em;
    vertical-align: middle;
}
