/* ============================================================
   Shared account / profile menu — single source of truth.
   Styles the logged-in avatar + dropdown rendered by the shared
   partial view/logged_newindex.php (.box045-loged), so it looks
   identical on EVERY redesigned page where it is included.

   Requirement: the account container must carry the class "bgh-acct"
   and the page must load this stylesheet (after its page CSS).
   Currently used by: index.php (home) and search.php.
   ============================================================ */

.bgh-acct{position:relative;display:flex;align-items:center;gap:clamp(8px,1.4vw,16px);}

/* desktop notification button: its icon path (../img/…) 404s from the home root so it renders as a
   raw red blob. Hide it in the redesigned header (notifications stay reachable from the business pages). */
.bgh-acct .btndskn{display:none!important;}

/* ---- anonymous: the "Accedi" box (index.css pins it to the viewport corner) ---- */
.bgh-acct .contenitor-logged{
  position:static!important;float:none!important;width:auto!important;height:auto!important;
  margin:0!important;right:auto!important;top:auto!important;background:transparent!important;
}
.bgh-acct .contenitor-logged > .box045{position:static!important;float:none!important;width:auto!important;}

/* ---- logged-in: avatar + hamburger chip in the header (collapsed) — matches the legacy/production look ---- */
.bgh-acct .box045-loged{
  position:relative!important;float:none;right:auto;left:auto;top:0!important;margin:0;padding:0 28px 0 0!important;
  width:auto!important;min-width:0;height:auto!important;background:transparent;
  display:inline-flex;align-items:center;overflow:visible!important;border-radius:0!important;
}
/* nav items + "Gestisci menu" CTA live in the dropdown, never inline in the header (else the cluster overflows) */
.bgh-acct .btnmainmenu{display:none!important;}
.bgh-acct .barmobilebtn{display:none!important;}
.bgh-acct .box045-loged.bmenu .btnmainmenu{display:flex!important;}
.bgh-acct:has(.box045-loged) a.call-to-action-index{display:none!important;}
/* avatar (left) */
.bgh-acct .box045-loged .buttonprofilelogged{
  position:relative!important;top:auto;left:auto;right:auto;margin:0!important;padding:0!important;cursor:pointer;color:transparent;
  display:inline-flex!important;align-items:center;justify-content:center;overflow:visible!important;width:auto!important;height:auto!important;
}
.bgh-acct .box045-loged .imgprofile{
  width:32px!important;height:32px!important;border-radius:50%!important;display:block;object-fit:cover;box-sizing:border-box;margin:0!important;flex-shrink:0;
  background:#e8edf5;border:1.5px solid rgba(255,255,255,0.75);
}
/* hamburger (right of the avatar), collapsed state — like prod */
.bgh-acct .box045-loged .open-close-main-menu{display:block!important;position:absolute!important;right:0!important;left:auto!important;top:50%!important;transform:translateY(-50%)!important;cursor:pointer;line-height:0;z-index:2;}
.bgh-acct .box045-loged .open-close-main-menu #open-main-menu{display:block!important;width:22px!important;}
.bgh-acct .box045-loged .open-close-main-menu #close-main-menu{display:none!important;}

