.sidebar {
  width: 280px;
  height: 100vh;
  background: #243b5d;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  transition: width 0.3s ease;
  position: relative;
  overflow-x: hidden;

  &.collapsed {
    width: 64px;

    .sidebar-section {
      margin-bottom: 8px;
    }
  }

  // Header
  .sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    min-height: 64px;

    .logo {
      flex: 1;

      h1 {
        margin: 0;
        font-size: 24px;
        font-weight: 700;
        color: #3498db;
      }
    }

    .toggle-button {
      background: transparent;
      border: none;
      color: #ffffff;
      cursor: pointer;
      padding: 8px;
      border-radius: 4px;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: background-color 0.2s ease;

      &:hover {
        background-color: rgba(255, 255, 255, 0.1);
      }

      fa-icon {
        font-size: 20px;
      }
    }
  }

  // Bouton nouvelle discussion
  .new-chat-button {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin: 16px;
    background: #2984a1;
    border: none;
    border-radius: 8px;
    color: #ffffff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;

    &:hover {
      transform: translateY(-2px);
      box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
    }

    &.collapsed {
      justify-content: center;
      padding: 12px;
      margin: 16px 8px;

      fa-icon {
        margin: 0;
      }
    }

    fa-icon {
      font-size: 18px;
    }
  }

  // Sections
  .sidebar-section {
    margin-bottom: 24px;
    max-height: 35vh;
  }

  .section-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
    padding: 0 16px;
    margin: 0 0 12px 0;
    letter-spacing: 0.5px;
  }

  // Icônes en mode réduit
  .sidebar-icon-button {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 14px 0;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;

    &::before {
      content: '';
      position: absolute;
      left: 0;
      top: 50%;
      transform: translateY(-50%);
      width: 3px;
      height: 0;
      background: #3498db;
      transition: height 0.2s ease;
    }

    &:hover {
      background-color: rgba(255, 255, 255, 0.05);
      color: #ffffff;

      &::before {
        height: 60%;
      }
    }

    fa-icon {
      font-size: 20px;
    }
  }

  // Conversations
  .conversations-section {
    max-height: 300px;
    overflow-y: auto;
    padding: 0 8px;

    &::-webkit-scrollbar {
      width: 4px;
    }

    &::-webkit-scrollbar-track {
      background: rgba(255, 255, 255, 0.05);
      border-radius: 2px;
    }

    &::-webkit-scrollbar-thumb {
      background: rgba(255, 255, 255, 0.2);
      border-radius: 2px;

      &:hover {
        background: rgba(255, 255, 255, 0.3);
      }
    }
  }

  .conversations-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .conversation-item {
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;

    &:hover {
      background-color: rgba(255, 255, 255, 0.1);
    }

    &.active {
      background-color: rgba(52, 152, 219, 0.3);
      border-left: 3px solid #3498db;
    }

    &.sub-item {
      margin-left: 20px;
      padding: 8px 12px;
      font-size: 13px;
    }

    .conversation-title {
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      font-size: 14px;
    }
  }

  // Projets
  .projects-section {
    max-height: 400px;
    overflow-y: auto;
    padding: 0 8px;

    &::-webkit-scrollbar {
      width: 4px;
    }

    &::-webkit-scrollbar-track {
      background: rgba(255, 255, 255, 0.05);
      border-radius: 2px;
    }

    &::-webkit-scrollbar-thumb {
      background: rgba(255, 255, 255, 0.2);
      border-radius: 2px;

      &:hover {
        background: rgba(255, 255, 255, 0.3);
      }
    }
  }

  .projects-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .project-wrapper {
    margin-bottom: 4px;
  }

  .project-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;

    &:hover {
      background-color: rgba(255, 255, 255, 0.1);
    }

    .project-icon {
      font-size: 16px;
    }

    .project-name {
      flex: 1;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      font-size: 14px;
      font-weight: 500;
    }

    .expand-icon {
      font-size: 12px;
      color: rgba(255, 255, 255, 0.5);
    }
  }

  .project-conversations {
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .project-empty {
    padding: 8px 12px 8px 42px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
  }

  // Footer
  .sidebar-footer {
    margin-top: auto;
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: center;
    gap: 12px;

    .footer-button {
      background: transparent;
      border: none;
      color: rgba(255, 255, 255, 0.6);
      cursor: pointer;
      padding: 10px;
      border-radius: 6px;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.2s ease;

      &:hover {
        background-color: rgba(255, 255, 255, 0.1);
        color: #ffffff;
      }

      fa-icon {
        font-size: 18px;
      }
    }
  }
  .sidebar-footer-colapsed{
    display: flex;
    flex-direction: column;
  }
}
