/* profile.css */

/* =========================
   PROFILE : Card scroll (desktop) / normal scroll (mobile)
   ========================= */

.profile-shell{
  height: auto;
  overflow: visible;
  overscroll-behavior: auto;
  scrollbar-gutter: auto;
  min-height: 0;
  margin: 0;
}

/* IMPORTANT :
   La classe .card a une animation qui finit sur transform: translateY(0)
   => ça "scope" les position:fixed des enfants.
   On neutralise uniquement pour la card profile, sinon les modals ne couvrent pas tout le site. */
.profile-shell.card{
  animation: none !important;
  transform: none !important;
}
.profile-shell.card:hover{
  transform: none !important;
}

@media (min-width: 861px){
  .profile-shell{
    margin: 50px 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    padding-bottom: 0;
    max-height: calc(100vh - 100px);
  }
}

/* =========================
   Header
   ========================= */

.profile-top{
  margin-bottom: 16px;
  text-align: center;
}
.profile-title{
  margin: 0;
}
.profile-sub{
  margin: 6px 0 0;
  font-weight: 700;
}

/* =========================
   Form layout
   ========================= */

.profile-form{ display:block; }
.profile-scroll{
  display:flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

/* =========================
   Hero
   ========================= */

.profile-hero{
  display:flex;
  flex-direction: column;
  gap: 12px;
}

.hero-grid{
  display:grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

@media (min-width: 861px){
  .hero-grid{
    grid-template-columns: 180px 1fr;
    gap: 18px;
  }
}

.hero-avatar{
  display:flex;
  justify-content: center;
}

.avatar-wrap{
  position: relative;
  width: 156px;
  height: 156px;
}

.avatar{
  width: 156px;
  height: 156px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--panel2);
  display:grid;
  place-items:center;
  box-shadow: var(--shadow);
}

.avatar img{
  width:100%;
  height:100%;
  object-fit: cover;
  display:block;
}

.avatar-initials{
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 46px;
  color: rgba(11,18,32,.78);
}

.avatar-editbtn{
  position:absolute;
  right: 10px;
  bottom: 10px;

  width: 40px;
  height: 40px;
  border-radius: 14px;

  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,.62), rgba(255,255,255,.34));
  box-shadow: 0 14px 46px rgba(16,24,40,.12);
  cursor:pointer;

  display:grid;
  place-items:center;

  transition: transform var(--dur-1) var(--ease), border-color var(--dur-2) var(--ease);
}
.avatar-editbtn:hover{
  transform: translateY(-1px);
  border-color: rgba(var(--c3r),var(--c3g),var(--c3b),.30);
}