/* ---- logged-in: dropdown panel under the avatar (change() adds .bmenu) ---- */
/* shared: white surface, no leftover close-icon background from change() */
.bgh-acct .box045-loged.bmenu{background:#fff!important;background-image:none!important;z-index:300;display:block!important;}
/* DESKTOP (≥768px): compact dropdown panel under the avatar */
@media(min-width:768px){
  .bgh-acct .box045-loged.bmenu{
    position:fixed!important;top:8px!important;right:13px!important;left:auto!important;bottom:auto!important;   /* anchored to the top-right like prod (was absolute top:58 → drifted too low, esp. when scrolled) */
    width:222px!important;height:auto!important;min-width:222px;margin:0!important;padding:6px!important;
    border:1px solid #e8eaed;border-radius:14px!important;box-shadow:0 16px 40px rgba(17,24,39,0.15)!important;
  }
  /* show the close (X) toggle when the dropdown is open so it can be dismissed (was hidden → "can't close it") */
  .bgh-acct .box045-loged.bmenu .open-close-main-menu{display:block!important;position:absolute!important;top:13px!important;right:13px!important;left:auto!important;transform:none!important;width:auto;height:auto;cursor:pointer;z-index:3;background:none!important;}
  .bgh-acct .box045-loged.bmenu .open-close-main-menu #close-main-menu{display:block!important;width:15px!important;}
  .bgh-acct .box045-loged.bmenu .open-close-main-menu #open-main-menu{display:none!important;}
}

/* identity header (avatar + username) with a divider */
.bgh-acct .box045-loged.bmenu .buttonprofilelogged{
  display:flex!important;align-items:center;gap:10px;position:static!important;width:auto!important;height:auto!important;
  padding:7px 10px 10px!important;margin:0 0 5px!important;border-bottom:1px solid #eef0f2;cursor:default;
}
.bgh-acct .box045-loged.bmenu .imgprofile{width:34px!important;height:34px!important;margin:0!important;}
.bgh-acct .box045-loged.bmenu .usrn{display:inline-block!important;width:auto!important;max-width:none!important;overflow:visible!important;white-space:nowrap;flex-shrink:0;font-family:inherit;font-weight:800;font-size:14px;color:#111827;line-height:1.15;text-transform:none;}

/* menu items — compact, muted icons */
.bgh-acct .box045-loged.bmenu .btnmainmenu{
  display:flex!important;align-items:center;gap:11px;width:100%;padding:7px 10px;margin:0;border-radius:8px;
  color:#374151!important;font-family:inherit;font-size:13px;font-weight:600;
  text-align:left;float:none!important;text-decoration:none;
}
.bgh-acct .box045-loged.bmenu .btnmainmenu:hover{background:#f4f5f7;}
.bgh-acct .box045-loged.bmenu .btnmainmenu .image{width:16px;height:16px;flex-shrink:0;opacity:.5;}
.bgh-acct .box045-loged.bmenu .btnmainmenu font{color:inherit!important;display:inline!important;}

/* logout (last item) — divider above + red accent */
.bgh-acct .box045-loged.bmenu .btnmainmenu:last-child{
  margin-top:4px;padding-top:9px;border-top:1px solid #eef0f2;border-radius:0 0 9px 9px;
  color:#e5484d!important;font-weight:700;
}
.bgh-acct .box045-loged.bmenu .btnmainmenu:last-child:hover{background:#fdecec;}
.bgh-acct .box045-loged.bmenu .btnmainmenu:last-child .image{opacity:.85;}

/* MOBILE (<768px): full-screen overlay menu (like the previous mobile menu — X close, large rows) */
@media(max-width:767px){
  .bgh-acct .box045-loged.bmenu{
    position:fixed!important;top:0!important;left:0!important;right:0!important;bottom:0!important;
    /* width:100vw NO -> su detail l'header ha backdrop-filter (containing-block del fixed) e 100vw si gonfiava a 426px
       spingendo la X fuori schermo. width:100% = larghezza del containing-block (header=viewport=390) -> X dentro. */
    width:100%!important;min-width:0!important;height:100vh!important;height:100dvh!important;max-height:none!important;
    box-sizing:border-box!important;   /* su detail il menu era content-box: width 390 + padding 18×2 = 426 border-box -> X fuori. border-box -> 390 */
    margin:0!important;padding:18px 18px 32px!important;border:0!important;border-radius:0!important;
    box-shadow:none!important;overflow-y:auto!important;-webkit-overflow-scrolling:touch;
  }
  /* X close, top-right */
  .bgh-acct .box045-loged.bmenu .open-close-main-menu{display:block!important;position:absolute!important;top:16px!important;right:14px!important;left:auto!important;transform:none!important;width:auto;height:auto;cursor:pointer;z-index:2;background:none!important;}
  .bgh-acct .box045-loged.bmenu .open-close-main-menu #close-main-menu{display:block!important;width:24px!important;}
  .bgh-acct .box045-loged.bmenu .open-close-main-menu #open-main-menu{display:none!important;}
  /* larger identity header + rows */
  .bgh-acct .box045-loged.bmenu .buttonprofilelogged{padding:6px 4px 18px!important;gap:12px;margin-bottom:8px!important;border-bottom:1px solid #eef0f2;}
  .bgh-acct .box045-loged.bmenu .imgprofile{width:46px!important;height:46px!important;}
  .bgh-acct .box045-loged.bmenu .usrn{font-size:19px!important;}
  .bgh-acct .box045-loged.bmenu .btnmainmenu{padding:15px 8px!important;font-size:16px!important;gap:16px!important;border-radius:10px;}
  .bgh-acct .box045-loged.bmenu .btnmainmenu .image{width:21px!important;height:21px!important;opacity:.6;}
  .bgh-acct .box045-loged.bmenu .btnmainmenu:last-child{margin-top:10px;padding-top:16px!important;}
}
