/**
 * Registrierung als Popup (Glas-Optik)
 * Farben: Polar White, Glacier Blue, Racing Red. Selektoren mit "button."/".rm-modal",
 * weil main.css alle <button> blau färbt und <input> einen unteren Abstand gibt.
 */

.rm-modal {
    --rm-ink: #141a22;
    --rm-ink-soft: #4a5563;
    --rm-red: #e4002b;
    --rm-red-hover: #b80023;
    --rm-glacier: #9cc6e0;
    --rm-glass: linear-gradient(155deg, rgba(255, 255, 255, 0.94) 0%, rgba(241, 243, 244, 0.8) 100%);
    --rm-gloss: rgba(255, 255, 255, 0.75);
    --rm-edge: rgba(255, 255, 255, 0.8);
    --rm-field: rgba(255, 255, 255, 0.78);
    --rm-field-border: rgba(20, 26, 34, 0.14);
    --rm-shadow: 0 40px 90px -30px rgba(20, 26, 34, 0.55), 0 2px 6px rgba(20, 26, 34, 0.06);
    --rm-tint: rgba(228, 0, 43, 0.09);
}

[data-theme="dark"] .rm-modal {
    --rm-ink: #e7ebee;
    --rm-ink-soft: #9ba6b2;
    --rm-red: #ff4d6a;
    --rm-red-hover: #ff7a8f;
    --rm-glass: linear-gradient(155deg, rgba(32, 44, 58, 0.92) 0%, rgba(15, 20, 25, 0.86) 100%);
    --rm-gloss: rgba(255, 255, 255, 0.09);
    --rm-edge: rgba(255, 255, 255, 0.13);
    --rm-field: rgba(255, 255, 255, 0.05);
    --rm-field-border: rgba(255, 255, 255, 0.15);
    --rm-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.8);
    --rm-tint: rgba(255, 77, 106, 0.14);
}

/* Seite dahinter weichzeichnen statt nur abdunkeln */
.rm-modal.show {
    -webkit-backdrop-filter: blur(8px) saturate(120%);
    backdrop-filter: blur(8px) saturate(120%);
}

body:has(.rm-modal.show) .modal-backdrop.show {
    opacity: 0.28;
}

.rm-modal .modal-dialog {
    max-width: 440px;
    position: relative;
}

.rm-modal.fade .modal-dialog {
    transform: translateY(18px) scale(0.97);
    transition: transform 0.38s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.rm-modal.show .modal-dialog {
    transform: none;
}

/* Farbschein hinter dem Glas */
.rm-modal .modal-dialog::before {
    content: "";
    position: absolute;
    inset: 8% -14% -6%;
    background:
        radial-gradient(40% 45% at 18% 20%, rgba(156, 198, 224, 0.85), transparent 70%),
        radial-gradient(35% 40% at 85% 85%, rgba(228, 0, 43, 0.35), transparent 70%);
    filter: blur(30px);
    pointer-events: none;
}

/* ---------- Glas-Fläche ---------- */

.rm-modal .rm-glass {
    position: relative;
    overflow: hidden;
    padding: 2.25rem 2rem 1.75rem;
    border: 1px solid var(--rm-edge);
    border-radius: 22px;
    background: var(--rm-glass);
    -webkit-backdrop-filter: blur(24px) saturate(170%);
    backdrop-filter: blur(24px) saturate(170%);
    box-shadow: var(--rm-shadow), inset 0 1px 0 var(--rm-gloss);
    color: var(--rm-ink);
    font-family: 'IBM Plex Sans', system-ui, sans-serif;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Glanzkante oben */
.rm-modal .rm-glass::before {
    content: "";
    position: absolute;
    left: -15%;
    right: -15%;
    top: -60%;
    height: 100%;
    border-radius: 0 0 50% 50% / 0 0 28% 28%;
    background: linear-gradient(180deg, var(--rm-gloss) 0%, rgba(255, 255, 255, 0) 100%);
    pointer-events: none;
}

/* Akzentlinie */
.rm-modal .rm-glass::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--rm-red) 0%, var(--rm-red) 35%, var(--rm-glacier) 100%);
    pointer-events: none;
}

