/**
 * SCAP Workout Sync - styles du bouton et de la modale.
 *
 * Charte reprise du theme SCAP :
 *   --rouge #E00838 / --noir #16161A / --creme #F8F4EC
 *   typographie Outfit (titres) + Inter (texte), rayon 18px.
 *
 * Le plugin redefinit ses propres variables avec un prefixe scap-ws afin de
 * ne dependre d'aucune classe du theme, tout en héritant de la charte si
 * elle est presente.
 */

.scap-ws-action {
    margin: 18px 0 4px;
    padding-top: 16px;
    border-top: 1px solid rgba(20, 20, 25, .1);
}

/* ------------------------------------------------------------------ */
/* Bouton principal                                                     */
/* ------------------------------------------------------------------ */
.scap-ws-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 52px; /* cible tactile confortable sur mobile */
    padding: 14px 22px;
    border: 2px solid transparent;
    border-radius: 999px;
    font-family: var(--outfit, 'Outfit', 'Segoe UI', sans-serif);
    font-weight: 700;
    font-size: 15px;
    letter-spacing: .04em;
    text-transform: uppercase;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: transform .3s cubic-bezier(.4, 0, .2, 1),
                background .3s cubic-bezier(.4, 0, .2, 1),
                color .3s cubic-bezier(.4, 0, .2, 1),
                box-shadow .3s cubic-bezier(.4, 0, .2, 1);
}

.scap-ws-btn-ico {
    display: inline-flex;
    flex: none;
}

.scap-ws-btn-ico svg {
    width: 20px;
    height: 20px;
}

.scap-ws-btn-sync,
.scap-ws-btn-primary {
    background: #E00838;
    color: #fff;
    box-shadow: 0 14px 30px -12px rgba(224, 8, 56, .7);
}

.scap-ws-btn-sync:hover,
.scap-ws-btn-primary:hover {
    background: #B30A2F;
    color: #fff;
    transform: translateY(-2px);
}

.scap-ws-btn-sync:active,
.scap-ws-btn-primary:active {
    transform: translateY(0);
}

.scap-ws-btn-ghost {
    background: transparent;
    color: #16161A;
    border-color: rgba(20, 20, 25, .22);
}

.scap-ws-btn-ghost:hover {
    background: #16161A;
    color: #F8F4EC;
}

/* Bouton inactif : sert pour la redemande d adhesion deja envoyee.
   On garde le meme gabarit que les autres boutons, sans ombre ni
   survol, afin que la griser ne fausse pas l alignement. */
.scap-ws-btn-disabled,
.scap-ws-btn-disabled:hover {
    background: rgba(20, 20, 25, .06);
    color: rgba(20, 20, 25, .45);
    border-color: rgba(20, 20, 25, .12);
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
    pointer-events: none;
}

.scap-ws-btn:focus-visible {
    outline: 3px solid rgba(224, 8, 56, .55);
    outline-offset: 3px;
}

/* ------------------------------------------------------------------ */
/* Modale                                                               */
/* ------------------------------------------------------------------ */
.scap-ws-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease;
}

.scap-ws-modal.is-open {
    opacity: 1;
    visibility: visible;
}

.scap-ws-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 20, 25, .62);
    backdrop-filter: blur(3px);
}

.scap-ws-modal-card {
    position: relative;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #FFFDF8;
    border-radius: 22px 22px 0 0;
    padding: 28px 22px calc(24px + env(safe-area-inset-bottom, 0px));
    transform: translateY(24px);
    transition: transform .3s cubic-bezier(.4, 0, .2, 1);
    box-shadow: 0 -12px 40px rgba(20, 20, 25, .28);
}

.scap-ws-modal.is-open .scap-ws-modal-card {
    transform: translateY(0);
}

.scap-ws-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: rgba(20, 20, 25, .06);
    color: #16161A;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.scap-ws-modal-title {
    margin: 0 44px 6px 0;
    font-family: var(--outfit, 'Outfit', sans-serif);
    font-size: 21px;
    font-weight: 800;
    color: #16161A;
    line-height: 1.2;
}

.scap-ws-modal-date {
    margin: 0 0 4px;
    font-family: var(--outfit, 'Outfit', sans-serif);
    font-weight: 600;
    font-size: 14px;
    color: #E00838;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.scap-ws-modal-name {
    margin: 0 0 14px;
    font-size: 16px;
    font-weight: 600;
    color: #403F43;
}

.scap-ws-modal-summary {
    margin: 0 0 22px;
    padding: 14px 16px;
    background: rgba(20, 20, 25, .045);
    border-left: 4px solid #E00838;
    border-radius: 12px;
    font-size: 14.5px;
    line-height: 1.6;
    color: #403F43;
}

.scap-ws-modal-lead {
    margin: 0 0 12px;
    font-family: var(--outfit, 'Outfit', sans-serif);
    font-weight: 700;
    font-size: 14px;
    color: #16161A;
}

/* Liste des plateformes */
.scap-ws-providers {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0 0 6px;
    padding: 0;
    list-style: none;
}

