/* =========================
   SIDEBAR (Cummo-like)
   States:
   - body.sb-collapsed   (desktop collapsed)
   - body.is-drawer-open (mobile drawer open)
   ========================= */

:root{
  --sb-open: 300px;
  --sb-collapsed: 86px;

  /* unified icon-button */
  --sb-btn: 56px;
  --sb-radius: 18px;
  --sb-icon: 20px;
}

/* =========================
   BASE (Desktop)
   ========================= */
.sidebarFixed{
  position: sticky;
  top: 14px;
  height: calc(100vh - 28px);
  width: var(--sb-open);

  display:flex;
  flex-direction:column;

  overflow:hidden;
  transition: width .18s ease, transform .18s ease;

  scrollbar-width:none;
}
.sidebarFixed::-webkit-scrollbar{ width:0; height:0; }

/* TOP */
.sbTop{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding: 12px 12px 8px;
}

.sbBrand{
  display:flex;
  align-items:center;
  justify-content:flex-start;
  width:100%;
  min-width:0;
}

.sbBrandImg{
  width: 200px;
  height:auto;
  display:block;
  transition: width .18s ease, opacity .18s ease;
}

/* Toggle (desktop) */
.sbToggle{
  border:1px solid rgba(255,255,255,.10);
  background: rgba(10,14,22,.30);
  color: var(--txt);

  width:46px;
  height:46px;
  border-radius: 14px;

  display:flex;
  align-items:center;
  justify-content:center;

  cursor:pointer;
  transition: border-color .12s ease, background .12s ease, transform .12s ease;
}
.sbToggle:hover{
  border-color: rgba(255,255,255,.18);
  background: rgba(255,255,255,.06);
}
.sbToggle:active{ transform: scale(.98); }
.sbToggle:focus-visible{
  outline: 2px solid rgba(221, 0, 177, .35);
  outline-offset: 2px;
}

/* BODY scroll */
.sbBody{
  flex: 1;
  overflow:auto;
  padding: 0 12px 12px;
  scrollbar-width:none;
  
}
.sbBody::-webkit-scrollbar{ width:0; height:0; }

.sb-user{ margin: 10px 0; }
.sb-search{ margin: 10px 0; }

.sep{
  height:1px;
  background: rgba(255,255,255,.07);
  margin:12px 0;
}

/* =========================
   MENU
   ========================= */
.sb-menu{
  display:flex;
  flex-direction:column;
  gap:6px;
  padding: 6px;
}

/* Buttons */
.tabbtn{
  width:100%;
  border:none;
  background: transparent;
  color: var(--txt);

  padding: 10px 12px;
  border-radius: 14px;

  display:flex;
  align-items:center;
  gap: 12px;
  justify-content:flex-start;

  cursor:pointer;
  position: relative;
  transition: background .12s ease, border-color .12s ease;
}

.tabbtn i{
  width: 26px;
  text-align:center;
  opacity: .92;
  font-size: 16px;
  line-height: 1;
}

.tabbtn .label{
  white-space: nowrap;
  text-align:left;
}

.tabbtn:hover{
  background: rgba(255,255,255,.06);
}

/* ACTIVE: pill + bar lateral */
.tabbtn.active{
  background: rgba(221, 0, 177, .14);
}
.tabbtn.active::before{
  content:"";
  position:absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 60%;
  border-radius: 999px;
  background: rgba(221, 0, 177, .85);
  box-shadow: 0 0 18px rgba(221, 0, 177, .22);
}

.tabbtn:focus-visible{
  outline: 2px solid rgba(221, 0, 177, .35);
  outline-offset: 2px;
}

/* =========================
   SEARCH
   ========================= */
.searchbox{
  display:flex;
  align-items:center;
  gap:10px;

  padding:10px 12px;
  border-radius: 16px;

  border:1px solid rgba(255,255,255,.10);
  background: rgba(10,14,22,.35);
}

/* normaliza ícono para centrar perfecto */
.searchbox i{
  color: rgba(255,255,255,.65);
  width: 24px;
  height: 24px;
  display:flex;
  align-items:center;
  justify-content:center;
  line-height: 1;
}