.rm-modal .rm-glass > * {
    position: relative;
    z-index: 1;
}

.rm-modal button.rm-close {
    position: absolute;
    top: 0.9rem;
    right: 0.9rem;
    z-index: 2;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--rm-edge);
    border-radius: 50%;
    background: var(--rm-field);
    color: var(--rm-ink);
    box-shadow: inset 0 1px 0 var(--rm-gloss);
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.rm-modal button.rm-close:hover,
.rm-modal button.rm-close:focus-visible {
    background: var(--rm-red);
    color: #fff;
}

.rm-modal button.rm-close svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    fill: none;
}

/* ---------- Kopf ---------- */

.rm-modal .rm-kicker {
    margin: 0 0 0.5rem;
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    color: var(--rm-ink-soft);
}

.rm-modal .rm-kicker span {
    color: var(--rm-red);
}

.rm-modal .rm-title {
    margin: 0 0 0.5rem;
    font-family: 'Archivo', 'Arial Narrow', sans-serif;
    font-size: 1.9rem;
    font-weight: 800;
    font-stretch: 112%;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--rm-ink);
}

.rm-modal .rm-sub {
    margin: 0 0 1.5rem;
    color: var(--rm-ink-soft);
}

/* ---------- Formular ---------- */

.rm-modal .rm-alert {
    margin: 0 0 1rem;
    padding: 0.7rem 0.9rem;
    border-left: 3px solid var(--rm-red);
    border-radius: 10px;
    background: var(--rm-tint);
    color: var(--rm-ink);
    font-size: 0.9rem;
}

.rm-modal .rm-alert p {
    margin: 0;
}

.rm-modal .rm-alert p + p {
    margin-top: 0.3rem;
}

.rm-modal .rm-field {
    margin-bottom: 1rem;
}

.rm-modal .rm-field label {
    display: block;
    margin: 0 0 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--rm-ink);
}

.rm-modal .rm-input {
    position: relative;
}

.rm-modal .rm-label-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
}

.rm-modal .rm-label-row a {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--rm-red);
    text-decoration: none;
}

.rm-modal .rm-label-row a:hover {
    text-decoration: underline;
}

/* Browser-Autofill färbt Felder sonst hellblau */
.rm-modal .rm-field input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px #ffffff inset;
    -webkit-text-fill-color: var(--rm-ink);
    caret-color: var(--rm-ink);
}

[data-theme="dark"] .rm-modal .rm-field input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px #1c2632 inset;
}

.rm-modal .rm-field input {
    display: block;
    width: 100%;
    height: 46px;
    margin: 0;
    padding: 0.65rem 0.9rem;
    border: 1px solid var(--rm-field-border);
    border-radius: 12px;
    background: var(--rm-field);
    color: var(--rm-ink);
    font: inherit;
    font-size: 1rem;
    box-shadow: inset 0 1px 2px rgba(20, 26, 34, 0.06);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.rm-modal .rm-field input::placeholder {
    color: var(--rm-ink-soft);
    opacity: 0.7;
}

.rm-modal .rm-field input:focus {
    outline: none;
    border-color: #6fa9cc;
    box-shadow: 0 0 0 4px rgba(156, 198, 224, 0.5);
}

.rm-modal .rm-field input[aria-invalid="true"] {
    border-color: var(--rm-red);
    box-shadow: 0 0 0 4px var(--rm-tint);
}

.rm-modal .rm-input-pw input {
    padding-right: 3rem;
}

.rm-modal button.rm-eye {
    position: absolute;
    top: 50%;
    right: 0.4rem;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--rm-ink-soft);
    cursor: pointer;
}

.rm-modal button.rm-eye:hover,
.rm-modal button.rm-eye[aria-pressed="true"] {
    color: var(--rm-red);
}

