/* ============================================================
   Euphoria ID — ADMIN USERS
   ============================================================ */

.bid-user-actions{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:7px;
}

.bid-user-actions form{
  display:inline-flex;
  margin:0;
  padding:0;
}

.bid-user-actions .mb-btn,
.bid-user-actions button{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:36px;
  box-sizing:border-box;
  margin:0;
  padding:7px 10px;
  border-radius:9px;
  font-size:11px;
  font-weight:700;
  line-height:1;
  white-space:nowrap;
}

.bid-user-delete-link,
.bid-user-delete-link:visited{
  border:1px solid rgba(0,113,138,.15) !important;
  background:rgba(0,113,138,.055) !important;
  color:#00718a !important;
}

.bid-user-delete-link:hover{
  background:rgba(0,113,138,.10) !important;
  color:#00718a !important;
}

.bid-user-role{
  font-size:12px;
  font-weight:700;
}

.bid-user-status{
  display:inline-flex;
  align-items:center;
  gap:5px;
  margin-top:5px;
  padding:4px 7px;
  border-radius:999px;
  font-size:10px;
  font-weight:750;
}

.bid-user-status::before{
  content:"";
  width:6px;
  height:6px;
  border-radius:50%;
  background:currentColor;
}

.bid-user-status.is-active{
  background:rgba(30,133,78,.08);
  color:#26764b;
}

.bid-user-status.is-disabled{
  background:rgba(82,106,122,.10);
  color:#526a7a;
}

/* Tableau */

body table{
  width:100%;
}

body table th{
  color:#526a7a;
  font-size:10px;
  font-weight:750;
  letter-spacing:.06em;
  text-transform:uppercase;
}

body table td{
  vertical-align:middle;
}

/* ============================================================
   MOBILE
   ============================================================ */

@media(max-width:760px){

  .mb-container > .card:has(table){
    overflow:visible;
    padding:0;
    border:0;
    background:transparent;
    box-shadow:none;
  }

  .mb-container table,
  .mb-container table tbody{
    display:block;
    width:100%;
  }

  .mb-container table thead{
    display:none;
  }

  .mb-container table tr{
    display:grid;
    width:100%;
    box-sizing:border-box;
    margin-bottom:12px;
    padding:16px;
    border:1px solid rgba(3,31,53,.08);
    border-radius:16px;
    background:rgba(255,255,255,.88);
    box-shadow:0 8px 24px rgba(3,31,53,.035);
  }

  .mb-container table td{
    display:block;
    width:100%;
    box-sizing:border-box;
    padding:6px 0;
    border:0;
  }

  .mb-container table td:first-child{
    padding-top:0;
    padding-bottom:10px;
    border-bottom:1px solid rgba(3,31,53,.06);
  }

  .mb-container table td:last-child{
    margin-top:8px;
    padding-top:12px;
    border-top:1px solid rgba(3,31,53,.06);
  }

  .bid-user-actions{
    display:grid;
    grid-template-columns:1fr 1fr;
    width:100%;
    gap:7px;
  }

  .bid-user-actions form{
    display:block;
    width:100%;
  }

  .bid-user-actions .mb-btn,
  .bid-user-actions button{
    width:100%;
    min-height:40px;
  }
}

@media(max-width:390px){

  .bid-user-actions{
    grid-template-columns:1fr;
  }
}

/* ============================================================
   ADMIN USERS — SEARCH V2
   ============================================================ */

.bid-users-toolbar__actions{
  display:flex;
  align-items:center;
  gap:10px;
}

#bid-users-search{
  appearance:none;
  -webkit-appearance:none;

  width:320px;
  height:46px;

  box-sizing:border-box;

  margin:0 !important;
  padding:0 16px 0 42px !important;

  border:1px solid rgba(0,113,138,.13) !important;
  border-radius:14px !important;

  outline:none;

  background:
    rgba(255,255,255,.78)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23781428' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E")
    no-repeat
    14px
    center !important;

  color:#526a7a;

  font:inherit;
  font-size:13px;

  box-shadow:
    0 5px 18px rgba(3,31,53,.025);

  transition:
    border-color .18s ease,
    box-shadow .18s ease,
    background-color .18s ease;
}

#bid-users-search::placeholder{
  color:#526a7a;
  opacity:1;
}

#bid-users-search:hover{
  border-color:rgba(0,113,138,.22) !important;
}

