/**
 * Fond filigrane — icônes flat secourisme (croix, cœur, AED, bandage, stéthoscope).
 * Discret : opacité via --vs-pattern-opacity / --vs-pattern-color.
 */

.vs-medical-pattern,
body.vs-public-page,
body.vs-auth-page,
body.vs-admin-app .admin-main {
    --vs-medical-tile: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220' viewBox='0 0 220 220'%3E%3Cg fill='none' stroke='%232ca58d' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3C!-- croix --%3E%3Cpath d='M36 28h16v12h12v16H52v12H36V56H24V40h12z'/%3E%3C!-- coeur --%3E%3Cpath d='M118 42c0-8 6-14 14-14 5 0 9 2 12 6 3-4 7-6 12-6 8 0 14 6 14 14 0 16-26 30-26 30S118 58 118 42z'/%3E%3C!-- AED --%3E%3Crect x='28' y='118' width='40' height='28' rx='4'/%3E%3Cpath d='M40 132h8l4-8 6 16 4-8h6'/%3E%3C!-- bandage --%3E%3Crect x='118' y='118' width='44' height='18' rx='9' transform='rotate(-20 140 127)'/%3E%3Ccircle cx='132' cy='124' r='2.5' fill='%232ca58d' stroke='none'/%3E%3Ccircle cx='148' cy='130' r='2.5' fill='%232ca58d' stroke='none'/%3E%3C!-- stethoscope --%3E%3Cpath d='M48 188c0-10 8-18 18-18s18 8 18 18'/%3E%3Cpath d='M48 188v8a14 14 0 0 0 28 0v-2'/%3E%3Ccircle cx='90' cy='198' r='6'/%3E%3Cpath d='M84 198h-6'/%3E%3C!-- syringe hint --%3E%3Cpath d='M150 178l22 22M168 174l10 10M154 198l6-6'/%3E%3C/g%3E%3C/svg%3E");
}

body.vs-public-page,
body.vs-auth-page {
    background-color: var(--vs-bg) !important;
    background-image: var(--vs-medical-tile) !important;
    background-size: 220px 220px !important;
    background-repeat: repeat !important;
    background-attachment: fixed;
}

body.vs-public-page::before,
body.vs-auth-page::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background: var(--vs-bg);
    opacity: calc(1 - var(--vs-pattern-opacity, 0.04) * 12);
}

/* Le motif reste visible via mix : on baisse l'opacité du voile */
body.vs-theme-light.vs-public-page::before,
body.vs-theme-light.vs-auth-page::before {
    opacity: 0.88;
}

body.vs-theme-dark.vs-public-page::before,
body.vs-theme-dark.vs-auth-page::before {
    opacity: 0.9;
}

body.vs-admin-app .admin-main {
    position: relative;
    background-color: var(--vs-bg);
    background-image: var(--vs-medical-tile);
    background-size: 220px 220px;
    background-repeat: repeat;
}

body.vs-admin-app .admin-main::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background: var(--vs-bg);
    opacity: 0.9;
}

body.vs-theme-dark.vs-admin-app .admin-main::before {
    opacity: 0.92;
}

body.vs-admin-app .admin-main > * {
    position: relative;
    z-index: 1;
}

body.vs-public-page .container,
body.vs-public-page .join-shell,
body.vs-auth-page .vs-auth-shell,
body.vs-auth-page .vs-auth-toolbar {
    position: relative;
    z-index: 1;
}

body.vitalsim-join-page {
    background-color: var(--vs-bg) !important;
    background-image: var(--vs-medical-tile) !important;
    background-size: 220px 220px !important;
    background-repeat: repeat !important;
}

body.vitalsim-join-page::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background: var(--vs-bg);
    opacity: 0.88;
}

body.vs-theme-dark.vitalsim-join-page::before {
    opacity: 0.9;
}

@media (prefers-reduced-motion: reduce) {
    body.vs-public-page,
    body.vs-auth-page,
    body.vitalsim-join-page {
        background-attachment: scroll !important;
    }
}
