/* =========================================================
   QUICKPIXEL CRM — SIDEBAR (DESKTOP + MOBILE)
   Works with your EXISTING JS:
   - leadPopup toggles via style.display = 'flex' / 'none'
   - messagesPopup toggles via .show class
========================================================= */

/* ---------- Desktop Sidebar Base ---------- */
.sidebar{
  width:70px;
  height:100vh;
  background:#000;
  position:fixed;
  left:0;
  top:0;
  z-index:1000;

  display:flex;
  flex-direction:column;
  align-items:center;
  padding-top:15px;

  border-top-right-radius:20px;
  border-bottom-right-radius:20px;

  border-right:1px solid rgba(1,221,195,0.10);
  box-shadow: 2px 0 12px rgba(1,221,195,0.14);
}

.logo img{
  width:45px;
  margin:20px 0;
}

.nav-icons{
  display:flex;
  flex-direction:column;
  align-items:center;
}

.bottom-icon{
  margin-top:auto;
  margin-bottom:30px;
  display:flex;
  flex-direction:column;
  align-items:center;
}

/* ---------- Icons ---------- */
.icon-wrapper{
  width:40px;
  height:40px;
  margin:6px 0;
  border-radius:50%;

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

  cursor:pointer;
  transition:transform .15s ease, background .2s ease, box-shadow .2s ease;
}

.icon-wrapper i{
  font-size:18px;
  color:rgba(255,255,255,0.65);
  transition:color .2s ease;
}