#bid-users-search:focus{
  border-color:rgba(0,113,138,.38) !important;

  background-color:#fff !important;

  box-shadow:
    0 0 0 4px rgba(0,113,138,.065),
    0 8px 24px rgba(3,31,53,.04);
}

#bid-users-search::-webkit-search-cancel-button{
  cursor:pointer;
}


/* Rôle */

.bid-user-role{
  display:inline-flex;
  align-items:center;

  min-height:27px;

  padding:4px 9px;

  border-radius:999px;

  background:rgba(0,113,138,.065);

  color:#00718a;

  font-size:10px;
  font-weight:750;
}


/* Toolbar */

#bid-users-create{
  height:46px;
  padding:0 18px !important;
  border-radius:14px !important;
}


/* Mobile */

@media(max-width:760px){

  .bid-users-toolbar__actions{
    display:grid;
    grid-template-columns:1fr;
    width:100%;
  }

  #bid-users-search,
  #bid-users-create{
    width:100%;
  }
}

/* ============================================================
   ADMIN USERS — ESPACEMENTS TOOLBAR
   ============================================================ */

.bid-users-toolbar{
  margin-bottom:32px !important;
}

.bid-users-toolbar__actions{
  gap:16px !important;
}

/* Espace supplémentaire avant le tableau */
.bid-users-toolbar + .card{
  margin-top:0 !important;
}

/* Mobile */
@media(max-width:760px){

  .bid-users-toolbar{
    margin-bottom:24px !important;
  }

  .bid-users-toolbar__actions{
    gap:12px !important;
  }
}

/* ADMIN USERS — spacing V2 */

body .mb-container .bid-users-toolbar{
    margin-bottom:36px !important;
}

body .mb-container .bid-users-toolbar__actions{
    display:flex !important;
    gap:20px !important;
}

body .mb-container .bid-users-toolbar + [data-users-crud]{
    margin-top:0 !important;
}

@media(max-width:760px){

    body .mb-container .bid-users-toolbar{
        margin-bottom:26px !important;
    }

    body .mb-container .bid-users-toolbar__actions{
        gap:14px !important;
    }
}

/* ============================================================
   ADMIN USERS — MODAL CREATION
   ============================================================ */

.bid-user-modal{
    position:fixed;
    inset:0;
    z-index:100000;

    display:flex;
    align-items:center;
    justify-content:center;

    box-sizing:border-box;

    padding:24px;

    background:
        rgba(3,31,53,.46);

    backdrop-filter:blur(7px);
    -webkit-backdrop-filter:blur(7px);

    opacity:0;
    visibility:hidden;
    pointer-events:none;

    transition:
        opacity .2s ease,
        visibility .2s ease;
}


.bid-user-modal.is-open{
    opacity:1;
    visibility:visible;
    pointer-events:auto;
}


body.bid-user-modal-open{
    overflow:hidden !important;
}


/* ============================================================
   PANEL
   ============================================================ */

.bid-user-modal__panel{
    display:grid;

    grid-template-rows:
        auto
        minmax(0,1fr)
        auto;

    width:
        min(
            760px,
            calc(100vw - 40px)
        );

    max-height:
        calc(100dvh - 48px);

    overflow:hidden;

    border:
        1px solid
        rgba(0,113,138,.10);

    border-radius:22px;

    background:#fff;

    box-shadow:
        0 30px 90px
        rgba(3,31,53,.22);

    transform:
        translateY(12px)
        scale(.985);

    transition:
        transform .2s ease;
}


.bid-user-modal.is-open
.bid-user-modal__panel{
    transform:
        translateY(0)
        scale(1);
}


/* ============================================================
   HEADER
   ============================================================ */

.bid-user-modal__head{
    position:relative;
    z-index:20;

    display:flex;
    align-items:center;
    justify-content:space-between;

    gap:20px;

    box-sizing:border-box;

    margin:0;

    padding:
        22px
        26px;

    border-bottom:
        1px solid
        rgba(0,113,138,.09);

    background:
        rgba(255,255,255,.97);

    backdrop-filter:blur(18px);
    -webkit-backdrop-filter:blur(18px);
}


.bid-user-modal__head
.mb-eyebrow{
    margin:
        0
        0
        5px;
}


.bid-user-modal__head h2{
    margin:0;
}


/* Croix */