.searchbox input{
  width:100%;
  border:none;
  outline:none;
  background: transparent;
  color: var(--txt);
}
.searchbox input::placeholder{ color: rgba(167,178,199,.65); }

.searchbox:focus-within{
  outline: 2px solid rgba(221, 0, 177, .25);
  outline-offset: 2px;
}

.meta-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin:12px 0 0;
}

/* =========================
   USER MENU (INLINE)
   ========================= */
.userbox{ position:relative; }

.userbtn{
  width:100%;
  display:flex;
  align-items:center;
  gap:10px;

  padding:10px 12px;
  border-radius: 16px;

  border:1px solid rgba(255,255,255,.10);
  background: rgba(12,18,30,.55);
  backdrop-filter: blur(6px);

  cursor:pointer;
  transition: border-color .12s ease, background .12s ease;
}
.userbtn:hover{
  border-color: rgba(255,255,255,.18);
  background: rgba(255,255,255,.03);
}
.userbtn:focus-visible{
  outline: 2px solid rgba(221, 0, 177, .25);
  outline-offset: 2px;
}

.avatar{
  width:38px;
  height:38px;
  border-radius:14px;

  background: rgba(0,0,0,.35);
  border:1px solid rgba(255,255,255,.10);

  display:flex;
  align-items:center;
  justify-content:center;
  flex-shrink:0;
}

