/**
 * Preference centre + unsubscribe-all pages
 * (templates/crm/preferences.html and templates/crm/unsubscribe_result.html).
 *
 * Mobile-first (390px); colours and glows come from the locked design
 * tokens in components/variables.css. The toggles follow the promoter
 * portal's magenta pill pattern at a 44px minimum tap size.
 */

.crm-prefs-container {
    display: flex;
    justify-content: center;
    padding: 3rem 1rem 4rem;
}

.crm-prefs-panel {
    width: 100%;
    max-width: 560px;
    padding: 2rem 1.25rem;
    background: var(--rave-notice-bg);
    border: 1px solid var(--rave-glow-soft);
    border-radius: 12px;
    box-shadow: var(--shadow-glow-sm);
}

.crm-prefs-panel--centered {
    text-align: center;
}

.crm-prefs-title {
    font-family: var(--font-primary);
    font-size: 1.6rem;
    color: var(--rave-secondary);
    text-shadow: 0 0 10px var(--rave-cyan-glow-soft);
    margin-bottom: 0.75rem;
}

.crm-prefs-sub,
.crm-prefs-text {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: #f0e6ff;
    margin-bottom: 1.5rem;
}

.crm-prefs-notice {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #f0e6ff;
    background: rgba(0, 255, 255, 0.08);
    border: 1px solid var(--rave-cyan-glow-soft);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
}

.crm-prefs-notice--saved {
    background: rgba(255, 0, 255, 0.08);
    border-color: var(--rave-glow-soft);
    transition: opacity 0.5s ease;
}

/* Applied by the page script: the saved notice fades out after a few
   seconds (and immediately on any form change) so it never claims
   "saved" alongside new unsaved changes. */
.crm-prefs-notice--fading {
    opacity: 0;
}

.crm-prefs-form {
    margin-bottom: 0;
}

.crm-prefs-stream {
    padding: 0.5rem 0 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 1rem;
}

/* Magenta pill toggle (promoter-portal pattern), whole row tappable at
   44px minimum height. */
.crm-prefs-toggle {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    min-height: 44px;
    cursor: pointer;
    user-select: none;
    margin-bottom: 0.25rem;
}

.crm-prefs-toggle input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.crm-prefs-track {
    position: relative;
    width: 48px;
    height: 26px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 13px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.crm-prefs-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.crm-prefs-toggle input:checked + .crm-prefs-track {
    background: var(--rave-glow-subtle);
    border-color: var(--rave-primary);
    box-shadow: 0 0 10px var(--rave-glow-soft);
}

.crm-prefs-toggle input:checked + .crm-prefs-track::after {
    left: 24px;
    background: var(--rave-primary);
    box-shadow: 0 0 6px rgba(255, 0, 255, 0.6);
}

.crm-prefs-toggle input:focus-visible + .crm-prefs-track {
    outline: 2px solid var(--rave-secondary);
    outline-offset: 2px;
}

.crm-prefs-stream-label {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 1.05rem;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.65);
    transition: color 0.3s;
}

.crm-prefs-toggle input:checked ~ .crm-prefs-stream-label {
    color: var(--rave-primary);
    text-shadow: 0 0 5px var(--rave-glow-soft);
}

.crm-prefs-badge {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.72rem;
    font-weight: bold;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--rave-secondary);
    border: 1px solid var(--rave-cyan-glow-soft);
    border-radius: 50px;
    padding: 0.2rem 0.6rem;
    white-space: nowrap;
}

.crm-prefs-stream-text {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.9rem;
    line-height: 1.5;
    color: rgba(240, 230, 255, 0.75);
    margin: 0;
}

/* Password field on the GDPR "Download my data" confirm page. Neon-themed to
   match the locked dark palette; full-width and a 44px tap height on mobile. */
.crm-prefs-input {
    display: block;
    width: 100%;
    min-height: 44px;
    margin: 0.5rem 0 1.25rem;
    padding: 0.65rem 0.9rem;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 1rem;
    color: #f0e6ff;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--rave-cyan-glow-soft);
    border-radius: 8px;
}

.crm-prefs-input:focus {
    outline: none;
    border-color: var(--rave-secondary);
    box-shadow: 0 0 8px var(--rave-cyan-glow-soft);
}

