/* shell.css — EquiCopy-style app shell ported to Juris Sync, recolored.
   DARK sidebar (own palette, independent of the light main :root) + LIGHT main
   content + purple/cyan accents. Loaded AFTER styles.css; sidebar rules are
   scoped under .app-sidebar so they override Juris's old top-nav .tab-btn. */

.app-shell { display: flex; min-height: 100vh; }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }

/* ── Sidebar (dark) ─────────────────────────────────────────── */
.app-sidebar {
  width: 185px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #151035 0%, #0f0a2e 100%);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid rgba(139, 92, 246, 0.25);
  box-shadow: 1px 0 18px rgba(0, 0, 0, 0.35);
  transition: width 0.18s ease;
  z-index: 100;
  overflow: hidden;
}
.app-sidebar.collapsed { width: 64px; }

.sidebar-brand {
  padding: 8px 14px;
  border-bottom: 1px solid rgba(139, 92, 246, 0.18);
  display: flex; align-items: center; justify-content: center;
  height: 68px; min-height: 68px; box-sizing: border-box;  /* match .app-topbar so the divider line is continuous */
}
.sidebar-brand-full {
  height: 62px; width: auto; max-width: 100%; object-fit: contain; display: block;
  /* logo-jurissync-trans.png has its dark square background removed (alpha from
     brightness), so it blends seamlessly into the dark sidebar — no square. */
}
.sidebar-brand-icon { display: none; height: 34px; width: 34px; object-fit: contain; }
.app-sidebar.collapsed .sidebar-brand-full { display: none; }
.app-sidebar.collapsed .sidebar-brand-icon { display: block; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto; overflow-x: hidden;
  padding: 16px 10px;
  display: flex; flex-direction: column; gap: 18px;
  scrollbar-width: thin;
  scrollbar-color: rgba(139, 92, 246, 0.35) transparent;
  /* neutralize the old top-nav .tab-nav background/gradient if class lingers */
  background: transparent !important;
  border: none !important;
}
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(139, 92, 246, 0.35); border-radius: 3px; }
.sidebar-nav::before { display: none !important; content: none !important; }