.rm-modal .rm-error {
    margin: 0.35rem 0 0;
    font-size: 0.82rem;
    color: var(--rm-red);
}

/* Passwortregeln als Marken, erfüllte in Racing Red */
.rm-modal .rm-reqs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0.55rem 0 0;
    padding: 0;
    list-style: none;
}

.rm-modal .rm-reqs li {
    padding: 0.15rem 0.6rem;
    border: 1px solid var(--rm-field-border);
    border-radius: 999px;
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 0.72rem;
    color: var(--rm-ink-soft);
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.rm-modal .rm-reqs li.is-met {
    border-color: transparent;
    background: var(--rm-tint);
    color: var(--rm-red);
}

.rm-modal .rm-reqs li.is-met::before {
    content: "✓ ";
}

.rm-modal .rm-check {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    margin: 0.25rem 0 1.25rem;
    font-size: 0.88rem;
    color: var(--rm-ink-soft);
}

.rm-modal .rm-check input {
    flex: none;
    width: 18px;
    height: 18px;
    margin: 0.15rem 0 0;
    accent-color: var(--rm-red);
}

.rm-modal .rm-check label {
    margin: 0;
    font-weight: 400;
}

.rm-modal .rm-check + .rm-error {
    margin: -0.9rem 0 1rem;
}

.rm-modal .rm-check a,
.rm-modal .rm-switch a,
.rm-modal .rm-legal a {
    color: var(--rm-red);
    font-weight: 600;
    text-decoration: none;
}

.rm-modal .rm-check a:hover,
.rm-modal .rm-switch a:hover,
.rm-modal .rm-legal a:hover {
    text-decoration: underline;
}

/* Glänzender Hauptbutton */
.rm-modal button.rm-submit {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    height: 50px;
    margin: 0;
    padding: 0 1rem;
    border: 1px solid rgba(160, 0, 30, 0.6);
    border-radius: 14px;
    background: linear-gradient(180deg, #ff3b5f 0%, #e4002b 52%, #c8002a 100%);
    color: #fff;
    font: inherit;
    font-size: 1rem;
    font-weight: 600;
    box-shadow: 0 12px 26px -12px rgba(228, 0, 43, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.45);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.rm-modal button.rm-submit::before {
    content: "";
    position: absolute;
    inset: 0 0 50% 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0));
    pointer-events: none;
}

.rm-modal button.rm-submit::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -60%;
    width: 40%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.45), transparent);
    transform: skewX(-20deg);
    transition: left 0.6s ease;
    pointer-events: none;
}

.rm-modal button.rm-submit:hover {
    transform: translateY(-1px);
    filter: brightness(1.04);
    box-shadow: 0 16px 30px -12px rgba(228, 0, 43, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.rm-modal button.rm-submit:hover::after {
    left: 120%;
}

.rm-modal button.rm-submit:focus-visible {
    outline: 3px solid var(--rm-glacier);
    outline-offset: 3px;
}

.rm-modal button.rm-submit:disabled {
    cursor: progress;
    filter: saturate(0.7);
    transform: none;
}

.rm-modal .rm-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: rmSpin 0.7s linear infinite;
}

@keyframes rmSpin {
    to { transform: rotate(360deg); }
}

.rm-modal .rm-switch {
    margin: 1rem 0 0;
    text-align: center;
    font-size: 0.9rem;
    color: var(--rm-ink-soft);
}

.rm-modal .rm-legal {
    margin: 0.9rem 0 0;
    text-align: center;
    font-size: 0.72rem;
    color: var(--rm-ink-soft);
}

.rm-modal .rm-legal a {
    font-weight: 400;
}

@media (max-width: 575px) {
    .rm-modal .modal-dialog {
        margin: 0.75rem;
    }

    .rm-modal .rm-glass {
        padding: 2rem 1.25rem 1.5rem;
    }

    .rm-modal .rm-title {
        font-size: 1.6rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .rm-modal.fade .modal-dialog,
    .rm-modal button.rm-submit,
    .rm-modal button.rm-submit::after {
        transition: none;
    }
}