.crm-prefs-btn {
    display: inline-block;
    min-height: 44px; /* WCAG tap target */
    padding: 0.75rem 2rem;
    margin-top: 0.5rem;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 1rem;
    font-weight: bold;
    color: #fff;
    background: var(--gradient-primary);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    text-decoration: none;
    box-shadow: var(--shadow-glow-sm);
}

.crm-prefs-btn:hover,
.crm-prefs-btn:focus {
    color: #fff;
    text-decoration: none;
    box-shadow: var(--shadow-glow-md);
}

/* Destructive variant for the GDPR Art. 17 "Delete my account" submit. A
   deep-red gradient + red glow that stays in the locked dark palette, so the
   irreversible action reads as serious without leaving the theme. */
.crm-prefs-btn--danger {
    background: linear-gradient(45deg, #c1003c, #7a0020);
    box-shadow: 0 0 10px rgba(255, 0, 64, 0.35);
}

.crm-prefs-btn--danger:hover,
.crm-prefs-btn--danger:focus {
    box-shadow: 0 0 16px rgba(255, 0, 64, 0.55);
}

/* Irreversibility warning block on the delete-account confirm page. A
   dark-red-tinted notice, distinct from the cyan .crm-prefs-notice. */
.crm-delete-warning {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 1rem;
    font-weight: bold;
    line-height: 1.5;
    color: #ffd9e2;
    background: rgba(180, 0, 50, 0.18);
    border: 1px solid rgba(255, 0, 64, 0.5);
    border-radius: 8px;
    padding: 0.85rem 1rem;
    margin-bottom: 1.5rem;
}

/* List spacing when .crm-prefs-text is applied to a <ul> (delete page). */
ul.crm-prefs-text {
    padding-left: 1.25rem;
    margin-bottom: 1.5rem;
}

ul.crm-prefs-text li {
    margin-bottom: 0.4rem;
}

.crm-prefs-link {
    color: var(--rave-secondary);
    text-decoration: underline;
}

.crm-prefs-link:hover,
.crm-prefs-link:focus {
    color: var(--rave-secondary);
    text-shadow: 0 0 6px var(--rave-cyan-glow-soft);
}

.crm-prefs-fineprint {
    margin: 1.25rem 0 0;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.8rem;
    line-height: 1.5;
    color: rgba(240, 230, 255, 0.65);
}

/* Web push card — sits below the email-streams form (account variant only).
   A cyan-tinted bordered block separated by a top divider so it reads as a
   distinct channel from the email toggles above it. */
.crm-prefs-push {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.crm-prefs-push-title {
    font-family: var(--font-primary);
    font-size: 1.25rem;
    color: var(--rave-secondary);
    text-shadow: 0 0 8px var(--rave-cyan-glow-soft);
    margin-bottom: 0.5rem;
}

.crm-prefs-push-text {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #f0e6ff;
    margin-bottom: 1rem;
}

/* Text-alerts (SMS) stream — renders as the same neon-toggle row as the
   email streams (standardised); only the phone field beneath the consent
   text marks it out as the SMS channel. */
.crm-prefs-stream--sms .crm-prefs-sms-input {
    margin-top: 0.85rem;
}

.crm-prefs-sms-error {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #ffd9e2;
    background: rgba(180, 0, 50, 0.18);
    border: 1px solid rgba(255, 0, 64, 0.5);
    border-radius: 8px;
    padding: 0.65rem 0.9rem;
    margin-bottom: 1rem;
}

.crm-prefs-sms-input {
    display: block;
    width: 100%;
    min-height: 44px;
    margin: 0 0 1rem;
    padding: 0.65rem 0.9rem;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 1rem;
    color: #f0e6ff;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--rave-cyan-glow-soft);
    border-radius: 8px;
}

.crm-prefs-sms-input:focus {
    outline: none;
    border-color: var(--rave-secondary);
    box-shadow: 0 0 8px var(--rave-cyan-glow-soft);
}

@media (min-width: 768px) {
    .crm-prefs-panel {
        padding: 2.5rem;
    }

    .crm-prefs-title {
        font-size: 1.9rem;
    }
}
