/* Sidebar Module Styles - Broto Rail Layout */

.sidebar {
  width: var(--sidebar-width);
  /* background: var(--sidebar-bg); */
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  z-index: 100;
  overflow: hidden; /* O overflow será gerenciado internamente */
  border-right: none;
  transition: width 0.3s ease;
}

/* Sidebar COM a flag ativada no body */
body.feature-blob-bg .sidebar {
    padding-top: 15px;
}

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

body.sidebar-collapsed .sidebar-main {
  display: none;
}

.sidebar-wrapper {
  display: flex;
  height: 100%;
  width: 100%;
}

/* Coluna 1: Rail (Ícones de Módulos) */
.sidebar-rail {
  width: var(--sidebar-rail-width);
  /* background: var(--background-secondary);; Um cinza bem claro para diferenciar */
  /* border-right: 1px solid var(--border); */
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  flex-shrink: 0;
}

.sidebar-rail-top {
  margin-bottom: 24px;
}

.sidebar-rail-burger {
  background: transparent;
  border: none;
  color: var(--muted-foreground);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: background 0.2s;
}

.sidebar-rail-burger:hover {
  background: var(--muted);
}

.sidebar-rail-items {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  align-items: center;
}

.sidebar-view-icon-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 44px;
  height: 44px;
  border: 1px solid transparent;
  background-color: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease, transform 0.2s ease;
  padding: 6px;
  text-decoration: none;
  position: relative;
  
  /* Performance hints - Otimizado */
  transform: translateZ(0); 
}

.sidebar-view-icon-btn svg {
  width: 20px;
  height: 20px;
  color: var(--muted-foreground);
  transition: transform 0.2s ease, color 0.2s ease;
}

.sidebar-view-icon-btn .sidebar-rail-label {
  font-size: 10px;
  font-weight: 500;
  font-family: inherit;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  position: absolute;
  bottom: -18px;
  white-space: nowrap;
  pointer-events: none;
}

.sidebar-view-icon-btn:hover .sidebar-rail-label,
.sidebar-view-icon-btn.active .sidebar-rail-label {
  opacity: 1;
  transform: translateY(0);
}

.sidebar-view-icon-btn:hover {
  background-color: var(--sidebar-item-hover-bg);
  color: var(--foreground);
}

.sidebar-view-icon-btn:hover svg {
  color: var(--foreground);
  transform: translateY(-1px);
}

.sidebar-view-icon-btn.active {
  background-color: var(--sidebar-item-active-bg);
  border-color: var(--soft-border);
  box-shadow: var(--shadow-sm);
  color: var(--primary);
}

.sidebar-view-icon-btn.active svg {
  color: var(--primary);
  transform: scale(1.1);
}

/* Indicador lateral para o Rail */
.sidebar-view-icon-btn.active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  background-color: var(--primary);
  border-radius: 0 4px 4px 0;
}

.sidebar-view-icon-btn:active {
  transform: scale(0.94);
}

/* Coluna 2: Main Navigation */
.sidebar-main {
  flex: 1;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  border-left: inherit;    
  border-radius: 15px 0 0 0;
  /* Fix para garantir que o border-radius seja respeitado em containers com overflow */
  isolation: isolate;
  transform: translateZ(0);
}

.sidebar-header {
  padding: 18px 15px;
  border-bottom: 1px solid var(--border);
  border-radius: 15px 0 0 0;
  position: relative;
  z-index: 1;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0;
}

.sidebar-logo-text {
    font-size: 17px;
    font-weight: 400;
    letter-spacing: -0.9px;
    color: #121e34;
    margin: 5px 0 0 4px;
    padding: 0;
    -webkit-font-smoothing: none; /* Tenta remover o suavizado */
  /* ou */
  -webkit-font-smoothing: subpixel-antialiased; /* Às vezes preferível */
  -moz-osx-font-smoothing: grayscale;
  cursor: default;
  user-select: none;
}
.sidebar-logo-text-ttl {
    font-size: 17px;
    font-weight: 400;
    letter-spacing: -0.9px;
    color: #6a727d;
    margin: 5px 0 0 0;
    padding: 0;
    -webkit-font-smoothing: none; /* Tenta remover o suavizado */
  /* ou */
  -webkit-font-smoothing: subpixel-antialiased; /* Às vezes preferível */
  -moz-osx-font-smoothing: grayscale;
  cursor: default;
  user-select: none;
}

.dark .sidebar-logo-text{color: #fff;}
.dark .sidebar-logo-text-ttl{color: #6a727d;}

.sidebar-nav {
  flex: 1;
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-section-label {
font-size: var(--font-size-label);
    font-weight: 500;
    color: var(--muted-foreground);
    padding: 0 12px 0 5px;
    margin: 0;
    letter-spacing: 0.5px;
}

.sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}

.sidebar-add-btn {
  background: transparent;
  border: none;
  color: var(--muted-foreground);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, color 0.15s ease;
  margin-right: 0;
}

.sidebar-add-btn:hover {
  background: var(--muted);
  color: var(--primary);
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 5px;
  border: 1px solid transparent;
  background-color: transparent;
  color: var(--sidebar-foreground);
  font-size: var(--font-size-sm);
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease, transform 0.2s ease;
  width: 100%;
  position: relative;
  margin-bottom: 4px;
  
  /* Performance hints - Otimizado */
  transform: translateZ(0);
}

.sidebar-item svg {
  color: var(--muted-foreground);
  flex-shrink: 0;
  transition: color 0.2s ease, transform 0.2s ease;
}

.sidebar-item:hover {
  background-color: var(--sidebar-item-hover-bg);
  color: var(--foreground);
}

.sidebar-item:hover svg {
  color: var(--foreground);
}

.sidebar-item.active {
  background-color: var(--sidebar-item-active-bg);
  border: 1px solid var(--soft-border);
  box-shadow: var(--shadow-sm);
  color: var(--primary);
  font-weight: 600;
}

.sidebar-item.active span{
  margin-left: 4px;
}

.sidebar-item.active svg {
  color: var(--primary);
}

/* Indicador lateral para itens ativos na lista */
.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  background-color: var(--primary);
  border-radius: 0 4px 4px 0;
  transition: all 0.2s ease;
}

.sidebar-item:active {
  transform: scale(0.98);
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

/* My Space Button Special Styling */
.sidebar-my-space-btn {
    margin-bottom: 4px;
    padding-left: 10px;
    gap: 5px;
}

.sidebar-my-space-btn.active {
    background-color: var(--sidebar-item-active-bg);
    border: 1px solid var(--soft-border);
    box-shadow: var(--shadow-sm);
    color: var(--primary);
}

.sidebar-my-space-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 12px;
    opacity: 0.4;
}

.sidebar-project-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Footer Section */
.sidebar-footer {
  /* padding: 16px;
  border-top: 1px solid var(--border);
  background: #fcfcfc; */
  display: none;
}

/* Sidebar Links */
.sidebar-links-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 4px;
}

.sidebar-link-item {
  color: var(--muted-foreground) !important;
  font-size: 13px !important;
  text-decoration: none;
  padding: 8px 12px !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px;
  border-radius: var(--radius-md);
}

.sidebar-link-item:hover {
  background: var(--muted) !important;
  color: var(--foreground) !important;
}