.icon-wrapper:hover{
  background: rgba(192,215,49,0.10);
  box-shadow: 0 0 10px rgba(192,215,49,0.18);
}
.icon-wrapper:hover i{ color:#c0d731; }

.icon-wrapper.active-popup{
  background: rgba(1,221,195,0.12);
  box-shadow: 0 0 12px rgba(1,221,195,0.22);
}
.icon-wrapper.active-popup i{ color:#01ddc3; }

/* =========================================================
   POPUPS (Desktop default)
========================================================= */

.lead-popup,
.message-popup{
  position:fixed;
  left:80px;
  width:260px;

  background: rgba(16,16,16,0.92);
  border:1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);

  border-radius:20px;
  padding:12px;

  display:none;         /* your JS sets display:flex for lead-popup */
  flex-direction:column;
  gap:10px;

  z-index:99999;
  box-shadow: 0 18px 50px rgba(0,0,0,0.55);
}

.lead-popup{ top:100px; }
.message-popup{ top:160px; }

/* messages opens via .show */
.message-popup.show{ display:flex; }

/* lead popup opens via inline display:flex from your JS
   (no special class needed) */
@keyframes qpPopIn{
  from{ transform: translateY(8px); opacity:0; }
  to{ transform: translateY(0); opacity:1; }
}
.lead-popup[style*="display: flex"],
.message-popup.show{
  animation: qpPopIn .18s ease-out;
}

/* ---------- Popup Items ---------- */
.popup-link,
.message-popup-link{
  display:flex;
  align-items:center;
  gap:10px;

  padding:12px 12px;
  border-radius:14px;

  background: rgba(255,255,255,0.05);
  border:1px solid rgba(255,255,255,0.08);

  color:rgba(255,255,255,0.92);
  text-decoration:none;
  font-weight:600;
  font-size:14px;

  transition: background .18s ease, border-color .18s ease, transform .12s ease;
}

.popup-link:hover,
.message-popup-link:hover{
  background: rgba(1,221,195,0.10);
  border-color: rgba(1,221,195,0.20);
  transform: translateY(-1px);
}

.popup-link i,
.message-popup-link i{
  font-size:15px;
  color:rgba(255,255,255,0.80);
}

/* ---------- Lead Accordion Groups ---------- */
.lead-group{
  border-radius:14px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
}

/* Button row */
.lead-btn{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;

  padding:12px 12px;
  background: transparent;
  border:none;

  color:rgba(255,255,255,0.92);
  font-weight:700;
  font-size:14px;
  cursor:pointer;

  transition: background .18s ease;
}

.lead-btn:hover{
  background: rgba(255,255,255,0.05);
}

.lead-btn i{
  color:rgba(255,255,255,0.85);
}

.arrow-icon{
  opacity:.65;
  transition: transform .18s ease, opacity .18s ease;
}
.lead-group.active .arrow-icon{
  transform: rotate(180deg);
  opacity:1;
}

/* Submenu */
.lead-submenu{
  max-height:0;
  overflow:hidden;
  opacity:0;
  transform: translateY(-4px);
  transition: max-height .25s ease, opacity .2s ease, transform .2s ease;

  border-top:1px solid rgba(255,255,255,0.06);
  padding:0 10px;
}

.lead-group.active .lead-submenu{
  max-height:260px;
  opacity:1;
  transform: translateY(0);
  padding:10px 10px 12px;
}

/* Submenu links */
.lead-submenu a{
  display:flex;
  align-items:center;

  padding:10px 10px;
  border-radius:12px;

  color:rgba(255,255,255,0.70);
  text-decoration:none;
  font-weight:600;
  font-size:13px;

  transition: background .18s ease, color .18s ease, transform .12s ease;
}

.lead-submenu a:hover{
  background: rgba(255,255,255,0.05);
  color:#01ddc3;
  transform: translateX(3px);
}

/* =========================================================
   MOBILE BOTTOM NAV + BOTTOM SHEET POPUPS
   (still using SAME JS)
========================================================= */
@media (max-width:1024px){

  /* Bottom nav */
  .sidebar{
    top:auto;
    bottom:0;
    left:0;
    width:100%;
    height:76px;
    padding:10px 14px calc(10px + env(safe-area-inset-bottom));

    flex-direction:row;
    justify-content:space-around;
    align-items:center;

    border-radius:0;
    border-right:none;
    border-top:1px solid rgba(255,255,255,0.08);

    background: rgba(10,10,10,0.92);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);

    box-shadow: 0 -18px 40px rgba(0,0,0,0.65);
    z-index:9999;
  }

  .sidebar .logo,
  .sidebar .bottom-icon{ display:none; }

  .sidebar .nav-icons{
    flex-direction:row;
    width:100%;
    justify-content:space-around;
  }

  .sidebar .icon-wrapper{
    width:46px;
    height:46px;
    margin:0;
    border-radius:14px;
  }

  .sidebar .icon-wrapper i{ font-size:20px; }

  /* Center action (messagesIcon) — border, NO ugly glow */
  .center-action{
    width:58px !important;
    height:58px !important;
    border-radius:18px !important;
    margin-top:-22px !important;

    border: 2px solid rgba(1,221,195,0.55) !important;
    background: rgba(12,12,12,0.98) !important;

    box-shadow: 0 10px 24px rgba(0,0,0,0.60) !important;
  }

  .center-action i{
    color:#01ddc3 !important;
    font-size:22px !important;
  }

  /* Bottom sheet popups (lead + messages) */
  /* Make the popup NOT full width: premium inset sheet */
  .lead-popup,
  .message-popup{
    left:50% !important;
    transform:translateX(-50%) !important;

    width:min(560px, 92vw) !important;
    bottom:88px !important;         /* above bottom nav */
    top:auto !important;

    height:auto !important;
    max-height:70vh !important;

    border-radius:22px !important;
    padding:14px 14px 16px !important;

    background:rgba(14,14,14,0.92) !important;
    border:1px solid rgba(255,255,255,0.08) !important;
    backdrop-filter: blur(18px) !important;
    -webkit-backdrop-filter: blur(18px) !important;

    overflow:auto !important;
    box-shadow:0 18px 60px rgba(0,0,0,0.65) !important;
  }

  /* Handle bar */
  .lead-popup::before,
  .message-popup::before{
    content:"";
    display:block;
    width:54px;
    height:5px;
    border-radius:999px;
    background:rgba(255,255,255,0.18);
    margin:2px auto 10px auto;
  }

  /* Top row: All Leads should remain full width */
  #leadPopup .popup-link{
    border-radius:16px !important;
    padding:14px 12px !important;
    background:rgba(255,255,255,0.06) !important;
    border:1px solid rgba(255,255,255,0.08) !important;
    font-weight:700 !important;
    margin-bottom:10px;
  }

  /* 2-column grid for services (1-2 / 3-4 pattern) */
  .lead-grid{
    display:grid;
    grid-template-columns: 1fr 1fr;
    gap:10px;
  }

  /* Each service card */
  .lead-group{
    overflow:visible !important; /* IMPORTANT: don’t crop submenu */
    border-radius:16px;
  }

  .lead-btn{
    width:100%;
    border-radius:16px !important;
    padding:14px 12px !important;
    background:rgba(255,255,255,0.05) !important;
    border:1px solid rgba(255,255,255,0.08) !important;
    font-size:14px !important;
  }

  /* When one expands, make it span full width (so submenu looks clean) */
  .lead-group.active{
    grid-column: 1 / -1;
  }

  .lead-submenu{
    display:none; /* use display for mobile (cleaner than max-height hacks) */
    margin-top:10px;
    padding:10px;
    border-radius:16px;
    background:rgba(255,255,255,0.04);
    border:1px solid rgba(255,255,255,0.07);
  }
  .lead-group.active .lead-submenu{
    display:block;
  }

  .lead-submenu a{
    display:block;
    padding:12px 12px;
    border-radius:14px;
    color:rgba(255,255,255,0.78) !important;
    text-decoration:none;
    border:1px solid transparent;
  }
  .lead-submenu a:hover{
    background:rgba(1,221,195,0.10);
    border-color:rgba(1,221,195,0.18);
    color:#01ddc3 !important;
  }
}