.bid-user-modal__close{
    display:flex !important;
    align-items:center;
    justify-content:center;

    width:44px;
    height:44px;
    flex:0 0 44px;

    margin:0 !important;
    padding:0 !important;

    border:
        1px solid
        rgba(0,113,138,.10) !important;

    border-radius:13px !important;

    background:
        rgba(0,113,138,.045) !important;

    color:#00718a !important;

    font-size:25px !important;
    font-weight:300 !important;
    line-height:1 !important;

    cursor:pointer;
}


/* ============================================================
   BODY SCROLLABLE
   ============================================================ */

.bid-user-modal__body{
    min-height:0;

    overflow-x:hidden;
    overflow-y:auto;

    -webkit-overflow-scrolling:touch;

    background:#fff;
}


.bid-user-modal__body
#bid-users-create-card{
    display:block !important;

    margin:0 !important;

    padding:
        24px
        26px
        30px !important;

    overflow:visible !important;

    border:0 !important;
    border-radius:0 !important;

    background:#fff !important;

    box-shadow:none !important;
}


/*
 * Le titre original est remplacé
 * par celui du header du modal.
 */

.bid-user-modal__body
#bid-users-create-card
> .mb-eyebrow,

.bid-user-modal__body
#bid-users-create-card
> h2{
    display:none;
}


/* Actions originales masquées */

.bid-user-modal__body
#bid-users-create-card
.actions{
    display:none !important;
}


/* ============================================================
   FOOTER
   ============================================================ */

.bid-user-modal__footer{
    position:relative;
    z-index:30;

    display:flex !important;
    align-items:center;
    justify-content:flex-end;

    gap:12px;

    min-height:78px;

    box-sizing:border-box;

    padding:
        15px
        26px;

    border-top:
        1px solid
        rgba(0,113,138,.10);

    background:#fff;

    box-shadow:
        0 -10px 30px
        rgba(3,31,53,.055);
}


.bid-user-modal__footer button{
    display:inline-flex !important;
    align-items:center;
    justify-content:center;

    visibility:visible !important;
    opacity:1 !important;

    height:46px !important;
    min-height:46px !important;

    margin:0 !important;
    padding:
        0
        20px !important;

    border-radius:13px !important;

    font-size:13px !important;
    font-weight:700 !important;

    cursor:pointer;
}


.bid-user-modal__cancel{
    min-width:120px !important;

    border:
        1px solid
        rgba(0,113,138,.12) !important;

    background:#fff !important;
    color:#526a7a !important;
}


.bid-user-modal__submit{
    min-width:210px !important;

    border:
        1px solid
        #00718a !important;

    background:#00718a !important;
    color:#fff !important;

    box-shadow:
        0 8px 22px
        rgba(0,113,138,.16) !important;
}


.bid-user-modal__submit:hover{
    background:#031f35 !important;
}


/* ============================================================
   MOBILE
   ============================================================ */

@media(max-width:760px){

    .bid-user-modal{
        align-items:flex-end;

        padding:
            10px
            10px
            max(
                10px,
                env(safe-area-inset-bottom)
            );
    }


    .bid-user-modal__panel{
        width:100%;

        max-height:
            calc(100dvh - 20px);

        border-radius:
            20px
            20px
            16px
            16px;
    }


    .bid-user-modal__head{
        padding:
            17px
            17px
            15px;
    }


    .bid-user-modal__body
    #bid-users-create-card{
        padding:
            18px
            17px
            24px !important;
    }


    .bid-user-modal__footer{
        display:grid !important;

        grid-template-columns:
            minmax(0,.75fr)
            minmax(0,1.25fr);

        padding:
            12px
            17px
            max(
                12px,
                env(safe-area-inset-bottom)
            );
    }


    .bid-user-modal__footer button{
        width:100% !important;
        min-width:0 !important;
    }
}


@media(max-width:390px){

    .bid-user-modal__footer{
        grid-template-columns:1fr;
    }
}

/* ============================================================
   USER MODAL V2 — FORMULAIRE VISIBLE
   ============================================================ */

.bid-user-modal__body{
    display:block !important;

    min-height:0 !important;

    overflow-x:hidden !important;
    overflow-y:auto !important;

    background:#fff !important;

    -webkit-overflow-scrolling:touch;
}


/* La card doit impérativement être visible dans le modal */

.bid-user-modal__body #bid-users-create-card,
.bid-user-modal__body #bid-users-create-card[hidden]{
    display:block !important;
    visibility:visible !important;
    opacity:1 !important;

    position:relative !important;

    width:100% !important;

    box-sizing:border-box !important;

    margin:0 !important;
    padding:26px !important;

    border:0 !important;
    border-radius:0 !important;

    background:#fff !important;

    box-shadow:none !important;
}