.sidebar-section { display: flex; flex-direction: column; gap: 2px; }
.sidebar-section-title,
.sidebar-section-toggle {
  background: transparent; border: none; cursor: pointer;
  width: 100%; text-align: left; font-family: inherit;
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  font-size: 0.64rem; font-weight: 800; letter-spacing: 0.13em; text-transform: uppercase;
  color: #7c83a3; padding: 6px 14px 3px;
  white-space: nowrap; overflow: hidden;
  transition: color 0.15s, opacity 0.15s, height 0.15s;
}
.sidebar-section-toggle:hover { color: var(--accent-bright, #22d3ee); }
.sidebar-section-chev { width: 11px; height: 11px; flex-shrink: 0; transition: transform 0.18s ease; opacity: 0.65; }
.sidebar-section.section-collapsed .sidebar-section-chev { transform: rotate(-90deg); }

.sidebar-section-items {
  display: flex; flex-direction: column; gap: 2px; overflow: hidden;
  max-height: 600px; transition: max-height 0.22s ease, opacity 0.18s ease;
}
.sidebar-section.section-collapsed .sidebar-section-items { max-height: 0; opacity: 0; pointer-events: none; }

/* Sidebar nav buttons — override Juris's old horizontal-tab .tab-btn */
.app-sidebar .tab-btn {
  flex-shrink: 0;
  background: transparent;
  color: #b9c2d6;
  border: none; border-radius: 9px;
  padding: 8px 12px;
  font-size: 0.86rem; font-weight: 500; font-family: inherit;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  display: flex; align-items: center; gap: 11px;
  position: relative; width: 100%; text-align: left;
  white-space: nowrap; overflow: hidden;
  box-shadow: none;
}
.app-sidebar .tab-btn::after { content: none !important; }
.app-sidebar .tab-btn:hover { background: rgba(139, 92, 246, 0.14); color: #fff; }
.app-sidebar .tab-btn.active {
  background: linear-gradient(135deg, #8b5cf6, #06b6d4);
  color: #fff; font-weight: 600;
  box-shadow: 0 0 18px rgba(124, 92, 246, 0.6), 0 0 8px rgba(6, 182, 212, 0.45);
}
.app-sidebar .tab-btn.active::before {
  content: none;
}
.app-sidebar .tab-btn.active .tab-label { text-shadow: none; }
.tab-ico { width: 18px; height: 18px; flex-shrink: 0; color: currentColor; opacity: 0.82; }
.app-sidebar .tab-btn:hover .tab-ico, .app-sidebar .tab-btn.active .tab-ico { opacity: 1; }
.app-sidebar .tab-btn span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Collapsed sidebar: icons only */
.app-sidebar.collapsed .sidebar-section-title,
.app-sidebar.collapsed .sidebar-section-toggle { opacity: 0; height: 0; padding: 0; pointer-events: none; }
.app-sidebar.collapsed .sidebar-section-items { max-height: none; opacity: 1; pointer-events: auto; }
.app-sidebar.collapsed .tab-btn { justify-content: center; padding: 10px 0; }
.app-sidebar.collapsed .tab-btn span { display: none; }
.app-sidebar.collapsed .tab-btn.active::before { left: 0; top: 4px; bottom: 4px; }

.sidebar-footer { border-top: 1px solid rgba(139, 92, 246, 0.18); padding: 8px 10px; }
.sidebar-collapse-btn {
  display: flex; align-items: center; gap: 11px; width: 100%;
  background: transparent; color: #7c83a3; border: none; border-radius: 8px;
  padding: 9px 12px; font-size: 0.78rem; font-weight: 500; cursor: pointer; font-family: inherit;
  transition: color 0.12s, background 0.12s; white-space: nowrap; overflow: hidden;
}
.sidebar-collapse-btn:hover { color: #fff; background: rgba(139, 92, 246, 0.14); }
.sidebar-collapse-btn svg { width: 16px; height: 16px; flex-shrink: 0; transition: transform 0.18s; }
.app-sidebar.collapsed .sidebar-collapse-btn { justify-content: center; padding: 10px 0; }
.app-sidebar.collapsed .sidebar-collapse-btn svg { transform: rotate(180deg); }
.app-sidebar.collapsed .sidebar-collapse-btn span { display: none; }

/* ── Top bar (light) ────────────────────────────────────────── */
.app-topbar {
  background: var(--surface, #fff);
  border-bottom: 1px solid var(--border, #e7ebf3);
  padding: 0 28px;
  display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0; z-index: 90;
  height: 68px; min-height: 68px; box-sizing: border-box;
}
.app-topbar-title {
  font-family: 'Inter', 'DM Sans', sans-serif;
  font-size: 1.2rem; font-weight: 700; color: var(--navy, #1e1b4b); flex: 1;
  letter-spacing: -0.01em;
}
.app-topbar .header-actions { position: static; transform: none; margin-left: auto; }

.app-tab-panels { flex: 1; background: var(--bg, #f6f7f9); }

/* ── Responsive: auto-collapse sidebar ≤1100px ──────────────── */
@media (max-width: 1100px) {
  .app-sidebar { width: 64px; }
  .app-sidebar .sidebar-brand-full { display: none; }
  .app-sidebar .sidebar-brand-icon { display: block; }
  .app-sidebar .sidebar-section-title,
  .app-sidebar .sidebar-section-toggle { opacity: 0; height: 0; padding: 0; pointer-events: none; }
  .app-sidebar .sidebar-section-items { max-height: none; opacity: 1; pointer-events: auto; }
  .app-sidebar .tab-btn { justify-content: center; padding: 10px 0; }
  .app-sidebar .tab-btn span { display: none; }
  .app-sidebar .tab-btn.active::before { left: 0; top: 4px; bottom: 4px; }
  .app-sidebar .sidebar-collapse-btn { justify-content: center; padding: 10px 0; }
  .app-sidebar .sidebar-collapse-btn span { display: none; }
  .app-topbar { padding: 0 16px; }
}
