/**
 * Scoped Stylesheet für das NerdMail Web-Archiv und das Preference Center.
 * Alle Stile sind strikt an '.nerdmail-web-wrapper' gekoppelt, um Theme-Kollisionen zu vermeiden.
 */

.nerdmail-web-wrapper {
    --nm-primary: #000000;
    --nm-primary-hover: #222222;
    --nm-secondary: #dc2626;
    --nm-secondary-hover: #b91c1c;
    --nm-bg-card: #ffffff;
    --nm-bg-page: #f9fafb;
    --nm-text-dark: #111827;
    --nm-text-muted: #6b7280;
    --nm-border: #e5e7eb;
    --nm-success-bg: #ecfdf5;
    --nm-success-text: #047857;
    --nm-success-border: #a7f3d0;
    --nm-radius: 8px;
    --nm-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);

    max-width: 600px;
    margin: 40px auto;
    padding: 0 20px;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--nm-text-dark);
    line-height: 1.6;
}

/* Alert-Meldungen */
.nerdmail-alert {
    padding: 16px;
    border-radius: var(--nm-radius);
    margin-bottom: 24px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid transparent;
    animation: nmFadeIn 0.3s ease-out;
}

.nerdmail-alert.success-alert {
    background-color: var(--nm-success-bg);
    color: var(--nm-success-text);
    border-color: var(--nm-success-border);
}

/* Profil-Karte */
.nerdmail-profile-card {
    background: var(--nm-bg-card);
    border: 1px solid var(--nm-border);
    border-radius: var(--nm-radius);
    padding: 32px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

.nerdmail-profile-card h2 {
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
    font-size: 26px;
    margin-top: 0;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.nerdmail-sub-intro {
    color: var(--nm-text-muted);
    font-size: 15px;
    margin-bottom: 32px;
}

.nerdmail-sub-intro strong {
    color: var(--nm-text-dark);
}

/* Trennlinie */
.nerdmail-divider {
    border: 0;
    border-top: 1px solid var(--nm-border);
    margin: 32px 0;
}

/* Listen-Auswahl */
.nerdmail-list-selector h3 {
    font-size: 16px;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--nm-text-dark);
}

.nerdmail-checkbox-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

/* Individuelles Premium Checkbox-Layout */
.nerdmail-checkbox-label {
    display: flex;
    align-items: flex-start;
    padding: 16px;
    border: 1px solid var(--nm-border);
    border-radius: var(--nm-radius);
    cursor: pointer;
    background: #fbfbfb;
    transition: var(--nm-transition);
    user-select: none;
}

.nerdmail-checkbox-label:hover {
    border-color: #9ca3af;
    background: #f9fafb;
    transform: translateY(-1px);
}

/* Versteckte Original-Checkbox */
.nerdmail-checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

/* Custom Checkbox Box */
.nerdmail-checkbox-label .checkbox-custom {
    position: relative;
    height: 20px;
    width: 20px;
    background-color: #ffffff;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    margin-right: 16px;
    margin-top: 2px;
    flex-shrink: 0;
    transition: var(--nm-transition);
}

/* Wenn Checkbox aktiv */
.nerdmail-checkbox-label input:checked ~ .checkbox-custom {
    background-color: var(--nm-primary);
    border-color: var(--nm-primary);
}

/* Checkbox Haken */
.nerdmail-checkbox-label .checkbox-custom:after {
    content: "";
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.nerdmail-checkbox-label input:checked ~ .checkbox-custom:after {
    display: block;
}

/* Listen-Metadaten */
.nerdmail-checkbox-label .list-info {
    display: flex;
    flex-direction: column;
}

.nerdmail-checkbox-label .list-name {
    font-size: 15px;
    color: var(--nm-text-dark);
    margin-bottom: 2px;
}

.nerdmail-checkbox-label .list-desc {
    font-size: 13px;
    color: var(--nm-text-muted);
}

/* Buttons */
.nerdmail-web-wrapper .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--nm-radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--nm-transition);
    text-decoration: none;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
}

.nerdmail-web-wrapper .button-primary {
    background-color: var(--nm-primary);
    color: #ffffff;
}

.nerdmail-web-wrapper .button-primary:hover {
    background-color: var(--nm-primary-hover);
    transform: translateY(-1px);
}

.nerdmail-web-wrapper .button-secondary {
    background-color: #ffffff;
    border-color: var(--nm-border);
    color: var(--nm-text-dark);
}

.nerdmail-web-wrapper .button-secondary:hover {
    background-color: #f9fafb;
    border-color: #9ca3af;
}

.nerdmail-web-wrapper .unsubscribe-btn {
    background-color: #fef2f2;
    border-color: #fee2e2;
    color: #b91c1c;
}

.nerdmail-web-wrapper .unsubscribe-btn:hover {
    background-color: #fee2e2;
    border-color: #fca5a5;
    color: #991b1b;
}

/* Abmeldesektion */
.nerdmail-unsubscribe-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 8px;
    color: var(--nm-text-dark);
}

.nerdmail-unsubscribe-section p {
    color: var(--nm-text-muted);
    font-size: 14px;
    margin-bottom: 16px;
    margin-top: 0;
}

/* Error Box */
.nerdmail-web-wrapper.error-box {
    background-color: #fdf2f2;
    color: #9b1c1c;
    border: 1px solid #f8b4b4;
    padding: 20px;
    border-radius: var(--nm-radius);
    text-align: center;
    font-weight: 500;
}

/* Keyframes */
@keyframes nmFadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Grid-Optimierungen */
@media (min-width: 640px) {
    .nerdmail-web-wrapper .button {
        width: auto;
    }
}