/* Le formulaire lui-même */

.bid-user-modal__body #bid-users-create-card form{
    display:block !important;
    visibility:visible !important;
    opacity:1 !important;

    width:100% !important;

    margin:0 !important;
    padding:0 !important;
}


/* Description */

.bid-user-modal__body #bid-users-create-card > p.muted{
    display:block !important;

    margin:
        0
        0
        24px !important;

    color:#526a7a !important;
}


/* Grilles */

.bid-user-modal__body #bid-users-create-card .grid{
    display:grid !important;

    grid-template-columns:
        repeat(2,minmax(0,1fr)) !important;

    gap:18px !important;

    width:100% !important;
}


/* Champs */

.bid-user-modal__body #bid-users-create-card label{
    display:block !important;

    margin:
        0
        0
        7px !important;

    color:#526a7a !important;

    font-size:12px !important;
    font-weight:700 !important;
}


.bid-user-modal__body #bid-users-create-card input,
.bid-user-modal__body #bid-users-create-card select{
    display:block !important;

    width:100% !important;
    min-height:46px !important;

    box-sizing:border-box !important;

    margin:0 !important;
    padding:
        0
        14px !important;

    border:
        1px solid
        rgba(0,113,138,.13) !important;

    border-radius:13px !important;

    background:#fff !important;

    color:#526a7a !important;

    font:inherit !important;
}


/* Espace entre les lignes */

.bid-user-modal__body #bid-users-create-card .grid > div{
    margin-bottom:4px;
}


/* Les actions originales restent cachées :
   le footer du modal les remplace. */

.bid-user-modal__body #bid-users-create-card .actions{
    display:none !important;
}


/* ============================================================
   MOBILE
   ============================================================ */

@media(max-width:760px){

    .bid-user-modal__body #bid-users-create-card,
    .bid-user-modal__body #bid-users-create-card[hidden]{
        padding:
            20px
            17px
            26px !important;
    }

    .bid-user-modal__body #bid-users-create-card .grid{
        grid-template-columns:1fr !important;

        gap:14px !important;
    }
}

/* ============================================================
   USER MODAL V3 — SUPPRESSION ACTIONS EN DOUBLON
   ============================================================ */

/*
 * Les actions présentes dans le formulaire original sont
 * remplacées par le footer sticky du modal.
 */
.bid-user-modal__body
#bid-users-create-card
form > .actions{
    display:none !important;
    visibility:hidden !important;
    opacity:0 !important;

    position:absolute !important;

    width:0 !important;
    height:0 !important;

    min-width:0 !important;
    min-height:0 !important;

    margin:0 !important;
    padding:0 !important;

    overflow:hidden !important;

    pointer-events:none !important;
}


/*
 * Le footer du modal reste, lui, toujours visible.
 */
.bid-user-modal__footer{
    display:flex !important;
    visibility:visible !important;
    opacity:1 !important;
}

.bid-user-modal__footer
.bid-user-modal__cancel,

.bid-user-modal__footer
.bid-user-modal__submit{
    display:inline-flex !important;
    visibility:visible !important;
    opacity:1 !important;
}


/* Mobile */

@media(max-width:760px){

    .bid-user-modal__footer{
        display:grid !important;
    }
}

/* ============================================================
   ADMIN USERS — ESPACEMENT TOOLBAR / TABLEAU
   ============================================================ */

/* Recherche + bouton */
body .mb-container .bid-users-toolbar__actions{
    display:flex !important;
    align-items:center !important;

    gap:20px !important;
}


/* Espace entre toute la toolbar et le tableau */
body .mb-container .bid-users-toolbar{
    margin-bottom:36px !important;
}


/* On évite qu'une règle globale annule l'espacement */
body .mb-container .bid-users-toolbar + [data-users-crud]{
    margin-top:0 !important;
}


/* Mobile */
@media(max-width:760px){

    body .mb-container .bid-users-toolbar{
        margin-bottom:26px !important;
    }

    body .mb-container .bid-users-toolbar__actions{
        display:grid !important;
        grid-template-columns:1fr !important;

        gap:14px !important;
    }

    body .mb-container #bid-users-search,
    body .mb-container #bid-users-create{
        width:100% !important;
    }
}