.usertext{
  display:flex;
  flex-direction:column;
  line-height:1.1;
  text-align:left;
  min-width:0;
}
.userline{
  font-weight:1000;
  overflow:hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chevron{
  color: var(--mut);
  font-size:12px;
  margin-left:auto;
  transition: transform .18s ease;
}

/* Menú inline (acordeón) */
.usermenu{
  position: static;
  width:100%;
  margin-top: 10px;

  background: rgba(12,18,30,.55);
  border:1px solid rgba(255,255,255,.10);
  border-radius: 16px;
  padding:10px;

  box-shadow:none;
}

/* estado cerrado */
.usermenu.is-collapsed{
  max-height: 0;
  opacity: 0;
  overflow: hidden;

  padding-top: 0;
  padding-bottom: 0;
  margin-top: 0;
  border-width: 0;

  transition: max-height .22s ease, opacity .18s ease, margin .18s ease, padding .18s ease, border-width .18s ease;
}

/* estado abierto */
.usermenu.is-open{
  max-height: 340px;
  opacity: 1;
  overflow: hidden;
  transition: max-height .26s ease, opacity .18s ease;
}

.userbox.is-open .chevron{ transform: rotate(180deg); }

.usersep{
  height:1px;
  background: rgba(255,255,255,.08);
  margin: 8px 0;
}

/* =========================
   Switch rows inside user menu
   ========================= */
.useritem-switch{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  width:100%;
  padding:10px 12px;
  border-radius:12px;
}

.useritem-left{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}
.useritem-left i{
  width:20px;
  text-align:center;
  opacity:.9;
}
.useritem-left span{
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

/* iOS-like switch */
.switch{
  position:relative;
  display:inline-block;
  width:46px;
  height:26px;
  flex:0 0 auto;
}
.switch input{
  opacity:0;
  width:0;
  height:0;
}
.switch .slider{
  position:absolute;
  inset:0;
  background:rgba(255,255,255,.18);
  border:1px solid rgba(255,255,255,.20);
  border-radius:999px;
  transition:all .18s ease;
}
.switch .slider::before{
  content:"";
  position:absolute;
  height:20px;
  width:20px;
  left:3px;
  top:50%;
  transform:translateY(-50%);
  background:#fff;
  border-radius:999px;
  transition:all .18s ease;
}
.switch input:checked + .slider{
  background:rgba(0, 255, 170, .35);
  border-color:rgba(0, 255, 170, .40);
}
.switch input:checked + .slider::before{
  transform: translate(20px, -50%);
}

/* =========================
   FOOTER
   ========================= */
.sbFoot{
  padding: 10px 12px 12px;
  border-top: 1px solid rgba(255,255,255,.07);
}

/* =========================
   COLLAPSED (Desktop)
   - SOLO sobrescribimos lo NECESARIO para icon-only
   ========================= */
body.sb-collapsed .sidebarFixed{ width: var(--sb-collapsed); }

/* Top en columna */
body.sb-collapsed .sbTop{
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 14px 10px 10px;
}

/* Logo reducido */
body.sb-collapsed .sbBrand{
  width: 100%;
  justify-content: center;
  border: none;
  background: transparent;
  padding: 0;
}
body.sb-collapsed .sbBrandImg{
  width: 36px;
  height:auto;
  display:block;
}

/* Convertir a botones cuadrados (icon-only) */
body.sb-collapsed .sbToggle,
body.sb-collapsed .userbtn,
body.sb-collapsed .searchbox,
body.sb-collapsed .tabbtn,
body.sb-collapsed .sbFoot .tabbtn{
  width: var(--sb-btn);
  height: var(--sb-btn);
  padding: 0;
  border-radius: var(--sb-radius);

  display:flex;
  align-items:center;
  justify-content:center;

  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
}

/* Hover uniforme en collapsed */
body.sb-collapsed .sbToggle:hover,
body.sb-collapsed .userbtn:hover,
body.sb-collapsed .searchbox:hover,
body.sb-collapsed .tabbtn:hover{
  background: rgba(255,255,255,.07);
  border-color: rgba(255,255,255,.16);
}

/* User collapsed: ocultar textos y acordeón */
body.sb-collapsed .sb-user{
  margin: 10px 0;
  display:flex;
  justify-content:center;
}
body.sb-collapsed .usertext,
body.sb-collapsed .chevron{ display:none; }
body.sb-collapsed .usermenu{ display:none; }

/* Search collapsed: ocultar input y meta */
body.sb-collapsed .sb-search{
  margin: 10px 0 12px;
}
body.sb-collapsed .searchbox{
  gap: 0;
}
body.sb-collapsed .searchbox input{ display:none; }
body.sb-collapsed .meta-row{ display:none; }

/* Body padding reducido */
body.sb-collapsed .sbBody{  justify-items: center;}

/* Menú centrado */
body.sb-collapsed .sb-menu{
  padding: 10px 0;
  gap: 12px;
  align-items: center;
}

/* Icon centering (necesario porque tabbtn en normal no usa height fijo) */
body.sb-collapsed .tabbtn i{
  width: 24px;
  height: 24px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size: var(--sb-icon);
  line-height: 1;
  margin: 0;
}
body.sb-collapsed .tabbtn .label{ display:none; }

/* Active en collapsed */
body.sb-collapsed .tabbtn.active{
  border-color: rgba(221, 0, 177, .45);
  background: rgba(221, 0, 177, .12);
}
body.sb-collapsed .tabbtn.active::before{
  left: 8px;
  width: 4px;
  height: 28px;
  border-radius: 999px;
}

/* Footer centrado */
body.sb-collapsed .sbFoot{
  padding: 12px 10px;
  display:flex;
  justify-content:center;
}

/* =========================
   MOBILE DRAWER
   ========================= */
.sbOverlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(2px);
  z-index: 110;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}

/* =========================
   SHELL (layout principal)
   - Sincronizado con el sidebar
   ========================= */

.shell{
  flex: 1;
  min-height: 0;

  display: grid;
  grid-template-columns: var(--sb-open) 1fr; /* ✅ usa la variable del sidebar */
  gap: 14px;
  padding: 14px;
  margin: 0 auto;
  width: 100%;
  overflow: hidden;

  /* ✅ animación suave cuando colapsa */
  transition: grid-template-columns .18s ease;
}

/* ✅ cuando colapsas el sidebar, el grid también colapsa la columna */
body.sb-collapsed .shell{
  grid-template-columns: var(--sb-collapsed) 1fr;
}

/* RESPONSIVE */
@media (max-width: 980px){
  .shell{
    grid-template-columns: 1fr;  /* en móvil NO reservamos columna */
  }

  /* aunque esté sb-collapsed, en móvil el shell sigue 1 columna */
  body.sb-collapsed .shell{
    grid-template-columns: 1fr;
  }

  .list{ max-height: 320px; }
}




/* ================
   MOBILE TOP/BOTTOM BARS
   ================ */
.mTopbar, .mBottombar, .mSheet, .mSheetBackdrop { display:none; }

@media (max-width: 980px){
  /* Oculta el sidebar (solo en móvil/tablet) */
  .sidebarFixed{ display:none; }

  /* Deja espacio arriba y abajo para las barras */
  body{
    padding-top: 64px;   /* topbar */
    padding-bottom: 78px;/* bottombar */
  }

  /* TOP */
  .mTopbar{
    display:flex;
    align-items:center;
    gap:10px;

    position: fixed;
    top: 10px;
    left: 10px;
    right: 10px;
    z-index: 140;

    padding: 10px;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,.10);
  }

  .mIconBtn{
    width: 44px;
    height: 44px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,.10);
    background: rgba(10,14,22,.35);
    color: var(--txt);
    display:flex;
    align-items:center;
    justify-content:center;
    cursor:pointer;
  }
  .mIconBtn:hover{ background: rgba(255,255,255,.06); }

  .mSearchWrap{
    flex:1;
    min-width:0;
  }
  .mSearchWrap.is-hidden{ display:none; }

  .mSearchBox{
    display:flex;
    align-items:center;
    gap:10px;
    padding: 10px 12px;
    border-radius: 16px;
    border:1px solid rgba(255,255,255,.10);
    background: rgba(10,14,22,.35);
  }
  .mSearchBox input{
    width:100%;
    border:none;
    outline:none;
    background:transparent;
    color: var(--txt);
  }
  .mSearchBox i{ color: rgba(255,255,255,.65); }

  /* BOTTOM */
  .mBottombar{
    display:grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;

    position: fixed;
    bottom: 10px;
    left: 10px;
    right: 10px;
    z-index: 140;

    padding: 10px;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,.10);
  }

  .mTab{
    border:none;
    background: transparent;
    color: var(--txt);
    border-radius: 16px;
    padding: 10px 6px;

    display:flex;
    flex-direction: column;
    align-items:center;
    justify-content:center;
    gap: 6px;

    cursor:pointer;
    transition: background .12s ease;
  }
  .mTab i{ font-size: 18px; opacity: .92; line-height:1; }
  .mTab span{
    font-size: 11px;
    opacity: .85;
    white-space: nowrap;
  }

  .mTab:hover{ background: rgba(255,255,255,.06); }
  .mTab.active{
    background: rgba(221, 0, 177, .14);
    box-shadow: 0 0 18px rgba(221, 0, 177, .10);
  }

  /* MORE SHEET */
  .mSheetBackdrop{
    display:block;
    position: fixed;
    inset: 0;
    z-index: 150;
    background: rgba(0,0,0,.55);
    opacity: 0;
    pointer-events:none;
    transition: opacity .18s ease;
  }

  .mSheet{
    display:block;
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    z-index: 160;

    border-radius: 22px;
    border: 1px solid rgba(255,255,255,.10);
    transform: translateY(120%);
    transition: transform .22s ease;

    overflow:hidden;
  }

  body.is-more-open .mSheetBackdrop{
    opacity:1;
    pointer-events:auto;
  }
  body.is-more-open .mSheet{
    transform: translateY(0);
  }

  .mSheetHead{
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding: 14px;
    border-bottom: 1px solid rgba(255,255,255,.08);
  }
  .mSheetTitle{ font-weight: 900; }

  .mSheetBody{ padding: 10px; display:flex; flex-direction:column; gap:8px; }

  .mSheetItem{
    width:100%;
    display:flex;
    align-items:center;
    justify-content:flex-start;
    gap:10px;

    padding: 12px 12px;
    border-radius: 16px;

    border: 1px solid rgba(255,255,255,.10);
    background: rgba(12,18,30,.40);
    color: var(--txt);
    cursor:pointer;
  }
  .mSheetItem:hover{ background: rgba(255,255,255,.06); }
  .mSheetItem i{ width:20px; text-align:center; opacity:.9; }

  .mSheetSep{
    height:1px;
    background: rgba(255,255,255,.08);
    margin: 6px 0;
  }

  .mSheetSwitch{
    justify-content:space-between;
  }
  .mSheetLeft{
    display:flex;
    align-items:center;
    gap:10px;
    min-width:0;
  }

  .mSheetItem.danger{
    border-color: rgba(255,80,80,.25);
  }
}
