/* ── subpanel.css — Akino Systems ── */

:root {
  --sp-w: 220px;        /* largura do painel */
  --sp-gap: 8px;        /* gap das bordas */
  --sw-open: calc(56px + var(--sp-w) + var(--sp-gap) * 2);
}

/* ── PAINEL ── */
.sub-panel {
  position: fixed;
  top: 0; bottom: 0;
  left: 56px;
  width: 0;
  overflow: hidden;
  z-index: 105;            /* abaixo do sidebar (110) mas acima do topbar (50) */
  transition: width .22s cubic-bezier(.16,1,.3,1);
  pointer-events: none;
}

.sub-panel.open {
  width: calc(var(--sp-w) + var(--sp-gap) * 2);
  pointer-events: all;
}

/* Inner card — arredondado, com gap das bordas */
.sub-panel-inner {
  position: absolute;
  top: var(--sp-gap);
  bottom: var(--sp-gap);
  left: var(--sp-gap);
  right: var(--sp-gap);
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 24px rgba(0,0,0,.07);
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity .2s cubic-bezier(.16,1,.3,1),
              transform .2s cubic-bezier(.16,1,.3,1);
}
body.dark .sub-panel-inner {
  box-shadow: 0 4px 24px rgba(0,0,0,.3);
}

.sub-panel.open .sub-panel-inner {
  opacity: 1;
  transform: translateX(0);
}

/* ── HEADER ── */
.sp-header {
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sp-header-title {
  font-size: 13px;
  font-weight: 650;
  color: var(--text);
  letter-spacing: -.2px;
}
.sp-header-sub {
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 1px;
}

/* ── SCROLL AREA ── */
.sp-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  padding: 6px 0 10px;
}
.sp-body::-webkit-scrollbar { display: none; }

/* ── SECTION ── */
.sp-section { margin-bottom: 2px; }

.sp-section-hd {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  cursor: pointer;
  border-radius: 0;
  transition: background .1s;
  user-select: none;
}
.sp-section-hd:hover { background: var(--s2); }

.sp-section-icon {
  width: 22px; height: 22px;
  border-radius: 6px;
  background: var(--s2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .12s;
}
.sp-section-hd:hover .sp-section-icon,
.sp-section.active .sp-section-icon {
  background: var(--s3);
}

.sp-section-label {
  flex: 1;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sp-caret {
  color: var(--muted);
  opacity: .5;
  transition: transform .17s cubic-bezier(.16,1,.3,1), opacity .12s;
  flex-shrink: 0;
}
.sp-section.open .sp-caret {
  transform: rotate(90deg);
  opacity: .8;
}

/* ── SUB-ITEMS ── */
.sp-items {
  overflow: hidden;
  max-height: 0;
  transition: max-height .22s cubic-bezier(.16,1,.3,1);
}
.sp-section.open .sp-items {
  max-height: 400px;
}

.sp-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 38px;
  cursor: pointer;
  border-radius: 0;
  transition: background .1s, color .1s;
  user-select: none;
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}
.sp-item:hover {
  background: var(--s2);
  color: var(--text);
}
.sp-item.active {
  color: var(--text);
  font-weight: 500;
}
.sp-item.active::before {
  content: '';
  display: inline-block;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--text);
  margin-right: 2px;
  flex-shrink: 0;
}
.sp-item-dot {
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--border2);
  flex-shrink: 0;
  margin-right: 2px;
}

/* ── SEPARATOR ── */
.sp-sep {
  height: 1px;
  background: var(--border);
  margin: 6px 12px;
}

/* ── DIRECT NAV ITEM (sem sub-items) ── */
.sp-direct {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  cursor: pointer;
  transition: background .1s;
  user-select: none;
}
.sp-direct:hover { background: var(--s2); }
.sp-direct-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
}

/* ── PUSH MAIN when panel open ── */
/* Controlled via JS adding .sp-open to body */
body.sp-open .main {
  margin-left: var(--sw-open);
  width: calc(100vw - var(--sw-open));
  transition: margin-left .22s cubic-bezier(.16,1,.3,1),
              width .22s cubic-bezier(.16,1,.3,1);
}
body:not(.sp-open) .main {
  transition: margin-left .22s cubic-bezier(.16,1,.3,1),
              width .22s cubic-bezier(.16,1,.3,1);
}

/* ── Add btn inline (ex: + Novo projeto) ── */
.sp-item-add {
  margin-left: auto;
  width: 16px; height: 16px;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  opacity: 0;
  transition: opacity .1s, background .1s, color .1s;
  flex-shrink: 0;
}
.sp-item:hover .sp-item-add { opacity: 1; }
.sp-item-add:hover { background: var(--s3); color: var(--text); }
