/* Pages de compte (connexion, inscription, clés d'accès...) et éléments de sécurité de /administration.
   Les couleurs --brand et --brand-2 viennent de la personnalisation de la boutique (sinon ces valeurs). */

:root {
    --brand: #6d28d9;
    --brand-2: #db2777;
    --brand-ink: #0f172a;
    --brand-soft: #f5f3ff;
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.icon {
    flex-shrink: 0;
    vertical-align: -3px;
}

/* ---------- Coquille des pages de compte ---------- */

.account-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 16px 32px;
    position: relative;
    overflow: hidden;
    background: #0b1020;
    color: var(--brand-ink);
    font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
}

.account-backdrop {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--brand) 55%, transparent), transparent 60%),
                radial-gradient(900px 600px at 110% 110%, color-mix(in srgb, var(--brand-2) 50%, transparent), transparent 60%),
                #0b1020;
}

    .account-backdrop .blob {
        position: absolute;
        border-radius: 50%;
        filter: blur(60px);
        opacity: 0.55;
        animation: float 18s ease-in-out infinite;
    }

    .account-backdrop .blob-1 { width: 420px; height: 420px; background: var(--brand); top: -120px; left: -80px; }
    .account-backdrop .blob-2 { width: 360px; height: 360px; background: var(--brand-2); bottom: -120px; right: -60px; animation-delay: -6s; }
    .account-backdrop .blob-3 { width: 260px; height: 260px; background: #06b6d4; top: 40%; left: 60%; opacity: 0.35; animation-delay: -12s; }

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(40px, -30px) scale(1.08); }
    66% { transform: translate(-30px, 25px) scale(0.95); }
}

@media (prefers-reduced-motion: reduce) {
    .account-backdrop .blob { animation: none; }
}

.account-top, .account-card, .account-foot {
    position: relative;
    z-index: 1;
}