.scap-ws-provider {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 56px;
    padding: 14px 18px;
    border: 2px solid rgba(20, 20, 25, .12);
    border-radius: 16px;
    background: #fff;
    font-family: var(--outfit, 'Outfit', sans-serif);
    font-weight: 700;
    font-size: 15px;
    color: #16161A;
    text-align: left;
    cursor: pointer;
    transition: border-color .2s ease, background .2s ease, transform .2s ease;
}

.scap-ws-provider:hover:not(:disabled) {
    border-color: #E00838;
    background: rgba(224, 8, 56, .04);
}

.scap-ws-provider:disabled {
    cursor: not-allowed;
    opacity: .62;
    background: #F4F1EA;
}

.scap-ws-provider-ico {
    display: inline-flex;
    flex: none;
    width: 22px;
    height: 22px;
}

.scap-ws-provider-ico svg {
    width: 100%;
    height: 100%;
}

.scap-ws-provider-tag {
    margin-left: auto;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #8E8D92;
}

/* Etats */
.scap-ws-status {
    margin: 4px 0 0;
    font-size: 14.5px;
    line-height: 1.55;
    color: #403F43;
}

.scap-ws-status.is-loading { color: #8E8D92; }
.scap-ws-status.is-ok { color: #1a7f37; font-weight: 600; }
.scap-ws-status.is-ko { color: #B30A2F; font-weight: 600; }

.scap-ws-hint {
    margin: 12px 0 0;
    font-size: 12.5px;
    line-height: 1.5;
    color: #8E8D92;
}

.scap-ws-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.scap-ws-actions .scap-ws-btn {
    width: auto;
    flex: 1 1 auto;
    min-height: 48px;
}

/* ------------------------------------------------------------------ */
/* Page « Ma montre »                                                   */
/* ------------------------------------------------------------------ */
.scap-ws-account {
    margin: 30px 0;
}

.scap-ws-account-title {
    font-family: var(--outfit, 'Outfit', sans-serif);
    font-size: 24px;
    font-weight: 800;
    color: #16161A;
    margin-bottom: 6px;
}

.scap-ws-account-intro {
    font-size: 15px;
    color: #403F43;
    margin-bottom: 22px;
}

.scap-ws-notice {
    padding: 13px 16px;
    border-radius: 12px;
    font-size: 14.5px;
    margin-bottom: 18px;
    border-left: 4px solid;
}

.scap-ws-notice-success { background: rgba(26, 127, 55, .08); border-color: #1a7f37; color: #14612b; }
.scap-ws-notice-error { background: rgba(179, 10, 47, .08); border-color: #B30A2F; color: #8d0824; }

.scap-ws-empty {
    font-family: var(--outfit, 'Outfit', sans-serif);
    font-weight: 800;
    font-size: 18px;
    color: #16161A;
    margin: 0 0 4px;
}

.scap-ws-empty-hint {
    font-size: 14.5px;
    color: #6A6A70;
    margin: 0 0 20px;
}

.scap-ws-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.scap-ws-item {
    border: 1px solid rgba(20, 20, 25, .12);
    border-radius: 16px;
    padding: 16px 18px;
    background: #FFFDF8;
}

.scap-ws-item-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.scap-ws-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #C9C6BE;
    flex: none;
}

.scap-ws-item.is-connected .scap-ws-dot { background: #1a7f37; }

.scap-ws-item-name {
    font-family: var(--outfit, 'Outfit', sans-serif);
    font-weight: 700;
    font-size: 16px;
    color: #16161A;
}

.scap-ws-status-badge,
.scap-ws-item .scap-ws-status {
    font-size: 12.5px;
    font-weight: 600;
    color: #1a7f37;
    margin: 0;
}

.scap-ws-status-soon { color: #8E8D92 !important; }

.scap-ws-item-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.scap-ws-item-actions .scap-ws-btn {
    width: auto;
    min-height: 46px;
    padding: 12px 20px;
    font-size: 13.5px;
}

.scap-ws-soon {
    font-size: 13px;
    color: #8E8D92;
    font-style: italic;
}

/* Badge admin */
.scap-ws-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.scap-ws-badge-ok { background: rgba(26, 127, 55, .12); color: #14612b; }
.scap-ws-badge-pending { background: rgba(201, 106, 10, .14); color: #8a4207; }
.scap-ws-badge-ko { background: rgba(179, 10, 47, .12); color: #8d0824; }

/* ------------------------------------------------------------------ */
/* Ecran large : la modale se centre                                   */
/* ------------------------------------------------------------------ */
@media (min-width: 720px) {
    .scap-ws-modal {
        align-items: center;
        padding: 24px;
    }

    .scap-ws-modal-card {
        border-radius: 22px;
        max-height: 86vh;
        padding: 32px 30px;
    }

    .scap-ws-btn {
        width: auto;
    }

    .scap-ws-action .scap-ws-btn {
        width: auto;
        min-width: 300px;
    }
}

/* Petits ecrans : on garantit un confort tactile */
@media (max-width: 380px) {
    .scap-ws-btn {
        font-size: 13.5px;
        padding: 14px 16px;
    }

    .scap-ws-modal-card {
        padding: 24px 18px calc(20px + env(safe-area-inset-bottom, 0px));
    }
}

@media (prefers-reduced-motion: reduce) {
    .scap-ws-btn,
    .scap-ws-modal,
    .scap-ws-modal-card {
        transition: none;
    }
}