.hero-fields{
  display:grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.pfield{
  display:grid;
  gap: 6px;
}

.pfield textarea{
  min-height: 96px;
  resize: vertical;
}

.hero-bio{
  margin-top: 4px;
}

.row-inline{
  display:flex;
  gap: 10px;
  align-items: stretch;
}
.row-inline > *{ min-width: 0; }
.row-inline input{ flex: 1 1 auto; }
.row-inline .btn{ flex: 0 0 auto; white-space: nowrap; }

@media (max-width: 640px){
  .row-inline{ flex-direction: column; }
  .row-inline .btn{ width: 100%; justify-content: center; }
}

.btn.wide{ width: 100%; }

.readonly{
  opacity: .95;
  cursor: not-allowed;
  background: linear-gradient(180deg, rgba(255,255,255,.54), rgba(255,255,255,.30)) !important;
}

/* =========================
   Blocks + grids
   ========================= */

.profile-block{
  border-top: 1px solid var(--line2);
  padding-top: 12px;
}

.profile-block-title{
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .10em;
  text-transform: uppercase;
  color: rgba(11,18,32,.70);
  margin: 0 0 10px;
}

.pgrid{
  display:grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: start;
}

@media (min-width: 861px){
  .pgrid.pgrid-3{
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* =========================
   Consent box + chips en colonne
   ========================= */

.consent-box{
  border: 1px solid var(--line);
  background: var(--panel2);
  border-radius: 14px;
  padding: 14px;
}

.consent-head{
  display:flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.consent-title{
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 16px;
  margin: 0;
}

.consent-note{
  color: var(--muted);
  font-size: 13px;
}

.consent-filters{
  display:grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.consent-filter{
  width: 100%;
}

.consent-filter span{
  white-space: normal;
  line-height: 1.15;
}

.consent-filter.is-optional{
  opacity: .92;
}

/* =========================
   Actions bottom
   ========================= */

.profile-actions.bottom{
  display:flex;
  justify-content: center;
  padding-top: 8px;
}

.profile-actions.bottom .btn{
  width: min(320px, 100%);
  padding: 12px 20px;
  border-radius: 14px;
}

/* ============================================================
   MODALS (PROFILE) — même design/behavior que Home KW modal
   - overlay plein site
   - card centrée viewport
   - scroll interne
   - cachée par aria-hidden="true"
   ============================================================ */

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

/* base modal full viewport */
.modal{
  position: fixed !important;
  inset: 0 !important;
  z-index: 1000000 !important;

  display: none !important;
  padding: 18px !important;
}

/* IMPORTANT: sur profile.php, pas de class "hidden" au départ
   => on cache via aria-hidden */
.modal[aria-hidden="true"]{
  display: none !important;
}
.modal.hidden{
  display: none !important;
}

/* visible quand aria-hidden != true */
.modal:not(.hidden):not([aria-hidden="true"]){
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* backdrop plein site */
.modal .modal-backdrop{
  position: absolute !important;
  inset: 0 !important;
  background: rgba(0,0,0,.55) !important;
  backdrop-filter: blur(2px) !important;
  -webkit-backdrop-filter: blur(2px) !important;
}

/* card centrée + flex colonne + pas de scroll sur la card */
.modal .modal-card{
  position: relative !important;
  inset: auto !important;
  transform: none !important;
  margin: 0 !important;

  width: min(920px, calc(100vw - 36px)) !important;
  max-height: calc(100vh - 36px) !important;

  border: 1px solid var(--line) !important;
  background: var(--panel) !important;
  border-radius: 18px !important;
  box-shadow: 0 24px 80px rgba(0,0,0,.35) !important;
  padding: 14px !important;

  display: flex !important;
  flex-direction: column !important;

  overflow: hidden !important;
}

/* head / tabs */
.modal .modal-head{
  flex: 0 0 auto !important;
  display:flex !important;
  align-items:center !important;
  justify-content: space-between !important;
  gap: 10px !important;
}

.modal .modal-title{
  font-weight: 700;
  font-size: 18px;
  font-family: var(--font-display);
}

.modal .modal-tabs{
  flex: 0 0 auto !important;
  display:flex !important;
  gap: 8px !important;
  margin-top: 12px !important;
}

/* body scroll interne */
.modal .modal-body{
  flex: 1 1 auto !important;
  overflow: auto !important;
  padding: 10px 2px 2px !important;
}

/* list (si utilisée) */
.modal .modal-list{
  display: grid !important;
  gap: 10px !important;
  padding: 4px 2px !important;
}

/* actions (dans body) */
.modal .modal-actions{
  display: flex !important;
  justify-content: flex-end !important;
  gap: 10px !important;
  margin-top: 14px !important;
  flex-wrap: wrap !important;
}

.modal .modal-msg{
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
  min-height: 18px;
}

/* petits ajustements mobile */
@media (max-width: 640px){
  .modal{ padding: 12px !important; }
  .modal .modal-card{
    width: calc(100vw - 24px) !important;
    max-height: calc(100vh - 24px) !important;
  }
}
/* Email cliquable + bouton pass inline (raccord inputs home) */
.row-inline-actions{
  display:flex;
  gap:10px;
  align-items:stretch;
}

.email-click{
  flex: 1 1 auto;
  min-width: 0;

  display:flex;
  align-items:center;

  width:100%;
  padding: 17px 12px;

  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,.64), rgba(255,255,255,.40));
  color: var(--text);

  cursor:pointer;
  text-align:left;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

  transition:
    box-shadow var(--dur-2) var(--ease),
    border-color var(--dur-2) var(--ease),
    transform var(--dur-1) var(--ease),
    background var(--dur-2) var(--ease);
}

.email-click:hover{
  border-color: rgba(var(--c2r),var(--c2g),var(--c2b),.26);
}

.email-click:focus,
.email-click:focus-visible{
  outline:none;
  border-color: rgba(var(--c3r),var(--c3g),var(--c3b),.55);
  box-shadow: var(--ring);
  background: linear-gradient(180deg, rgba(255,255,255,.74), rgba(255,255,255,.46));
}

.pass-inline{
  flex: 0 0 auto;
  white-space: nowrap;
}

/* Mobile: stack */
@media (max-width: 640px){
  .row-inline-actions{ flex-direction: column; }
  .pass-inline{ width: 100%; justify-content:center; }
}

/* Consent chips: moins d'écart (max 10px) + en colonne */
.consent-chips.consent-filters{
  display:flex;
  flex-direction: column;
  gap: 10px;
}

.consent-chips.consent-filters .filter{
  margin: 0;
}