.account-top {
    width: 100%;
    max-width: 1080px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.account-brand {
    color: #fff;
    font-weight: 800;
    font-size: 22px;
    letter-spacing: -0.02em;
    text-decoration: none;
}

    .account-brand:hover { color: #fff; opacity: 0.85; }

.account-top .language-selector button,
.account-top .language-selector a {
    color: rgba(255, 255, 255, 0.85);
}

.account-card {
    width: 100%;
    max-width: 460px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 24px;
    padding: 36px 32px;
    box-shadow: 0 30px 80px rgba(2, 6, 23, 0.45), 0 2px 0 rgba(255, 255, 255, 0.4) inset;
    animation: rise 0.45s cubic-bezier(.2, .8, .2, 1);
}

    .account-card:has(.manage) {
        max-width: 1000px;
    }

@keyframes rise {
    from { opacity: 0; transform: translateY(14px) scale(0.99); }
    to { opacity: 1; transform: none; }
}

.account-foot {
    margin-top: 24px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    text-align: center;
}

.account-title {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin: 0 0 6px;
    background: linear-gradient(90deg, var(--brand), var(--brand-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.account-subtitle {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 14px;
}

    .account-subtitle.small { font-size: 16px; margin-top: 22px; }

.account-lead {
    color: #475569;
    margin-bottom: 22px;
}

.account-hint {
    color: #64748b;
    font-size: 14px;
}

.account-empty {
    color: #94a3b8;
    font-style: italic;
}

.account-hero-icon {
    font-size: 44px;
    line-height: 1;
    margin-bottom: 12px;
}

/* ---------- Formulaires ---------- */

.account-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.account-form .field, .field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

    .field label {
        font-size: 13px;
        font-weight: 600;
        color: #334155;
    }

    .field input, .field select {
        border: 1.5px solid #e2e8f0;
        border-radius: 12px;
        padding: 12px 14px;
        font-size: 16px;
        background: #fff;
        transition: border-color 0.15s, box-shadow 0.15s;
    }

        .field input:focus, .field select:focus {
            outline: none;
            border-color: var(--brand);
            box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent);
        }

        .field input:disabled {
            background: #f1f5f9;
            color: #64748b;
        }

    .field small {
        color: #64748b;
        font-size: 12px;
    }

.code-input {
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    letter-spacing: 0.3em;
    font-size: 22px !important;
    text-align: center;
}

.check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #334155;
    cursor: pointer;
}

    .check input {
        width: 18px;
        height: 18px;
        accent-color: var(--brand);
    }

.btn-account {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    width: 100%;
    border: none;
    border-radius: 14px;
    padding: 13px 18px;
    font-weight: 700;
    font-size: 16px;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.12s, box-shadow 0.2s, filter 0.2s;
}

    .btn-account:hover { transform: translateY(-1px); }
    .btn-account:active { transform: translateY(0); }

.btn-primary-account {
    color: #fff;
    background: linear-gradient(90deg, var(--brand), var(--brand-2));
    box-shadow: 0 10px 24px color-mix(in srgb, var(--brand) 35%, transparent);
}

    .btn-primary-account:hover { color: #fff; filter: brightness(1.07); }

.btn-passkey {
    color: var(--brand-ink);
    background: #fff;
    border: 1.5px solid #e2e8f0;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}

    .btn-passkey:hover { border-color: var(--brand); }

.btn-danger-account {
    color: #fff;
    background: #dc2626;
}

.account-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #94a3b8;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 4px 0;
}

    .account-divider::before, .account-divider::after {
        content: "";
        flex: 1;
        height: 1px;
        background: #e2e8f0;
    }

.external-logins {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
    margin-top: 18px;
}

.external-login {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    font-weight: 600;
    color: #0f172a;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.12s;
}

    .external-login:hover { border-color: #94a3b8; transform: translateY(-1px); }
    .external-login-apple { background: #000; color: #fff; border-color: #000; }
    .external-login-apple:hover { border-color: #333; }

.account-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 22px;
    font-size: 14px;
    text-align: center;
}

    .account-links a, .link-button {
        color: var(--brand);
        text-decoration: none;
        font-weight: 600;
        background: none;
        border: none;
        padding: 0;
        cursor: pointer;
        font-size: 14px;
    }

        .account-links a:hover, .link-button:hover { text-decoration: underline; }

.account-alert {
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 14px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}

    .account-alert.is-error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
    .account-alert.is-success { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
    .account-alert.is-info { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
    .account-alert.is-warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }
    .account-alert a { color: inherit; font-weight: 700; }

/* ---------- Gestion du compte ---------- */

.manage-grid {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 28px;
    margin-top: 18px;
}

@media (max-width: 760px) {
    .manage-grid { grid-template-columns: 1fr; }
}

.manage-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

    .manage-nav a, .manage-logout {
        display: block;
        padding: 10px 12px;
        border-radius: 10px;
        color: #334155;
        text-decoration: none;
        font-weight: 600;
        font-size: 14px;
        background: none;
        border: none;
        text-align: left;
        width: 100%;
    }

        .manage-nav a:hover, .manage-logout:hover { background: #f1f5f9; }
        .manage-nav a.active { background: var(--brand-soft); color: var(--brand); }

.manage-body .account-form { max-width: 460px; }

.current-value {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.pill {
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 12px;
    font-weight: 700;
}

    .pill.is-ok { background: #dcfce7; color: #166534; }

.passkey-list {
    list-style: none;
    padding: 0;
    margin: 0 0 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

    .passkey-list li {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 14px;
        border: 1.5px solid #e2e8f0;
        border-radius: 14px;
    }

.passkey-icon {
    font-size: 22px;
}

.passkey-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    flex: 1;
}

    .passkey-form input[name=NewName] {
        flex: 1;
        min-width: 160px;
        border: 1px solid transparent;
        border-radius: 8px;
        padding: 6px 8px;
        font-weight: 600;
    }

        .passkey-form input[name=NewName]:hover, .passkey-form input[name=NewName]:focus { border-color: #cbd5e1; outline: none; }

    .passkey-form small { color: #94a3b8; }

.btn-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1.5px solid #e2e8f0;
    border-radius: 999px;
    background: #fff;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    text-decoration: none;
    cursor: pointer;
}

    .btn-chip:hover { border-color: var(--brand); color: var(--brand); }
    .btn-chip.is-danger:hover { border-color: #dc2626; color: #dc2626; }

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

    .button-row form { display: inline; }

.security-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 14px;
    font-weight: 600;
}

    .security-status .dot { width: 10px; height: 10px; border-radius: 50%; }
    .security-status.is-on { background: #f0fdf4; color: #166534; }
    .security-status.is-on .dot { background: #22c55e; box-shadow: 0 0 0 4px #bbf7d0; }
    .security-status.is-off { background: #f8fafc; color: #475569; }
    .security-status.is-off .dot { background: #94a3b8; }

.steps {
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: #334155;
}

.qr svg {
    width: 200px;
    height: 200px;
    margin-top: 10px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    padding: 6px;
    background: #fff;
}

.recovery-codes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 18px;
}

    .recovery-codes code {
        background: #f1f5f9;
        border-radius: 8px;
        padding: 8px;
        text-align: center;
        font-size: 15px;
        color: #0f172a;
    }

.danger-zone {
    border: 1.5px solid #fecaca;
    border-radius: 14px;
    padding: 12px 16px;
}

    .danger-zone summary { color: #b91c1c; font-weight: 700; cursor: pointer; }

/* ---------- Menu du compte (haut de page) ---------- */

.user-menu {
    position: relative;
    margin-left: 16px;
}

    .user-menu summary {
        list-style: none;
        display: flex;
        align-items: center;
        gap: 6px;
        cursor: pointer;
        padding: 6px 12px;
        border-radius: 999px;
        border: 1px solid #e2e8f0;
        background: #fff;
        font-size: 14px;
        font-weight: 600;
        white-space: nowrap;
    }

        .user-menu summary::-webkit-details-marker { display: none; }

.user-menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 220px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.15);
    padding: 6px;
    z-index: 50;
}

    .user-menu-panel a, .user-menu-panel button {
        display: flex;
        align-items: center;
        gap: 8px;
        width: 100%;
        padding: 9px 10px;
        border-radius: 10px;
        border: none;
        background: none;
        color: #0f172a;
        text-decoration: none;
        font-size: 14px;
        text-align: left;
        margin: 0 !important;
    }

        .user-menu-panel a:hover, .user-menu-panel button:hover { background: #f1f5f9; text-decoration: none !important; }

.user-login {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}

/* ---------- /administration : sécurité, tableau de bord ---------- */

.admin-nav .nav-section {
    color: rgba(255, 255, 255, 0.45);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 14px 28px 4px;
}

.admin-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
    margin-top: 18px;
}

.admin-tile {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 20px;
    border-radius: 18px;
    background: #fff;
    border: 1px solid #e5e7eb;
    color: #0f172a;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: transform 0.15s, box-shadow 0.2s, border-color 0.2s;
}

    .admin-tile:hover {
        transform: translateY(-2px);
        box-shadow: 0 14px 30px rgba(15, 23, 42, 0.1);
        border-color: color-mix(in srgb, var(--brand) 40%, #e5e7eb);
        color: #0f172a;
    }

    .admin-tile .icon { color: var(--brand); }
    .admin-tile span { color: #64748b; font-size: 14px; }

.sec-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

    .sec-stats div {
        background: #fff;
        border: 1px solid #e5e7eb;
        border-radius: 14px;
        padding: 14px 16px;
        display: flex;
        flex-direction: column;
    }

    .sec-stats strong { font-size: 26px; line-height: 1.1; }
    .sec-stats span { color: #64748b; font-size: 13px; }
    .sec-stats .is-warn strong { color: #dc2626; }

.users-table .clickable { cursor: pointer; }

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}

.role-chip {
    display: inline-block;
    padding: 2px 10px;
    margin: 2px 4px 2px 0;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    font-size: 12px;
    font-weight: 600;
}

    .role-chip.is-protected { background: #fef3c7; color: #92400e; }

.methods { white-space: nowrap; }

    .methods span { margin-right: 8px; color: #94a3b8; }
    .methods .ok { color: #16a34a; }
    .methods .ext { font-size: 11px; background: #f1f5f9; color: #334155; border-radius: 6px; padding: 1px 6px; }

.group-picker, .perm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}

.group-option, .perm-option {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

    .group-option input, .perm-option input { margin-top: 4px; accent-color: var(--brand); }
    .group-option span, .perm-option span { display: flex; flex-direction: column; }
    .group-option small, .perm-option small { color: #64748b; }
    .group-option.is-on, .perm-option.is-on { border-color: var(--brand); background: var(--brand-soft); }
    .group-option.is-locked { opacity: .65; cursor: not-allowed; }

.method-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 4px 16px;
    padding-left: 24px;
}

.effective-policy {
    background: #f8fafc;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
}

.group-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.group-card {
    text-align: left;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 14px;
    padding: 14px 16px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.2s;
}

    .group-card:hover { box-shadow: 0 8px 20px rgba(15, 23, 42, 0.07); }
    .group-card.is-active { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
    .group-card.is-protected { border-left: 4px solid #f59e0b; }

.perm-dots {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
}

    .perm-dots span { font-size: 11px; padding: 1px 8px; border-radius: 999px; background: #f1f5f9; color: #94a3b8; }
    .perm-dots span.on { background: #dcfce7; color: #166534; }

.empty-hint {
    text-align: center;
    color: #94a3b8;
    padding: 60px 20px;
    border: 2px dashed #e5e7eb;
    border-radius: 18px;
}

.provider-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

    .provider-list li {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 10px;
        padding: 10px 12px;
        border: 1px solid #e5e7eb;
        border-radius: 12px;
    }

        .provider-list li span { flex: 1; font-weight: 600; }
        .provider-list li em { font-style: normal; font-size: 12px; font-weight: 700; color: #94a3b8; }
        .provider-list li.is-on em { color: #16a34a; }
        .provider-list li code { width: 100%; }

/* ===== Journal ===== */
.journal-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.journal-filters .form-select, .journal-filters .form-control { width: auto; min-width: 180px; flex: 0 1 220px; }
.journal-filters .form-control { flex: 1 1 220px; }
.journal-scopes { display: inline-flex; background: #eef2f7; border-radius: 999px; padding: 3px; }
.journal-scopes button { border: 0; background: transparent; padding: 6px 14px; border-radius: 999px; font-size: 14px; color: #475569; }
.journal-scopes button.active { background: #fff; color: #0f172a; font-weight: 600; box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.journal { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; overflow: hidden; }
.journal-day { padding: 8px 16px; background: #f8fafc; border-bottom: 1px solid #e2e8f0; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: #64748b; }
.journal-row { display: grid; grid-template-columns: 84px 150px minmax(0, 1fr) 200px; gap: 12px; align-items: start; padding: 10px 16px; border-bottom: 1px solid #f1f5f9; }
.journal-row:last-child { border-bottom: 0; }
.journal-row:hover { background: #fbfdff; }
.journal-time { color: #64748b; font-variant-numeric: tabular-nums; padding-top: 2px; }
.journal-kind { justify-self: start; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.journal-kind.is-created { background: #dcfce7; color: #166534; }
.journal-kind.is-updated { background: #dbeafe; color: #1e40af; }
.journal-kind.is-deleted { background: #fee2e2; color: #991b1b; }
.journal-kind.is-viewed { background: #f1f5f9; color: #475569; }
.journal-kind.is-session { background: #ede9fe; color: #5b21b6; }
.journal-kind.is-alert { background: #ffedd5; color: #9a3412; }
.journal-what { min-width: 0; overflow-wrap: anywhere; }
.journal-what .text-muted { margin-right: 4px; }
.journal-path { color: #64748b; font-size: 12px; margin-left: 6px; }
.journal-who { text-align: right; overflow-wrap: anywhere; }
.journal-changes { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px 12px; margin: 6px 0 2px; font-size: 13px; }
.journal-changes dt { color: #64748b; font-weight: 500; }
.journal-changes dd { margin: 0; }
.journal-changes .old { color: #991b1b; text-decoration: line-through; text-decoration-color: rgba(153, 27, 27, .4); }
.journal-changes .new { color: #166534; }
.journal-changes .arrow { color: #94a3b8; margin: 0 6px; }
@media (max-width: 900px) {
    .journal-row { grid-template-columns: 56px minmax(0, 1fr); }
    .journal-kind { grid-column: 2; }
    .journal-what { grid-column: 1 / -1; }
    .journal-who { grid-column: 1 / -1; text-align: left; }
}
