/* CA Cloud Desk–style Guide left sidebar */
body {
  --sidebar-width: 260px;
  --sidebar-collapsed: 72px;
}

.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  transition: width 0.2s ease, transform 0.25s ease;
  overflow: hidden;
}

body.sidebar-collapsed .app-sidebar {
  width: var(--sidebar-collapsed);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.9rem 0.65rem;
  border-bottom: 1px solid #e2e8f0;
  min-height: 76px;
}

.sidebar-collapse {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: #64748b;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s;
}

.sidebar-collapse:hover {
  background: rgba(37, 183, 167, 0.1);
  color: #00b8a9;
}

.sidebar-collapse svg {
  width: 18px;
  height: 18px;
  transition: transform 0.2s ease;
}

body.sidebar-collapsed .sidebar-collapse svg {
  transform: rotate(180deg);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: inherit;
  min-width: 0;
  overflow: hidden;
  flex: 1;
}

.sidebar-brand img {
  height: 52px !important;
  width: auto !important;
  max-height: 52px !important;
  max-width: 100% !important;
  object-fit: contain;
  flex-shrink: 1;
  display: block;
}

/* Full lockup already includes “CA Cloud Desk” wordmark */
.sidebar-brand img.sidebar-brand-lockup + .sidebar-brand-text,
.sidebar-brand:has(img.sidebar-brand-lockup) .sidebar-brand-text {
  display: none;
}

body.sidebar-collapsed .sidebar-brand img.sidebar-brand-lockup {
  width: 42px !important;
  max-width: 42px !important;
  height: 42px !important;
  object-fit: cover;
  object-position: left center;
  border-radius: 8px;
  flex-shrink: 0;
}

.sidebar-brand-text {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f2744;
  white-space: nowrap;
  letter-spacing: -0.02em;
}

body.sidebar-collapsed .sidebar-brand-text {
  display: none;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.75rem 0.5rem;
  overflow-y: auto;
  flex: 1;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  border-radius: 8px;
  text-decoration: none;
  color: #64748b;
  font-weight: 500;
  font-size: 0.9375rem;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.sidebar-nav a:hover {
  background: rgba(37, 183, 167, 0.1);
  color: #00b8a9;
}

.sidebar-nav a.active,
.sidebar-nav a.active:hover,
.sidebar-nav a[aria-current="page"] {
  color: #00b8a9 !important;
  background: rgba(37, 183, 167, 0.14) !important;
  font-weight: 600;
}

.sidebar-nav a.active .nav-icon,
.sidebar-nav a[aria-current="page"] .nav-icon {
  color: #00b8a9 !important;
}

.sidebar-nav a .nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Nested Free Tools / Forms / Videos category links (not top-level nav) */
.sidebar-nav .left-panel a,
.sidebar-nav .videos-subnav a,
.sidebar-nav .panel-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.55rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #64748b;
  white-space: nowrap;
}

.sidebar-nav .left-panel a svg,
.sidebar-nav .panel-link svg,
.sidebar-nav .left-panel .nav-item-header svg {
  width: 15px !important;
  height: 15px !important;
  min-width: 15px;
  min-height: 15px;
  flex-shrink: 0;
  display: block;
}

.sidebar-nav .left-panel a:hover,
.sidebar-nav .videos-subnav a:hover,
.sidebar-nav .panel-link:hover,
.sidebar-nav .left-panel a:focus,
.sidebar-nav .panel-link:focus {
  background: rgba(37, 183, 167, 0.1) !important;
  color: #00b8a9 !important;
  outline: none;
}

.sidebar-nav .left-panel a.active,
.sidebar-nav .videos-subnav a.active,
.sidebar-nav .panel-link.active,
.sidebar-nav .left-panel .active-dashboard {
  background: rgba(37, 183, 167, 0.14) !important;
  color: #00b8a9 !important;
  font-weight: 600;
}

.sidebar-nav .nav-item.nav-section-active > .nav-item-header,
.sidebar-nav .nav-item.expanded > .nav-item-header {
  background: rgba(37, 183, 167, 0.14) !important;
  color: #00b8a9 !important;
  font-weight: 600;
}

body.sidebar-collapsed .sidebar-nav a {
  justify-content: center;
  padding: 0.7rem;
}

body.sidebar-collapsed .sidebar-nav a span {
  display: none;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 1050;
}

body.sidebar-open .sidebar-overlay {
  display: block;
}

.app-main {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.2s ease;
}

body.sidebar-collapsed .app-main {
  margin-left: var(--sidebar-collapsed);
}

.top-header.app-top-header,
.app-main > .top-header {
  background: transparent;
  border-bottom: none;
  padding: 0;
  position: relative;
  top: auto;
  z-index: 20;
  box-shadow: none;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-left: 0.75rem;
  border: 1px solid #e2e8f0;
  background: white;
  border-radius: 8px;
  color: #0a2123;
  cursor: pointer;
  flex-shrink: 0;
}

.mobile-menu-btn svg {
  width: 22px;
  height: 22px;
}

.app-main .search-row {
  background: transparent;
  padding: 0.65rem 1.5rem 0.85rem;
  position: relative;
  flex: 1;
  z-index: auto;
}

@media (max-width: 768px) {
  .app-sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
  }

  body.sidebar-open .app-sidebar {
    transform: translateX(0);
  }

  body.sidebar-collapsed .app-sidebar {
    width: var(--sidebar-width);
  }

  body.sidebar-collapsed .sidebar-brand-text,
  body.sidebar-collapsed .sidebar-nav a span {
    display: inline;
  }

  body.sidebar-collapsed .sidebar-nav a {
    justify-content: flex-start;
    padding: 0.7rem 0.85rem;
  }

  .app-main,
  body.sidebar-collapsed .app-main {
    margin-left: 0;
  }

  .mobile-menu-btn {
    display: inline-flex;
  }

  .sidebar-collapse {
    display: none;
  }
}
